1
votes

Guys this is the problem: I have a timeseries stacked bar chart written with c3js, and it works really nice. but I still need to create a stacked bar chart with the same data BUT as a category chart...

my Json looks like this:

{"product":"acucar5kg","bundle":0,"units":5342,"production":26710,"label":"acuuki 5kg","line":"Empacotamento 1","date":"2017-10-02"}

and my original chart is like this:

  • x-axis: date
  • y-axis: production
  • groups: label

my objective is to have

  • x-axis: line
  • y-axis: production
  • groups: label

to make it simple my original code is over here: code on jsfiddle and cheating real quick for anyone to understand what i really want... here is the mockup new chart

Save me plz !! =*

p.s. feel free to smite and bash my code... i`m not a good JS dev... yet! Thanks!

1

1 Answers

2
votes

Well, took me some time but here is a fiddle what do you need. To works I did:

Change the line in return d.line; for the nestedData object and the obj.line = entry.key; for the formatedData object. Also make changes to the properties x: 'line', and the type type: 'category' in the generate method.

Check and tell me if that works for you.