Highcharts Demo

author(s): Torstein Hønsi

by John Dow

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/boost.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="height: 400px; max-width: 800px; margin: 0 auto"></div>

JavaScript

function getData(n) {
    var arr = [],
        i,
        a,
        b,
        c,
        spike;
    for (i = 0; i < n; i = i + 1) {
        if (i % 100 === 0) {
            a = 2 * Math.random();
        }
        if (i % 1000 === 0) {
            b = 2 * Math.random();
        }
        if (i % 10000 === 0) {
            c = 2 * Math.random();
        }
        if (i % 50000 === 0) {
            spike = 10;
        } else {
            spike = 0;
        }
        arr.push(
            2 * Math.sin(i / 100) + a + b + c + spike + Math.random()
        );
    }
    return arr;
}
var n = 10000,
    data = getData(n);
var zoomed = false;
function mouseOverHarm(point) {

}
var mousePoint;
var hovering = true;
var container = document.getElementById("container");

console.time('line');
var chart;
function createChart() {
chart = new Highcharts.chart('container', {

    chart: {
			animation: false,
        zoomType: 'x',
        panning: true,
        panKey: 'shift'
    },
			exporting: {
				enabled: false,
			},
		xaxis: {
			zoomEnabled: true,
			crosshair: true,
			min: 0,
			max: n, 
				events: {
					afterSetExtremes() {
						if (this.displayBtn) {
							zoomed = true;
						} else {
							zoomed = false;
						}
					},
				},
				//tickInterval: xTickInt,
				type: 'linear',
				allowDecimals: false,
				title: {
					text: "xTitle",
					style: {
						fontSize: "14px",
						fontWeight: 'bold',
					},
				},
				labels: {
					fontSize: "12px",
				},
		},

    boost: {
        useGPUTranslations: true
    },

    title: {
        text: 'Highcharts drawing ' + n + ' points'
    },

    subtitle: {
        text: 'Using the Boost module'
    },
		yAxis: {
				title: {
					text: "Unit",
					style: {
						fontSize: "14px",
						fontWeight: 'bold',
					},
				},
				events: {
					afterSetExtremes() {
					},
				},
				type: "linear",
				min: -10,
				max: 20,
				minPadding: 0,
				maxPadding: 0,
				startOnTick: false,
				endOnTick:...