Adyen / lume

Lume is a component library for visual representations of data, built for Vue with D3.
https://lumedataviz.com
MIT License
37 stars 1 forks source link

Make chart legend visible when there is no data yet #373

Closed bponomarenko closed 6 months ago

bponomarenko commented 6 months ago

Feature description

I'd like to make it possible to make stacked bar chart legend visible even when there is no data yet.

Problem/motivation

For one of my use cases, I'd like to render stacked bar chart for two specific scenarios – when there is no data yet, and when there is data but with 0 values (see examples below). In both cases chart tooltip is correctly rendered on hover with either No data or 0 as a value, but chart legend is only rendered for chart with 0 values.

Used library version is 1.6.5.

Chart with no data

<lume-stacked-bar-chart
  :labels="['1', '2', '3']"
  :data="[
    { label: 'Group 1', values: [] },
    { label: 'Group 2', values: [] },
  ]"
/>

Chart with 0 values

<lume-stacked-bar-chart
  :labels="['1', '2', '3']"
  :data="[
    { label: 'Group 1', values: [0, 0, 0] },
    { label: 'Group 2', values: [0, 0, 0] },
  ]"
/>

Describe alternatives you've considered

No response

Additional context

No response

Validations