0

I have the following implementation:

http://jsfiddle.net/c1dfuj1s/3/

I have two catgeories : 1970 and 1975.

My question is that even though I am adding a data to 1975, but it adds to 1970.

{
   "series": "item6",
   "category": "1975",
   "value": 105
 },

enter image description here

mystackoverflow
  • 357
  • 1
  • 4
  • 10

1 Answers1

1

Not sure exactly why this happens, but you can solve it by adding a zero value item 6 to 1970:

 {
    "series": "item6",
    "category": "1970",
    "value": 0
},  
    {
    "series": "item6",
    "category": "1975",
    "value": 105
},

Updated FIDDLE

ezanker
  • 24,628
  • 1
  • 20
  • 35
  • What if I have totally different two sets of javascript objects? Should I append all zeros? In other words, there are no common objects in two series,i.e, no way to group them, what do you recommend? – mystackoverflow May 29 '15 at 20:03
  • @mystackoverflow if they are truly unrelated, why are you putting them on the same chart? Charts are generally for comparing related data... You could just create 2 charts and have them side-by-side. – ezanker May 29 '15 at 20:17
  • I mean let's assume only 2 common objects out of 10. How could u handle? The purpose is to show on the bar chart just because of showing these two common objects positions. – mystackoverflow May 29 '15 at 20:29
  • @mystackoverflow, I think appending zero values so all items exist over all categories is the way to go. – ezanker May 29 '15 at 21:24
  • Here is my actual question http://stackoverflow.com/questions/30539507/plot-bar-stack-category-column – mystackoverflow May 29 '15 at 21:41