highcharts tooltip programatically set always visible tooltip on latest point

Solutions on MaxInterview for highcharts tooltip programatically set always visible tooltip on latest point by the best coders in the world

showing results for - "highcharts tooltip programatically set always visible tooltip on latest point"
Iker
11 Jul 2019
1// Highcharts ==> Making always visible tooltip pointing to latest values
2// add this to load : functions settings
3chart_one.tooltip.refresh(chart_one.series[0].points[19]);
4
5// Highcharts ==> following is the sample which shows where to add the changes
6
7chart: {
8            type: 'spline',
9            backgroundColor: {
10                linearGradient: [0, 0, 500, 500],
11                stops: [
12                    [0, 'rgb(255, 255, 255)'],
13                    [1, 'rgb(200, 200, 255)']
14                ]
15            },
16            animation: Highcharts.svg, // don't animate in old IE
17            marginRight: 10,
18            
19            events: {
20                load: function () {
21
22                    // set up the updating of the chart each second
23                    var series = this.series[0];
24                    setInterval(function () {
25                        var x = (new Date()).getTime(), // current time
26                            y = a;
27                        series.addPoint([x, y], true, true);
28
29                        //for always on display value in tootip
30                      	// points[0] shows which point in the chart to show in tooltip
31                        chart_one.tooltip.refresh(chart_one.series[0].points[0]);
32                        //console.log("this chart "+ chart_one.series[0].points[0]);
33                    }, 3000);
34                }
35            }
36            
37        }