nexxtway / react-rainbow

🌈 React Rainbow Components. Build your web application in a snap.
https://react-rainbow.io
MIT License
1.79k stars 112 forks source link

fix: dataset not rendering all values in bar type #2308

Open maximegheraille opened 2 years ago

maximegheraille commented 2 years ago

Describe the bug

when using the Chat component and given values to the dataset some values are not rendered.

To Reproduce 🕹

Steps to reproduce the behavior:

open the example on the website and change to chart to this.

 <Chart
                labels={['2019', '2020', '2021']}
                type="bar"
                className="rainbow-m-horizontal_xx-large rainbow-m-top_x-large"
            >
                <Dataset
                    title="Dataset 1"

                    values={[14, 19,15]}
                    backgroundColor="#1de9b6"
                    borderColor="#1de9b6"
                />

            </Chart>

Expected Behavior 🤔

To display the 14 for 2019

Current Behavior 😯

image

sidmohanty11 commented 2 years ago

@maximegheraille hi, i just checked this out. It's definitely showing that the data set has value of 14, but there is no way of setting a min value property so that it starts from 14 itself (which is the least value). But if, you use this instead

    <Chart
                labels={['2019', '2020', '2021']}
                type="bar"
                className="rainbow-m-horizontal_xx-large rainbow-m-top_x-large"
            >
                <Dataset
                    title="Dataset 1"
                    values={[14, 19,15, 0]}
                    backgroundColor="#1de9b6"
                    borderColor="#1de9b6"
                />
    </Chart>

react-rainbow1

you get the correct output (i guess this is what you wanted). I know this isn't the perfect way because if we consider it this way, we say value 0 is of label something which is not present. But it is a workaround.