Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding a Highcharts series without using the legend

I need to be able to hide a Highcharts series from a button rather than the legend (the reason is that I need to toggle multiple groups from one button: Hiding _groups_ of series in Highcharts and jQuery: how to get acceptable performance? and for the reasons given in that post, I cannot use $(chart.series).each() with jQuery.

None of the following expressions have any effect (my chart object is named chart):

Chart.series.get(1).hide(); chart.series.get(1).hide(); $(chart.series[1]).hide(); $(chart.series["1"]).hide(); $(chart.series[1]).hide(); $(chart.series)["1"].hide(); $(chart.series)[1].hide(); 

Can someone please tell me how I can make a chart series hide if I know its index? Thanks.

like image 893
bokov Avatar asked Jan 16 '12 13:01

bokov


People also ask

How do I hide the Highchart watermark?

Highchart by default puts a credits label in the lower right corner of the chart. This can be removed using credits option in your chart settings. will remove the highcharts.com logo.

How do I disable Highcharts credits?

credits: { enabled: false }, that will remove the "Highcharts.com" text from the bottom of the chart. @philfreo 'Credits: false' could produce a undefined error if highcharts didn't do proper checking.

Is it possible to pass multiple series in a chart in Highcharts?

Yes, you can. You could add more. If you get stack with implementing your project, please send us a minimal, verifiable demo in JSFiddle, so we could help you out with your code.

How do I change the legend position in Highcharts?

Set legend's layout, align and verticalAlign options as follows: legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', itemMarginTop: 10, itemMarginBottom: 10 }, By itemMarginTop/Bottom you can control the padding between the legend items.


1 Answers

This should work:

chart.series[index].hide()

Full example on jsfiddle

(UDP URL from Simen Echholt comment)

like image 109
eolsson Avatar answered Oct 08 '22 12:10

eolsson