1 // Copyright (c) 2012 Google, Inc.
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * @fileoverview Source samples.
24 * @author konigsberg@google.com (Robert Konigsberg)
32 id
: "interestingShapes",
33 title
: "Interesting Shapes",
35 var zp
= function(x
) { if (x
< 10) return "0"+x
; else return x
; };
36 var r
= "date,parabola,line,another line,sine wave\n";
37 for (var i
=1; i
<=31; i
++) {
38 r
+= "201110" + zp(i
);
39 r
+= "," + 10*(i
*(31-i
));
41 r
+= "," + 10*(250 - 8*i
);
42 r
+= "," + 10*(125 + 125 * Math
.sin(0.3*i
));
54 labelsSeparateLines
: true,
59 title
: 'Interesting Shapes',
62 axisLineColor
: 'white',
65 // This indentation is intentional; do not fix.
66 pointClickCallback
: function() {
76 [ new Date("2009/12/01"), 10, 10, 10],
77 [ new Date("2009/12/02"), 15, 11, 12],
78 [ new Date("2009/12/03"), null, null, 12],
79 [ new Date("2009/12/04"), 20, 14, null],
80 [ new Date("2009/12/05"), 15, null, 17],
81 [ new Date("2009/12/06"), 18, null, null],
82 [ new Date("2009/12/07"), 12, 14, null]
85 labels
: ["Date", "Series1", "Series2", "Series3"]
98 var xmax
= 2.0 * Math
.PI
;
100 var delta
= (xmax
- xmin
) / (numPoints
- 1);
102 for (var i
= 0; i
< numPoints
; ++i
) {
103 var x
= xmin
+ delta
* i
;
105 for (var j
= 0; j
< numSeries
; j
++) {
106 var y
= Math
.pow(Math
.random() - Math
.random(), 7);
114 labelsSeparateLines
: true,
117 title
: 'Many Points',
118 axisLineColor
: 'white',
144 title
: "Per Series Options",
146 var zp
= function(x
) { if (x
< 10) return "0"+x
; else return x
; };
147 var r
= "date,parabola,line,another line,sine wave,sine wave2\n";
148 for (var i
=1; i
<=31; i
++) {
149 r
+= "200610" + zp(i
);
150 r
+= "," + 10*(i
*(31-i
));
152 r
+= "," + 10*(250 - 8*i
);
153 r
+= "," + 10*(125 + 125 * Math
.sin(0.3*i
));
154 r
+= "," + 10*(125 + 125 * Math
.sin(0.3*i
+Math
.PI
));
166 highlightCircleSize
: 6
175 highlightCircleSize
: 10
178 strokePattern
: [10, 2, 5, 2],
180 highlightCircleSize
: 3
187 Samples
.indexOf
= function(id
) {
188 for (var idx
in Samples
.data
) {
189 if (Samples
.data
[idx
].id
== id
) {