javascript - Highcharts - show only selected points -
i want have line shows points selected (they pre-selected).
in example - http://jsfiddle.net/jhg8j/ - can show selected points when click button, can work if other points shown (marker:enabled). there way start off plain line, , show selected points?
here relevant code jsfiddle:
$(function () { $('#container').highcharts({ plotoptions: { line: { marker: { enabled: true } } }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); // button handler var chart = $('#container').highcharts(), = 0; $('#button').click(function() { if (i == chart.series[0].data.length) { = 0; } chart.series[0].data[i].select(true, true); i++; });
});
you can away creating 2 separate series. in order align series 1 line chart, you'd need add few nulls data, , ensure last data point of first series first data point of following series.
using jsfiddle provided, updated code below:
$(function () { $('#container').highcharts({ plotoptions: { line: { } }, series: [{ data: [29.9, 71.5, 106.4] , marker: { enabled: true } , color: '#000000' },{ data: [null, null , 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] , marker: { enabled: false , states: { hover: { enabled: false } , states: { select: false } } }, color: '#000000' }] }); // button handler var chart = $('#container').highcharts(), = 0; $('#button').click(function() { if (i == chart.series[0].data.length) { = 0; } chart.series[0].data[i].select(true, true); i++; }); });
Comments
Post a Comment