To provide multiple colors for a graph.

Mar 14, 2011 at 10:01 AM
Edited Apr 11, 2011 at 8:11 AM


      I have seen examples to set the graph color. But Can anyone please tell me how to set multiple color for a graph line? For example, At present my graph color is blue color and in my y axis , I am displaying some  random double values(in between 250 and -250) and x axis shows time . So In my graph curve, the graph above a certain limit (say 100) should be in red. Once the graph comes down below 100, then it should retain its old color( Blue). Is any feature exists in the D3 to support this?

Mar 14, 2011 at 11:28 AM

I think that you'd have to have a routine to filter through your Data, creating a new Datasource and Line graph for each section of the graph that exceeds your limit.

Then you can plot all the data (in one datasource) in a linegraph with a blue stroke, and then plot the sections that exceed the limit in new line graphs that have a red stroke. To do this you'll need to create the "red" line graphs dynamically....

there might be a better way to do this with markers.


Apr 11, 2011 at 8:16 AM

Hello Guys, Any help for the issue? Already my graphs runs so slow..... So not very sure, how good it is to go for new DataSource to handle the range as Mr.devoNur said. Kindly give me some hint to proceed.  I could not see any examples in sample codes or any queries regarding this in the forums. Please help...