Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use CSS Class in HighCharts

Tags:

highcharts

Instead of specifying CSS styles with highchart options such as (fontWeight, fontColor, etc), is it possible to use CSS classes for styling the different elements of a chart?

like image 457
user2041354 Avatar asked Feb 04 '13 23:02

user2041354


2 Answers

In many cases (tooltip,labels) you can set useHTML as true, and then use CSS styles without !important or use formatter to define your own elements with CSS styles.

Example http://api.highcharts.com/highcharts#tooltip.useHTML

like image 104
Sebastian Bochan Avatar answered Jan 01 '23 15:01

Sebastian Bochan


Yes, you have to use !Important because it's the only way to override inline style.
Your chart is render on some content which you have to pass it's id on chart.rendertTooption.
So you can match the elements by your chart container, like.

#container text {
    font-size: 14px !Important;
}

Demo

like image 21
Ricardo Alvaro Lohmann Avatar answered Jan 01 '23 14:01

Ricardo Alvaro Lohmann