Highcharts: setting stroke-width on a line series when styledMode is on has no effect

Viewed 225

I'm trying to set a specific line width on a line series, in a chart which has styledMode switched on. (Styled mode is necessary for us, to eliminate in-line styles which are causing Content-Security-Policy errors.)

I find that the stroke color from my style is correctly applied to the line, but the stroke-width setting is ignored, even if I mark it as !important.

Jsfiddle: http://jsfiddle.net/tsjLg95w/

You can edit the stroke value to prove that the style is being applied.

1 Answers

The stroke is actually applied on a child path with the highcharts-graph class, which has a default stroke-width of 2px. Overriding the stroke-width on that class instead works (so your selector is .series0Line .highcharts-graph):

.series0Line .highcharts-graph {
  stroke-width: 30px;
  stroke: red;
}

JSFiddle: http://jsfiddle.net/7z8jx1y3/

Related