Horizontal stacked bar chart with chart.js

后端 未结 2 645
-上瘾入骨i
-上瘾入骨i 2020-11-28 13:03

I am trying to find out if there is any plugin to do a horizontal stacked bar chart with chart.js

I see there are plugins for stacked bar charts and also for horizon

相关标签:
2条回答
  • 2020-11-28 13:32

    Take a look at the fork ChartNew.js (https://github.com/FVANCOP/ChartNew.js). This has HorizontalStackedBars (and many other additions). See https://github.com/FVANCOP/ChartNew.js/wiki/050_available_graphs for how its going to look like.

    0 讨论(0)
  • 2020-11-28 13:44

    I know this is a few months old, but I thought I'd add my answer for future generations.

    I was able to do without extra plugins. If you set the xAxes and yAxes to stacked:true under scales, you can create a stacked horizontal graph.

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

    Here's a quick pen to show how I did it. http://codepen.io/jamiecalder/pen/NrROeB

    Bonus: Includes code to show the values on the graph

    0 讨论(0)
提交回复
热议问题