Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Series markers disable on lines and enable on legend in Highchart

Tags:

highcharts

I have a line chart in Highchart with more than 10 series. When the chart is plotted for more that 2 months data with series marker enabled, the chart looks congested and makes no sense so I disabled series markers. When series marker is disabled, the markers in the legends also disappeared. What I want is to disable the markers only in the series and enable markers in legends. How can I achieve this? Can anybody please help me this?

Thanks, Rocky.

like image 821
rongok Avatar asked Sep 19 '13 08:09

rongok


People also ask

How do I turn off legend Highcharts?

Enable or disable the legend. There is also a series-specific option, showInLegend, that can hide the series from the legend. In some series types this is false by default, so it must set to true in order to show the legend for the series.

What is marker in Highcharts?

Options for the point markers of line-like series. Properties like fillColor , lineColor and lineWidth define the visual appearance of the markers. Other series types, like column series, don't have markers, but have visual options on the series level instead.

What is point in Highcharts?

The point objects are generated from the series. data configuration objects or raw numbers. They can be accessed from the Series. points array. Other ways to instantiate points are through Highcharts.


1 Answers

You have two options:

  • enable marker for whole series, but disable for each point
  • use two series, one for data, one for legend and link them together by ID

Example:

var chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container'
    },
    plotOptions: {
        series: { 
            marker: {
                enabled: false
            }
        }
    },
    series: [{
        data: [],
        name: 'test',
        id: 'id-1',
        color: 'red',
        marker: {
            enabled: true
        }
    }, {
        linkedTo: 'id-1',
        color: 'red',
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]        
    }]
});
like image 167
Paweł Fus Avatar answered Sep 19 '22 14:09

Paweł Fus