dc.js icon indicating copy to clipboard operation
dc.js copied to clipboard

Line chart- multiple lines with multiple datasets

Open TheAndre980 opened this issue 2 years ago • 2 comments

I'm currently building a angular project where i need to draw a line chart with multiple datasets.

Angular 14 dc.js 4.2.7

Example object format: { id: "string", datasets: [ id: "string", data: []; color: "string"; ] }

I followed some examples and only could made a series chart where each line is an address. where's a clean run of what i've got: https://jsfiddle.net/TheAndre98/zexncpd5/41/ *in this example the data arrays start seperated from the color string

Tried to change the dimension and tried colors with colorAcessor but nothing worked.

Is it possible to make a line chart where each line is a address and the color of the line is the from the dataset ? Meaning multiple lines with same address but diferent colors and values.

** if not, is it possible to do something similiar with a bar chart too ?

TheAndre980 avatar Oct 31 '22 14:10 TheAndre980

It is possible, however, I am traveling, and will take about a week. Start with https://dc-js.github.io/dc.js/docs/html/ColorMixin.html#ordinalColors__anchor which should take you near. If you need more flexibility you should check other functions from the same mixin.

kum-deepak avatar Oct 31 '22 16:10 kum-deepak

It is possible, however, I am traveling, and will take about a week. Start with https://dc-js.github.io/dc.js/docs/html/ColorMixin.html#ordinalColors__anchor which should take you near. If you need more flexibility you should check other functions from the same mixin.

I already tried that with no result, it changes the line colors but its not seperating from each dataset and address...

*Updated jsFiddle with Data Object Format and dc-color: https://jsfiddle.net/TheAndre98/zexncpd5/62/ ** Updated info: The dataset can have any color (not just that ones in the example). Same addresses can apear in multiple datasets at the same time. Each Line represents an address and multiple lines of the address must be drawed with the color from each dataset.

TheAndre980 avatar Oct 31 '22 17:10 TheAndre980