JSFiddle - React, Tailwind, and code Playground
by J. Albert Bowden
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
var data = {"09/02/2014 15:36:25":[33.82,33.42,40.83],
"08/11/2014 16:25:15":[36.6,33.42,40.45],
"07/30/2014 08:43:57":[0.0,0.0,0.0],
"08/12/2014 22:00:52":[77.99,74.1,80.12],
"08/12/2014 21:19:48":[56.91,63.23,52.42],
"07/23/2014 13:37:46":[0.0,0.0,0.0],
"08/11/2014 17:35:21":[40.9,43.83,38.34]}
var xAxis = Object.keys(data); //this will return dates
$(function () {
$('#container').highcharts({
title: {
text: 'Title',
x: -20 //center
},
subtitle: {
text: 'SubTitle',
x: -20
},
yAxis: {
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
});
});
alert(data[xAxis[0]]); //this gives the values of each date
alert(xAxis);
var chart = $("#container").highcharts();
for(var i=0; i<xAxis.length; i++) {
chart.addSeries({
name: xAxis[i],
data: data[xAxis[i]]
});
}