JSFiddle - React, Tailwind, and code Playground
by sbochan
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
plotOptions: {
series: {
point: {
events: {
mouseOver: function () {
var chart = this.series.chart;
var x = this.x,
y = this.y;
if (chart.xAxis[0].plotLinesAndBands.length > 0) {
chart.xAxis[0].update({
plotLines: [{
id: 'xPlotLine',
value: x,
width: 1,
color: '#C0C0C0'
}]
});
chart.yAxis[0].update({
plotLines: [{
id: 'yPlotLine',
value: y,
width: 1,
color: '#C0C0C0'
}]
...