Nick
Nick

Reputation: 14283

D3 charts - Combine multiple charts togheter

First of all, I don't have any code yet, as I'd like to understand if what i'm trying to do it's actually possible or not before even try to code it.

Basically, I'm developing an angularjs application, and I need to display some data into charts.

I say charts, because the data is different and I need to display my data using different chart types (bars, lines, area)

So, my idea was to create a directive structured like this:

<my-chart>
 <line-chart data="[data]" ...></line-chart>
 <line-chart data="[data]" ...></line-chart>
 <bar-chart data="[data]" ...></bar-chart>
 <area-chart data="[data]" ...></area-chart>
</my-chart>

all the child directives will require the parent directive in order to work.

With this method, I should be able to easily show/hide specific chart based on user selection, but honestly, since I've never developed anything with D3, but i'm learning it now, I don't know if this is even possible or not, or if there's already something that allows my to achieve something like above.

Thanks for any help and sorry if the question is not purely code-related.

Upvotes: 1

Views: 1054

Answers (1)

Cyril Cherian
Cyril Cherian

Reputation: 32327

There is already an angular library which does something similar to what you want to achieve.

Demo here

Upvotes: 1

Related Questions