score:2

it works slow, because you are using highcharts, where displaying 2000 points isn't the best idea. i suggest to use highstock instead, where points are grouped to display average/sum/etc. of points group.

however, here you are demo

and code: http://jsfiddle.net/me5uf/2/

    $('#container').highcharts({
        xaxis: {
            type: 'datetime'
        },
        plotoptions: {
            series: {
                marker: {
                    enabled: false
                },
                datalabels: {
                    enabled: true,
                    formatter: function () {
                        if (this.point.options.showlabel) {
                            return this.y;
                        }
                        return null;
                    }
                }
            }
        },
        series: [{
            name: 'aapl',
            data: data,
            tooltip: {
                valuedecimals: 2
            }
        }]
    }, callback);
});

function callback(chart) {
    var series = chart.series[0],
        points = series.points,
        plen = points.length,
        i = 0,
        lastindex = plen - 1,
        minindex = series.processedydata.indexof(series.datamin),
        maxindex = series.processedydata.indexof(series.datamax);

    points[minindex].options.showlabel = true;
    points[maxindex].options.showlabel = true;
    points[lastindex].options.showlabel = true;
    series.isdirty = true;
    chart.redraw();
}

Related Query