0π
in your y axes config you can add the prop suggestedMin
or min
between the stacked
and display
prop. With this the scale will start at that number, here you can put in the value of the lowest bar.
SuggestedMin will go lower if there is a bar with a lower value, if you use min if will use that as a final so if you have a bar with a lower value it wont get shown.
- Chartjs-Using data structures in chartjs
- Chartjs-Chartjs with Nextjs β User input for plotting graph
0π
You can combine "floating bars" and "stacked bar chart". See https://codepen.io/fantasyzer/pen/KKaqgoM for an example. Note that the data
of each bar is given as an array [Ybegin,Yend]. If you set stackable
to false
for the y scale the values are to be given as absolute:
datasets: [
{
data: [
[10,12],
[20,25],
[15,25],
[25,28],
...
Ref:
https://www.chartjs.org/docs/latest/samples/bar/floating.html, https://www.chartjs.org/docs/latest/samples/bar/stacked.html