JSFiddle - React, Tailwind, and code Playground
by xmlilley
HTML
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 500px; min-width: 600px"></div>
JavaScript
$(function() {
var seriesOptions = [],
yAxisOptions = [],
seriesCounter = 0,
names = ['MSFT', 'AAPL', 'GOOG'],
colors = ['gray', 'orange', 'black'],
dashStyles = ['ShortDash','solid', "shortdot"];
$.each(names, function(i, name) {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename='+ name.toLowerCase() +'-c.json&callback=?', function(data) {
seriesOptions[i] = {
name: name,
data: data,
id: name,
color: colors[i],
dashStyle: dashStyles[i]
};
// As we're loading the data asynchronously, we don't know what order it will arrive. So
// we keep a counter and create the chart when all the data is loaded.
seriesCounter++;
if (seriesCounter == names.length) {
seriesOptions.push({
type : 'flags',
data : [{
x : Date.UTC(2011, 8, 25),
title : 'A',
text : 'Product 1 Launch misunderstood, then loved'
}, {
x : Date.UTC(2011, 10, 10),
title : 'B',
text : 'Product 2 savaged by Oprah'
}, {
x : Date.UTC(2011, 10, 25),
title : 'C',
text : 'Product 2 middling review by Geraldo'
}, {
x : Date.UTC(2011, 11, 16),
title : 'D',
text : 'Master Brand Campaign launches'
}, {
x : Date.UTC(2012, 2, 6),
title : 'E',
text : 'CEO Appears on Dancing With The Stars'
}, {
x : Date.UTC(2012, 4, 9),
title : 'F',
text : 'Fortune asks:"Have They Jumped The Shark?"'
}],
...