Search code examples
javascriptreactjschart.jsreact-chartjs-2

ChartJS Adding Different Lines for each column


I have a bar chart in my react app, and I want to add different limit lines for each column. Does anybody know how to configure it?(For chartJS < 2.9.0) The following is an example of what I am trying to do:

enter image description here


Solution

  • I have solved this issue with adding 3 datasets 1 for target values, 1 for lines and 1 for actual values. After adding 3 datasets, first 2 are stacked and only 2nd one is visible with 0.1 value (so it seems like a line). The 3rd dataset is independent (not stacked).