projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #678 from danvk/dygraphs-css
[dygraphs.git]
/
tests
/
annotation.html
diff --git
a/tests/annotation.html
b/tests/annotation.html
index
0e25fb7
..
4cdcb10
100644
(file)
--- a/
tests/annotation.html
+++ b/
tests/annotation.html
@@
-1,11
+1,8
@@
<!DOCTYPE html>
<html>
<head>
<!DOCTYPE html>
<html>
<head>
- <
meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9
">
+ <
link rel="stylesheet" href="../css/dygraph.css
">
<title>demo</title>
<title>demo</title>
- <!--[if IE]>
- <script type="text/javascript" src="../excanvas.js"></script>
- <![endif]-->
<!--
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
<!--
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
@@
-13,7
+10,7
@@
For production (minified) code, use:
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
For production (minified) code, use:
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
- <script type="text/javascript" src="../d
ygraph-dev
.js"></script>
+ <script type="text/javascript" src="../d
ist/dygraph
.js"></script>
<style type="text/css">
.annotation {
<style type="text/css">
.annotation {
@@
-35,6
+32,9
@@
return "(" + ann.series + ", " + ann.x + ")";
}
return "(" + ann.series + ", " + ann.x + ")";
}
+ annotations = [];
+ var graph_initialized = false;
+
g = new Dygraph(
document.getElementById("g_div"),
function() {
g = new Dygraph(
document.getElementById("g_div"),
function() {
@@
-55,7
+55,14
@@
showRoller: true,
width: 480,
height: 320,
showRoller: true,
width: 480,
height: 320,
- drawCallback: function(g) {
+ drawCallback: function(g, is_initial) {
+ if (is_initial) {
+ graph_initialized = true;
+ if (annotations.length > 0) {
+ g.setAnnotations(annotations);
+ }
+ }
+
var ann = g.annotations();
var html = "";
for (var i = 0; i < ann.length; i++) {
var ann = g.annotations();
var html = "";
for (var i = 0; i < ann.length; i++) {
@@
-70,7
+77,6
@@
);
var last_ann = 0;
);
var last_ann = 0;
- annotations = [];
for (var x = 10; x < 15; x += 2) {
annotations.push( {
series: 'sine wave',
for (var x = 10; x < 15; x += 2) {
annotations.push( {
series: 'sine wave',
@@
-99,7
+105,10
@@
shortText: 'P',
text: 'Parabola Annotation at same x-coord'
} );
shortText: 'P',
text: 'Parabola Annotation at same x-coord'
} );
- g.setAnnotations(annotations);
+
+ if (graph_initialized) {
+ g.setAnnotations(annotations);
+ }
function add() {
var x = last_ann + 2;
function add() {
var x = last_ann + 2;