Commit | Line | Data |
---|---|---|
773d1312 RK |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | <head> | |
4 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9"> | |
5 | <title>Per-Series Properties</title> | |
6 | <!--[if IE]> | |
7 | <script type="text/javascript" src="../excanvas.js"></script> | |
8 | <![endif]--> | |
9 | <!-- | |
10 | For production (minified) code, use: | |
11 | <script type="text/javascript" src="dygraph-combined.js"></script> | |
12 | --> | |
13 | <script type="text/javascript" src="../dygraph-dev.js"></script> | |
14 | ||
15 | </head> | |
16 | <body> | |
17 | <h2>Chart with per-series properties</h2> | |
18 | <div id="demodiv"></div> | |
19 | ||
20 | <script type="text/javascript"> | |
21 | ||
22 | g = new Dygraph( | |
23 | document.getElementById("demodiv"), | |
24 | function() { | |
25 | ||
26 | var r = "x,default,triangle,square,diamond,pentagon,hexagon,circle,star,custom\n"; | |
27 | for (var i=1; i<=20; i++) { | |
28 | r += i; | |
29 | for (var j = 0; j < 9; j++) { | |
30 | r += "," + j + (i / 20); | |
31 | } | |
32 | r += "\n"; | |
33 | } | |
34 | return r; | |
35 | }, | |
36 | { | |
37 | drawPoints : true, | |
38 | pointSize : 5, | |
39 | 'default' : { drawPointCallback : Dygraph.Circles.DEFAULT }, | |
40 | 'triangle' : { drawPointCallback : Dygraph.Circles.TRIANGLE }, | |
41 | 'square' : { drawPointCallback : Dygraph.Circles.SQUARE }, | |
42 | 'diamond' : { drawPointCallback : Dygraph.Circles.DIAMOND }, | |
43 | 'pentagon' : { drawPointCallback : Dygraph.Circles.PENTAGON }, | |
44 | 'hexagon' : { drawPointCallback : Dygraph.Circles.HEXAGON }, | |
45 | 'circle' : { drawPointCallback : Dygraph.Circles.CIRCLE }, | |
46 | 'star' : { drawPointCallback : Dygraph.Circles.STAR }, | |
47 | 'custom' : { drawPointCallback : function(g, series, ctx, cx, cy, color, radius) { | |
48 | ctx.fillStyle = "#FFFF00"; | |
49 | ctx.beginPath(); | |
50 | ctx.arc(cx, cy, radius, Math.PI*2, false); | |
51 | ctx.closePath(); | |
52 | ctx.stroke(); | |
53 | ctx.fill(); | |
54 | ||
55 | ctx.fillStyle = "#000000"; | |
56 | ctx.beginPath(); | |
57 | ctx.arc(cx - (radius / 3) , cy - (radius / 4), 1, Math.PI*2, false); | |
58 | ctx.closePath(); | |
59 | ctx.stroke(); | |
60 | ctx.fill(); | |
61 | ||
62 | ctx.fillStyle = "#000000"; | |
63 | ctx.beginPath(); | |
64 | ctx.arc(cx + (radius / 3) , cy - (radius / 4), 1, Math.PI*2, false); | |
65 | ctx.closePath(); | |
66 | ctx.stroke(); | |
67 | ctx.fill(); | |
68 | ||
69 | ctx.fillStyle = "#000000"; | |
70 | ctx.beginPath(); | |
71 | ctx.arc(cx, cy, radius - 2, .3, Math.PI - .3, false); | |
72 | ctx.stroke(); | |
73 | } | |
74 | } } | |
75 | ); | |
76 | </script> | |
77 | </body> | |
78 | </html> |