Skip to content

Should render no data with no defined series #884

@nickofthyme

Description

@nickofthyme

Is your feature request related to a problem? Please describe.
Some implementations might desire the ability to only add series to the chart when data exists. For example, in the snippet below, if data is an empty array a blank chart will be rendered. Instead of rendering a blank chart we should render the no data ui.

{data.map((d) => (
  <BarSeries
    id="bars"
    name="amount"
    xScaleType={ScaleType.Ordinal}
    xAccessor="x"
    yAccessors={["y"]}
    data={d}
  />
))}

Note: the empty chart only occurs when there is an Axis specified.

See https://codesandbox.io/s/wonderful-cannon-2yf9e?file=/src/App.tsx

Describe the solution you'd like
Show no data ui when there is are no series listed in the chart

Describe alternatives you've considered
Pass empty data to one of the series.

Metadata

Metadata

Assignees

Labels

:dataData/series/scales related issueenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions