Horizontal stacked bar graph with chart.js

I am trying to find out if there is any plugin for horizontal stacked histogram with chart.js

I see that there are plugins for stacked histograms, as well as for horizontal histograms, but I have not found one that combines both.

https://github.com/Regaddi/Chart.StackedBar.js

Does anyone know how to achieve this?

+5
source share
2 answers

I know that this is several months, but I thought that I would add my answer for future generations.

I managed to do without additional plugins. If you set xAxes and yAxes to stacked: true at scale, you can create a horizontal graph with a horizontal layout.

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

Here is a short pen to show how I did it. http://codepen.io/jamiecalder/pen/NrROeB

Bonus: includes a code for displaying values ​​on a chart

+25
source

Take a look at the fork of ChartNew.js ( https://github.com/FVANCOP/ChartNew.js ). It has HorizontalStackedBars (and many other add-ons). See https://github.com/FVANCOP/ChartNew.js/wiki/050_available_graphs for how it will look.

+1
source

Source: https://habr.com/ru/post/1236207/


All Articles