WaduNoop
WaduNoop

Reputation: 65

Overlap horizontalBar graps using ChartJS

I'm using https://github.com/chartjs/Chart.js to display my graphs in my application. There's one feature that i want to do in my graph. I want to overlap the graphs to get the following results

Sample Graph

I need to get the display graph in the green box. As for now i only have red box.

Upvotes: 0

Views: 1250

Answers (1)

jordanwillis
jordanwillis

Reputation: 10705

Yes, you can easily do this in chart.js, its called stacking. You just need to set the stacked option to true.

scales: {
  xAxes: [{
    stacked: true
  }]
}

Note, you might have to set the yAxes option instead since this is horizontal. You can read more about it here and see a sample here. I will update my answer with a working codepen example when I get back to a computer.

Upvotes: 1

Related Questions