Util.getYLabels());
};
+// Same sa testLabelKMG2 but specifies the option at the
+// top of the option dictionary.
+AxisLabelsTestCase.prototype.testLabelKMG2_top = function() {
+ var data = [];
+ data.push([0,0]);
+ data.push([1,2000]);
+ data.push([2,1000]);
+
+ var g = new Dygraph(
+ document.getElementById("graph"),
+ data,
+ {
+ labels: [ 'X', 'bar' ],
+ labelsKMG2: true
+ }
+ );
+
+ assertEquals(
+ ["0","256","512","768","1k","1.25k","1.5k","1.75k","2k"],
+ Util.getYLabels());
+};
+
/**
* Verify that log scale axis range is properly specified.
*/
// all options which could be applied per-axis:
var axisOptions = [
'valueRange',
- 'labelsKMB',
- 'labelsKMG2',
'pixelsPerYLabel',
'yAxisLabelWidth',
'axisLabelFontSize',
isDate = true;
}
+ this.setXAxisOptions_(isDate);
+};
+
+Dygraph.prototype.setXAxisOptions_ = function(isDate) {
if (isDate) {
this.attrs_.xValueParser = Dygraph.dateParser;
this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks;
this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;
}
-};
+}
/**
* Parses the value as a floating point number. This is like the parseFloat()
if (Dygraph.isDateLike(data[0][0])) {
// Some intelligent defaults for a date x-axis.
this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
- this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
this.attrs_.axes.x.ticker = Dygraph.dateTicker;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
// Assume they're all dates.
var parsedData = Dygraph.clone(data);
// Some intelligent defaults for a numeric x-axis.
/** @private (shut up, jsdoc!) */
this.attrs_.axes.x.valueFormatter = function(x) { return x; };
- this.attrs_.axes.x.axisLabelFormatter = Dygraph.numberAxisLabelFormatter;
this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.numberAxisLabelFormatter;
return data;
}
};