Fill between lines #10368
-
Hey there, Is there any way to fill the space between two lines in a Line chart?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes, first you need 2 lines (your code sample in fiddle only contains one line). Then you configure the filler plugin to fill one or other to the other. |
Beta Was this translation helpful? Give feedback.
-
Slightly related, I would like to create a plot like this using Chart.js (and be updated every time step) It shows the distribution of wealth of a simulated population over time. All code to generate this plot is over here. Any tips for creating this with Chart.js? Especially on stacking the different bands on top of each other. |
Beta Was this translation helpful? Give feedback.
Yes, first you need 2 lines (your code sample in fiddle only contains one line). Then you configure the filler plugin to fill one or other to the other.
Some link to relevant samples and documentation:
https://www.chartjs.org/docs/latest/samples/area/line-datasets.html
https://www.chartjs.org/docs/latest/charts/area.html