MartinSchneider
Posts: 7
Joined: Thu Apr 14, 2011 8:07 am

Categories + Individual Styles + Linebreaks

Hi,
I have trouble creating a graph where individual xAxis-categories are styled differently than the others.
Since using the xAxis->labels->style-property is of no use (it will style *all* categories and not just the
ones that I want) i tried inserting html and css into the category-strings itself
like this:

Code: Select all

categories: ["<b>CustomStyledCategory</b>", "NormalCategory"]
Now I run into the problem that if the Category-name is too long and a linebreak is inserted by Highcharts,
the part of the Category-name *after* the break is not styled anymore.

Here is an example:
http://jsfiddle.net/docsnyder/Ad33w/

The first Category "January Foo Bar" should be all in red color, instead only the part before the linebreak is styled.

Is there a fix for it? Am I doing it completely wrong? What is another possible solution for creating individually
styled category labels?

bye
Martin
eolsson
Posts: 396
Joined: Tue May 03, 2011 11:07 am

Re: Categories + Individual Styles + Linebreaks

You can avoid the line break if you set the width style on x-axis labels. Like so: http://jsfiddle.net/Ad33w/3/

And yes, it seems to be a bug that the second line is not styled anymore.
Erik Olsson
Highsoft Solutions AS
eolsson
Posts: 396
Joined: Tue May 03, 2011 11:07 am

Re: Categories + Individual Styles + Linebreaks

Erik Olsson
Highsoft Solutions AS
nsidawy
Posts: 8
Joined: Thu Feb 23, 2012 4:34 pm

Re: Categories + Individual Styles + Linebreaks

I commented on the github issue with a change to the HighCharts source code that would fix this bug.

Would love to get a HighCharts engineer to comment on it.

Return to “Highcharts Usage”