8000 Single bars not showing in bar chart · Issue #5797 · recharts/recharts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Single bars not showing in bar chart #5797
Open
@pavsidhu

Description

@pavsidhu

Do you want to request a feature or report a bug?

Bug report

What is the current behavior?

When creating a bar chart with only one bar available, the bar is invisible. If there's two the bars appear. This seems to be relevant to #2601.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar (template: https://codesandbox.io/p/sandbox/simple-line-chart-v25dl4).

<ChartContainer config={{ count: { label: "Count" } }}>
  <BarChart data={[{ interval: new Date(), count: 10 }]}>
    <XAxis
      dataKey="interval"
      type="number"
      scale="time"
      domain={[new Date().getTime(), new Date().getTime()]}
    />

    <YAxis dataKey="count" type="number" />

    <ChartTooltip />

    <Bar dataKey="count" />
  </BarChart>
</ChartContainer>

What is the expected behavior?

I expect a bar to be visible.

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

Recharts 2.15.3
Chrome
MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugGeneral bug labelenhancementEnhancement to a current API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0