Created
February 13, 2011 03:12
-
-
Save aviflax/824394 to your computer and use it in GitHub Desktop.
Illustrates a problem I'm having with dygraph annotations
This file contains 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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Annotation Test</title> | |
<meta name="author" content="Avi Flax"> | |
<script src="dygraph-combined.js"></script> | |
<script> | |
window.onload = function(){ | |
var data = [ | |
[new Date(Date.parse('2011-02-12T19:00:00Z')), 400, 200], | |
[new Date(Date.parse('2011-02-12T20:00:00Z')), 408, 204], | |
[new Date(Date.parse('2011-02-12T21:00:00Z')), 413, 206], | |
[new Date(Date.parse('2011-02-12T22:00:00Z')), 444, 208], | |
[new Date(Date.parse('2011-02-12T23:00:00Z')), 456, 212], | |
[new Date(Date.parse('2011-02-13T00:00:00Z')), 476, 215], | |
[new Date(Date.parse('2011-02-13T01:00:00Z')), 479, 218], | |
[new Date(Date.parse('2011-02-13T02:00:00Z')), 521, 224] | |
]; | |
var graph = new Dygraph( | |
document.getElementById("graph"), | |
data, | |
{ | |
strokeWidth: 4.0, | |
width: 720, | |
height: 420, | |
axisLabelFontSize: 16, | |
highlightCircleSize: 5, | |
labels: ["Date", "Subscribers", "Publishers"] | |
} | |
); | |
console.log(data[data.length-1][0].valueOf()); | |
graph.setAnnotations([ | |
{ | |
series: "Subscribers", | |
x: data[data.length-1][0].valueOf(), | |
shortText: data[data.length-1][1] + " S", | |
text: "Subscribers" | |
} | |
]); | |
}; | |
</script> | |
</head> | |
<body> | |
<div id="graph"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment