JSFiddle - React, Tailwind, and code Playground

by vigneshwaranr

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="https://rawgithub.com/vigneshwaranr/line_intersection.js/master/line_intersection.js"></script>
<div id="container" style="height: 400px"></div>

JavaScript

jQuery(function () {
    // E.g. source data
    var sourceData = [
        [106.4, 271.8],
        [129.2, 213.4],
        [295.6, 432.3],
        [154.4, 398.1],
        [129.9, 133.2],
        [271.5, 432.1],
        [144.0, 134.7],
        [176.0, 399.2],
        [216.4, 319.2],
        [194.1, 542.1],
        [435.6, 665.3],
        [348.5, 435.9]
    ];

    var chart_linear = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },
        series: [{
            type: 'scatter',
            data: sourceData
        }, {
            marker: {
                enabled: false
            },
            /* function returns data for trend-line */
            data: getTrendlineData(sourceData).data
        }]
    });
});