Merge pull request #591 from danvk/container
[dygraphs.git] / gallery / annotations-native.js
1 /*global Gallery,Dygraph,data */
2 Gallery.register(
3 'annotations-native',
4 {
5 name: 'Annotations with Native format',
6 setup: function(parent) {
7 parent.innerHTML =
8 "<p>This test demonstrates how annotations can be used with " +
9 "<a href='http://dygraphs.com/data.html#array'>native-format</a> data.</p>" +
10 "<div id='demodiv'></div>";
11 },
12 run: function() {
13 var g = new Dygraph(
14 document.getElementById("demodiv"),
15 [
16 [ new Date("2011/11/01"), 100 ],
17 [ new Date("2011/11/02"), 200 ],
18 [ new Date("2011/11/03"), 300 ],
19 [ new Date("2011/11/04"), 100 ],
20 [ new Date("2011/11/05"), 200 ],
21 [ new Date("2011/11/06"), 300 ],
22 [ new Date("2011/11/07"), 200 ],
23 [ new Date("2011/11/08"), 100 ]
24 ],
25 {
26 labels: [ 'Date', 'Value' ]
27 }
28 );
29
30 g.setAnnotations([{
31 series: 'Value',
32 x: Date.parse('2011/11/04'),
33 shortText: 'M',
34 text: 'Marker'
35 }]);
36 }
37 });