harryg
harryg

Reputation: 24077

Set line opacity in highchart line chart

I know you can set the opacity of a series line in highcharts by using a rgba colour value as a property for the series line colour (like in this fiddle) (color: 'rgba(0, 0, 255, 0.5)'), but is there a way to just set the opacity without affecting the colour used?

I want my chart to sick to using the global colours array and the number of series in my chart is variable.

Upvotes: 2

Views: 5298

Answers (1)

hagbard
hagbard

Reputation: 695

To reiterate:
You could access the global colors array (Highcharts.getOptions().colors), retrieve the color from there and covnert into the rgba form while adding the 'a'.

For example:

var color = Highcharts.getOptions().colors[0];
var rgba = new Highcharts.Color(color).setOpacity(0.66).get();

Well, or split '#RRGGBB' yourself and put it back together.

Upvotes: 3

Related Questions