JSFiddle - React, Tailwind, and code Playground
by JoeKuan
HTML
<script src="http://code.highcharts.com/highcharts.src.js">
</script><script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="http://joekuan.org/Learning_Highcharts/Chapter_15/highcharts-regression.js"> </script>
<script src="http://rawgithub.com/highslide-software/draggable-points/master/draggable-points.js"></script>
<body>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'scatter',
},
title: {
text: 'Height Versus Weight of Individuals by Gender'
},
subtitle: {
text: 'Drag any data point to see the regression line move'
},
xAxis: {
title: {
enabled: true,
text: 'Height (cm)'
},
startOnTick: true,
endOnTick: true,
showLastLabel: true
},
yAxis: {
title: {
text: 'Weight (kg)'
}
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 100,
y: 70,
floating: true,
backgroundColor: '#FFFFFF',
borderWidth: 1
},
plotOptions: {
line: {
tooltip: {
valueDecimals: 2
}
},
scatter: {
marker: {
radius: 5,
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
tooltip:{
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x} cm, {point.y} kg',
valueDecimals: 2
}
},
series: {
point: {
events: {
drag: function(e) {
Highcharts.charts[0].regression(e.target);
}
}
}
}
},
...