Created
November 13, 2013 05:14
-
-
Save rowanhogan/7444095 to your computer and use it in GitHub Desktop.
Simple Morris.js example with time range select
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [ | |
{ y: '2006', a: 100, b: 90 }, | |
{ y: '2007', a: 75, b: 65 }, | |
{ y: '2008', a: 50, b: 40 }, | |
{ y: '2009', a: 75, b: 65 }, | |
{ y: '2010', a: 50, b: 40 }, | |
{ y: '2011', a: 75, b: 65 }, | |
{ y: '2012', a: 100, b: 90 } | |
] | |
$(document).ready(function() { | |
Morris.Line({ | |
element: 'test', | |
data: data, | |
xkey: 'y', | |
ykeys: ['a', 'b'], | |
labels: ['Series A', 'Series B'], | |
rangeSelect: function(range) { | |
var start = new Date(range.start).toLocaleString(), | |
end = new Date(range.end).toLocaleString(); | |
$('#caption').text('Selected ' + start + ' to ' + end); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment