5

I am able to draw normal bar chart using chart.js. However I want to draw a bar chart as follows. bar graph example

I have gone through the documentation of chart.js but to no avail, also searched extensively on internet but couldn't found a single hint. Almost all the questions lead to having multiple color bars in a bar chart.

3
  • Can you please share your current code? Commented Feb 22, 2017 at 14:18
  • I am just following the code given for the bar charts in chart.js documentation. I am using chart.js for the first time. I can share the simple bar chart code given in the documentation if you want to have a look at it. Commented Feb 22, 2017 at 14:19
  • Yes, please share Commented Feb 22, 2017 at 14:33

2 Answers 2

5

You can achieved this via stacked option.

options:{
  scales: {
    xAxes: [{stacked: true}],
    yAxes: [{stacked: true}]
  } 
}
Sign up to request clarification or add additional context in comments.

Comments

1

Finally I found the answer to my question. I wanted to have stacked bar chart.

Here is the answer.

Horizontal stacked bar chart with chart.js

PS: I have tested the answer myself and it works perfectly fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.