wuz73
Posts: 16
Joined: Sun Nov 25, 2012 6:13 pm

Show different colors in one series in StockChart

I know how to show different colors in one series when enabling marker, but is it possible to show different colors without marker (i.e. color each section of a line with a different color)?
seba
Posts: 4415
Joined: Tue Jul 31, 2012 2:26 pm

Re: Show different colors in one series in StockChart

At this moment it is not possible, so you should have two series and each of them should have individual color.
Sebastian Bochan
Highcharts Developer
wuz73
Posts: 16
Joined: Sun Nov 25, 2012 6:13 pm

Re: Show different colors in one series in StockChart

The problem is that I have too many colors (the color gradient indicates the volume while the yAxis indicates the price, and I have many stocks to compare) to show.

Can I use render.path() to plot a path with different colors in different legs?
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: Show different colors in one series in StockChart

I am not sure how exactly should this work, but threshold for colors is planned for upcoming Highcharts 3.0, take a look: http://highcharts.uservoice.com/forums/ ... for-colors with example: http://jsfiddle.net/highcharts/PMyHQ/

If you really need to implement this right now I advice to check that example and according to this one implement something similar for VML. Of course you can try to use another approach with .path() but this may cause some problems for spline series.
Paweł Fus
Highcharts Developer
wuz73
Posts: 16
Joined: Sun Nov 25, 2012 6:13 pm

Re: Show different colors in one series in StockChart

Threshold coloring is different from what I need, because it only applies two different colors. What I need is something like this:

Code: Select all

function PlotSeries(data)
{
  for (i=1; i<data.length; i++)
    // draw a line from data[i-1] to data[i] with gradient indicating size
    line(data[i-1].x,data[i-1].y, data[i].x,data[i].y).rgba(255,0,0,data[i-1].size/maxSize);
}
Is this something that you will kindly consider to implement?
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: Show different colors in one series in StockChart

I advice to add this comment to this discussion: http://highcharts.uservoice.com/forums/ ... for-colors
But probably with Highcharts 3.0 it will not be implemented.
Paweł Fus
Highcharts Developer
wuz73
Posts: 16
Joined: Sun Nov 25, 2012 6:13 pm

Re: Show different colors in one series in StockChart

No, I don't think I should hijack the other discussion because it's on a different topic. Threshold is a useful feature, but it's different from my application.
seba
Posts: 4415
Joined: Tue Jul 31, 2012 2:26 pm

Re: Show different colors in one series in StockChart

So you can request your own suggestion.
Sebastian Bochan
Highcharts Developer
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: Show different colors in one series in StockChart

Paweł Fus
Highcharts Developer

Return to “Highcharts Stock”