// TODO(danvk): would ['-1.0','-0.5','0.0','0.5','1.0'] be better?
assertEquals(['-1','-0.5','0','0.5','1'], getYLabels());
- assertEquals("X,Y\n" + "0,-1\n" + "1,0\n" + "2,1\n" + "3,0\n", g.file_);
// Go up to 2
data += "4,2\n";
assertEquals([12, 18], g.xAxisRange());
assertEquals([10, 40], g.yAxisRange(0));
- console.log(g.user_attrs_);
g.updateOptions({ dateWindow : null, valueRange : null });
- console.log(g.user_attrs_);
assertEquals([10, 20], g.xAxisRange());
assertEquals([0, 55], g.yAxisRange(0));
};
strokeStyle: "#008080",
lineWidth: 1
});
-};
+}
+/**
+ * @fileoverview Test cases for the tick-generating functions.
+ * These were generated by adding logging code to the old ticker functions. The
+ * tests serve to track existing behavior should it change in the future.
+ *
+ * @author danvdk@gmail.com (Dan Vanderkam)
+ */
+
var TickerTestCase = TestCase("ticker-tests");
TickerTestCase.prototype.setUp = function() {
assertEquals([100, 0], g.toDataCoords(500, 425));
this.checkForInverses(g);
-};
+}
// height: this.attr_('axisLabelFontSize') + 2 + "px",
overflow: "hidden"
};
- var makeDiv = function(txt, axis, precise_axis) {
+ var makeDiv = function(txt, axis, prec_axis) {
var div = document.createElement("div");
for (var name in labelStyle) {
if (labelStyle.hasOwnProperty(name)) {
}
}
var inner_div = document.createElement("div");
- // TODO(danvk): separate class for secondary y-axis
inner_div.className = 'dygraph-axis-label' +
' dygraph-axis-label-' + axis +
- (precise_axis ? ' dygraph-axis-label-' + precise_axis : '');
+ (prec_axis ? ' dygraph-axis-label-' + prec_axis : '');
inner_div.appendChild(document.createTextNode(txt));
div.appendChild(inner_div);
return div;
var src=document.getElementsByTagName('script');
var script = src[src.length-1].getAttribute("src");
- // This list needs to be kept in sync w/ the one in generate-combined.sh
- // and the one in jsTestDriver.conf.
- var source_files = [
- "strftime/strftime-min.js",
- "rgbcolor/rgbcolor.js",
- "dygraph-layout.js",
- "dygraph-canvas.js",
- "dygraph.js",
- "dygraph-utils.js",
- "dygraph-gviz.js",
- "dygraph-interaction-model.js",
- "dygraph-options-reference.js" // Shouldn't be included in generate-combined.sh
- , "dygraph-tickers.js"
- ];
+ // This list needs to be kept in sync w/ the one in generate-combined.sh
+ // and the one in jsTestDriver.conf.
+ var source_files = [
+ "strftime/strftime-min.js",
+ "rgbcolor/rgbcolor.js",
+ "dygraph-layout.js",
+ "dygraph-canvas.js",
+ "dygraph.js",
+ "dygraph-utils.js",
+ "dygraph-gviz.js",
+ "dygraph-interaction-model.js",
+ "dygraph-options-reference.js", // Shouldn't be included in generate-combined.sh
+ "dygraph-tickers.js"
+ ];
for (var i = 0; i < source_files.length; i++) {
document.write('<script type="text/javascript" src="' + script.replace('dygraph-dev.js', source_files[i]) + '"></script>\n');
maxNumberWidth: 6,
sigFigs: null,
- xAxisLabelWidth: 50,
- yAxisLabelWidth: 50,
-
strokeWidth: 1.0,
axisTickSize: 3,
axisLabelFontSize: 14,
+ xAxisLabelWidth: 50,
+ yAxisLabelWidth: 50,
rightGap: 5,
showRoller: false,
this.user_attrs_ = {};
Dygraph.update(this.user_attrs_, attrs);
+ // This sequence ensures that Dygraph.DEFAULT_ATTRS is never modified.
this.attrs_ = {};
Dygraph.updateDeep(this.attrs_, Dygraph.DEFAULT_ATTRS);
};
/**
- * Returns a copy of the options with deprecated names converted into current names.
+ * Returns a copy of the options with deprecated names converted into current
+ * names. Also drops the (potentially-large) 'file' attribute. If the caller is
+ * interested in that, they should save a copy before calling this.
* @private
*/
Dygraph.mapLegacyOptions_ = function(attrs) {
}
};
+ // This maps, e.g., xValueFormater -> axes: { x: { valueFormatter: ... } }
map('xValueFormatter', 'x', 'valueFormatter');
map('pixelsPerXLabel', 'x', 'pixelsPerLabel');
map('xAxisLabelFormatter', 'x', 'axisLabelFormatter');