ElementStacks
HTML
<script src="http://highcharts.com/js/testing-exporting.js"></script>
<div id="container" style="height: 200px; margin-top: 1em"></div>
JavaScript
var chart;
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',
marginRight: 130,
marginBottom: 25
},
credits: {
enabled: false
},
title: {
text: 'Bits',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
type: 'datetime',
tickInterval: 3600 * 1000,
// one hour
tickWidth: 0,
gridLineWidth: 1,
labels: {
align: 'center',
x: -3,
y: 20,
formatter: function() {
return Highcharts.dateFormat('%Y%m%d%H%M%S', this.value);
}
}
},
yAxis: {
title: {
text: 'Bits'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'}]
},
tooltip: {
formatter: function() {
return Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x - (1000 * 3600)) + '-' + Highcharts.dateFormat('%l%p', this.x) + ': <b>' + this.y + '</b>';
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'BlaBla'}]
};
// Load data asynchronously using jQuery. On success, add the data
// to the options and initiate the chart.
// This data is obtained by exporting a GA custom report to TSV.
// http://api.jquery.com/jQuery.get/
tsv = "2012-03-05 20:53:32\t245891\n2012-03-05 20:53:33\t8530\n2012-03-05 20:53:34\t6424577";
var lines = [];
traffic = [];
try {
// split the data return into lines and...