c3js / c3js/c3

Multiple categories and labels for chart

Open
#1,404 3 comments 7 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

I'm trying to build a stacked bar chart for one of the requirement. The chart should look like as follows:
![chart](https://cloud.githubusercontent.com/assets/1214686/10219350/d5437062-685b-11e5-8153-6a4e3d650326.png)

The problem here is kind of multiple categories.

The first level of categorization is Proj1 and Proj2 and the next level is R1.0 and R2.0. I've tried the following:

``` javascript
var chart = c3.generate({
bindto: '#chart',
data: {
columns: [
['Proj1Item1', 30, 200, 100],
['Proj1Item2', 50, 20, 10],
['Proj2Item1', 20, 120, 50],
['Proj2Item2', 30, 20, 80],
],
type: 'bar',
groups: [
['Proj1Item1', 'Proj1Item2'],
['Proj2Item1', 'Proj2Item2']
]

},
axis: {
x: {
type: 'category',
categories: ['R1.0', 'R2.0', 'R3.0']
}
}
});
```

Is it not possible with C3 to achieve this? I tried googling around and not able to find the solution for it.

Contributor guide

Open the contributing guide

Research direction

Start with the supplied c3.generate configuration and reproduce the grouped series with categorical x-axis behavior. Determine whether two category levels and the requested labels are supported; done means providing a reproducible answer or a clearly scoped C3 change, with the relevant code and tests identified after locating the chart implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.