/**
- * @fileoverview FILL THIS IN
+ * @fileoverview Tests for per-series options.
*
* @author danvk@google.com (Dan Vanderkam)
*/
-var perSeriesTestCase = TestCase("per-series");
+var Tests for per-series options.
perSeriesTestCase.prototype.setUp = function() {
document.body.innerHTML = "<div id='graph'></div>";
assertEquals([255,0,0,38], sampler.colorAtCoordinate(6.5, 0.5));
};
+perSeriesTestCase.prototype.testOldStyleSeries = function() {
+ var opts = {
+ pointSize : 5
+ Y: { pointSize : 4 },
+ };
+ var data = "X,Y,Z\n1,0,0\n";
+ g = new Dygraph("Graph", data, opts);
+
+ assertEquals(5, g.getOption("pointSize"));
+ assertEquals(4, g.getOption("pointSize", "Y"));
+ assertEquals(5, g.getOption("pointSize", "Z"));
+};
+
drawPoints : true,
pointSize : 5,
highlightCircleSize: 8,
- A : {
- drawPointCallback : Dygraph.Circles.TRIANGLE,
- drawHighlightPointCallback : Dygraph.Circles.TRIANGLE
- },
- B : {
- drawPointCallback : Dygraph.Circles.HEXAGON,
- drawHighlightPointCallback : Dygraph.Circles.HEXAGON
+ series : {
+ A : {
+ drawPointCallback : Dygraph.Circles.TRIANGLE,
+ drawHighlightPointCallback : Dygraph.Circles.TRIANGLE
+ },
+ B : {
+ drawPointCallback : Dygraph.Circles.HEXAGON,
+ drawHighlightPointCallback : Dygraph.Circles.HEXAGON
+ }
}
});
],
{
labels: ["X", "S1", "S2" ],
- S1: {
- drawGapEdgePoints: true
+ series: {
+ S1: {
+ drawGapEdgePoints: true
+ }
},
pointSize: 4,
showRoller: true
<div id="demodiv"></div>
<h2>Chart with per-series properties with legend.</h2>
<div id="demodiv2"></div>
+ <h2>First graph, using old-style series specification.</h2>
+ <div id="demodiv3"></div>
<script type="text/javascript">
data = function() {
var zp = function(x) { if (x < 10) return "0"+x; else return x; };
data,
{
strokeWidth: 2,
+ series : {
+ 'parabola': {
+ strokeWidth: 0.0,
+ drawPoints: true,
+ pointSize: 4,
+ highlightCircleSize: 6
+ },
+ 'line': {
+ strokeWidth: 1.0,
+ drawPoints: true,
+ pointSize: 1.5
+ },
+ 'sine wave': {
+ strokeWidth: 3,
+ highlightCircleSize: 10
+ },
+ 'sine wave2': {
+ strokePattern: [10, 2, 5, 2],
+ strokeWidth: 2,
+ highlightCircleSize: 3
+ }
+ }
+ }
+ );
+ g2 = new Dygraph(
+ document.getElementById("demodiv2"),
+ data,
+ {
+ legend: 'always',
+ strokeWidth: 2,
'parabola': {
- strokeWidth: 0.0,
+ strokePattern: null,
drawPoints: true,
pointSize: 4,
highlightCircleSize: 6
},
'line': {
+ strokePattern: Dygraph.DASHED_LINE,
strokeWidth: 1.0,
drawPoints: true,
pointSize: 1.5
},
+ 'another line': {
+ strokePattern: [25, 5]
+ },
'sine wave': {
+ strokePattern: Dygraph.DOTTED_LINE,
strokeWidth: 3,
highlightCircleSize: 10
},
'sine wave2': {
- strokePattern: [10, 2, 5, 2],
+ strokePattern: Dygraph.DOT_DASH_LINE,
strokeWidth: 2,
highlightCircleSize: 3
}
}
);
- g2 = new Dygraph(
- document.getElementById("demodiv2"),
+ g3 = new Dygraph(
+ document.getElementById("demodiv3"),
data,
{
- legend: 'always',
strokeWidth: 2,
'parabola': {
- strokePattern: null,
+ strokeWidth: 0.0,
drawPoints: true,
pointSize: 4,
highlightCircleSize: 6
},
'line': {
- strokePattern: Dygraph.DASHED_LINE,
strokeWidth: 1.0,
drawPoints: true,
pointSize: 1.5
},
- 'another line': {
- strokePattern: [25, 5]
- },
'sine wave': {
- strokePattern: Dygraph.DOTTED_LINE,
strokeWidth: 3,
highlightCircleSize: 10
},
'sine wave2': {
- strokePattern: Dygraph.DOT_DASH_LINE,
+ strokePattern: [10, 2, 5, 2],
strokeWidth: 2,
highlightCircleSize: 3
}
data,
{
labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
- 'Y3': {
- axis: {
+ series : {
+ 'Y3': {
+ axis: {
+ }
+ },
+ 'Y4': {
+ axis: 'Y3' // use the same y-axis as series Y3
}
},
- 'Y4': {
- axis: 'Y3' // use the same y-axis as series Y3
- },
valueRange: [40, 70],
axes: {
y2: {
data,
{
labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
- 'Y3': {
- axis: {
+ series : {
+ 'Y3': {
+ axis: {
+ }
+ },
+ 'Y4': {
+ axis: 'Y3' // use the same y-axis as series Y3
}
},
- 'Y4': {
- axis: 'Y3' // use the same y-axis as series Y3
- },
axes: {
y: {
valueRange: [40, 80]
data,
{
labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
- 'Y3': {
- axis: {
+ series : {
+ 'Y3': {
+ axis: {
+ }
+ },
+ 'Y4': {
+ axis: 'Y3' // use the same y-axis as series Y3
}
},
- 'Y4': {
- axis: 'Y3' // use the same y-axis as series Y3
- },
axes: {
y: {
valueRange: [40, 80]