chart with motion
by Geo George
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="https://rawgit.com/larsac07/Motion-Highcharts-Plugin/master/motion.js"></script>
<div id="container"></div>
CSS
@import "http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css";
JavaScript
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
motion: {
enabled: true,
axisLabel: 'year',
labels: [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010],
series: [0,1], // The series which holds points to update
updateInterval: 20,
autoPlay : true,
playIcon: "fa fa-play",
pauseIcon: "fa fa-pause",
magnet: {
round: 'floor', // ceil / floor / round
step: 0.02
}
},
series: [{
name: 'Jane',
data: [
{
sequence: [1, 5, 2, 7, 7, 1, 6, 9, 2, 5, 1100]
}, {
sequence: [5, 5, 7, 7, 3, 8, 9, 9, 1, 7, 3]
}, {
sequence: [7, 1, 9, 3, 7, 4, 3, 8, 7, 1, 4]
}
]
}, {
name: 'John',
data: [
{
sequence: [7, 1, 9, 3, 7, 4, 3, 8, 7, 1, 4]
}, {
sequence: [1, 5, 2, 7, 7, 1, 6, 9, 2, 5, 1]
}, {
sequence: [9, 1, 7, 3, 3, 2, 1, 4, 5, 6, 7]
}
]
}]
});