Combo chart in d3.js

2,389 views
Skip to first unread message

Loganath Thamizharasu

unread,
Mar 20, 2013, 2:37:00 AM3/20/13
to d3...@googlegroups.com
Hi, 

      I am new to D3.js and currently exploring generating grouped bar charts from json. Is there a possibility to add a line chart on top of it to give a combo chart effect like that we see in google jsapi charts. Please help me through this. 


Thanks,
Regards, 
Logs

Alex Brown

unread,
Mar 20, 2013, 3:15:58 AM3/20/13
to d3...@googlegroups.com
Yes of course there is.  You need to decide whether the line chart is going to have a different scale/axis from the bar chart, but either way you can make it work.

simply speaking you can just build two plots on top of each other in the rendering area.

Just choose which one is in front and use svg ordering / d3.selection.order to enforce that.

-Alex

Sgol

unread,
Mar 20, 2013, 6:07:17 AM3/20/13
to d3...@googlegroups.com
Hi, Thanks for your reply. It is more or like projecting one or more lines on top of grouped bar chart with the same data exists in the axis. Can you provide me more sense to it. Any links or sources that is suffice for reference. 

Thanks. 

Alex Brown

unread,
Mar 20, 2013, 11:10:43 AM3/20/13
to d3...@googlegroups.com
This is just the simple combination of a bar chart and a line chart.

There are a few steps to achieving this, I'm not sure where you are stuck; 

* calculation of the average
* plotting a grouped bar 
* plotting a line
* combining them

let me know.

-Alex

Patrick Martin

unread,
Mar 23, 2013, 10:06:31 PM3/23/13
to d3...@googlegroups.com
I've been working on ways to make D3 and other technologies easier to combine and interoperate. Check out:

http://dexvis.wordpress.com/2013/03/23/reusable-charting-patterns-part-3/

- Pat

Reply all
Reply to author
Forward
0 new messages