0

My data looks like this

var data = [
{'date':'1/1/17', 'cars':2.0, 'trucks':3.0, 'suvs':4.0, 'bikes':0,'skates':0}
{'date':'2/1/17', 'cars':4.0, 'trucks':7.0, 'suvs':4.0, 'bikes':1.0,'skates':0.0}
{'date':'3/1/17', 'cars':0.0, 'trucks':3.0, 'suvs':5.0, 'bikes':0.0,'skates':4.0}

I'm trying to plot this in a bar chart using dc or d3, with my x axis being vehicle (bike, truck,skates) and my y axis being the count.

Is there a smart way to do this?

This link is what I'm basing my project dc example but I think their data formatted differently (i.e.)

var data = [
{'name':'apple', 'count':2.0},
{'name':'bannana', 'count':4.0},...]

So I don't know if this is even possible

Gordon
  • 19,811
  • 4
  • 36
  • 74
user3007270
  • 406
  • 4
  • 15
  • why would you do something like `d.truck=d.truck`? what's the intention behind it? – elias Feb 23 '17 at 21:45
  • Isn't this how you define it? I want to have d.truck accessible for plotting – user3007270 Feb 23 '17 at 22:41
  • I'm not sure I get it right, but for me it seems, that d.truck has the defined value even before the assignment. – elias Feb 23 '17 at 22:42
  • You are correct.. hmm I believe I need to figure out how to extract the key value to use it for the x-axis. d.truck would be a number – user3007270 Feb 23 '17 at 23:58
  • Please use the dc.js tag for questions about the charting library - dc is quite something else. – Gordon Mar 19 '17 at 01:17

0 Answers0