I have a project requirement to create a stacked bar chart that should look like the image below:
https://i.sstatic.net/MBwXy.png
Currently, I am utilizing the c3-angular-directive library along with c3.js for chart creation. The challenge lies in dealing with multiple categories.
The first level of categorization includes Proj1 and Proj2
, followed by R1.0 and R2.0
. I have attempted the following approach:
<c3chart bindto-id="stackedBarChart" show-labels="true">
<chart-column column-id="x" column-values="R1.0, R2.0" />
<chart-column column-id="Proj1Item1" column-values="10,20" column-type="bar" />
<chart-column column-id="Proj2Item1" column-values="20,20" column-type="bar" />
<chart-column column-id="Proj1Item2" column-values="30,10" column-type="bar" />
<chart-column column-id="Proj2Item2" column-values="20,10" column-type="bar" />
<chart-group group-values="Proj1Item1,Proj2Item1" />
<chart-group group-values="Proj1Item2,Proj2Item2" />
<chart-axes values-x="x" />
<chart-axis>
<chart-axis-x axis-position="outer-center" axis-type="category"></chart-axis-x>
</chart-axis>
</c3chart>
However, the result is not what I expected. I'm unsure how to achieve the desired outcome.
Are there any other types of charts that would better represent my data?