JSFiddle - React, Tailwind, and code Playground

by ian_smithz

HTML

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<button id="b">set data</button>
<div id="chart" style="width: 400px; height: 300px; margin: 0 auto"></div>

JavaScript

$(function () {

    $("#chart").highcharts('StockChart', {
        
        series: [{
            marker: {
                enabled: true
            },
            data: [{
                x: 5,
                y: 10,
                selected: false
            }, {
                x: 7,
                y: 16,
                selected: false
            }, {
                x: 12,
                y: 16,
                selected: true
            }]
        }]
    });


    $("#b").click(function () {
        var points = [{
            x: 5,
            y: 10,
            selected: true
        }, {
            x: 7,
            y: 16,
            selected: true
        }, {
            x: 12,
            y: 16,
            selected: false
        }];

        $("#chart").highcharts().series[0].setData(points, true, false, false);
    });
});