labelsKMG2: false,
showLabelsOnHighlight: true,
- yValueFormatter: null,
+ yValueFormatter: function(x) { return Dygraph.round_(x, 2); },
strokeWidth: 1.0,
this.selPoints_ = [];
var cumulative_sum = 0; // used only if we have a stackedGraph.
var l = points.length;
+ var isStacked = this.attr_("stackedGraph");
for (var i = 0; i < l; i++) {
if (points[i].xval == lastx) {
- if (!this.attr_("stackedGraph")) {
+ if (!isStacked) {
this.selPoints_.push(points[i]);
} else {
// Clone the point, since we need to 'unstack' it below. Stacked points
}
var point = this.selPoints_[i];
var c = new RGBColor(this.colors_[i%clen]);
- var yval = fmtFunc ? fmtFunc(point.yval) : this.round_(point.yval, 2);
+ var yval = fmtFunc(point.yval);
replace += " <b><font color='" + c.toHex() + "'>"
+ point.name + "</font></b>:"
+ yval;
* @return {Number} The rounded number
* @private
*/
-Dygraph.prototype.round_ = function(num, places) {
+Dygraph.round_ = function(num, places) {
var shift = Math.pow(10, places);
return Math.round(num * shift)/shift;
};
for (var i = 0; i < nTicks; i++) {
var tickV = low_val + i * scale;
var absTickV = Math.abs(tickV);
- var label = self.round_(tickV, 2);
+ var label = Dygraph.round_(tickV, 2);
if (k_labels.length) {
// Round up to an appropriate unit.
var n = k*k*k*k;
for (var j = 3; j >= 0; j--, n /= k) {
if (absTickV >= n) {
- label = self.round_(tickV / n, 1) + k_labels[j];
+ label = Dygraph.round_(tickV / n, 1) + k_labels[j];
break;
}
}