var left = this.rawData_[0][0];
var right = this.rawData_[this.rawData_.length - 1][0];
return [left, right];
-}
+};
/**
* Returns the currently-visible y-range for an axis. This can be affected by
return null;
}
- var area = this.plotter_.area;
var xRange = this.xAxisRange();
-
- var pct;
- // xRange[1] - x is unit distance from the right.
- // xRange[1] - xRange[0] is the scale of the range.
- // (xRange[1] - x / (xRange[1] - xRange[0]) is the % from the right.
- // 1 - (that) is the % distance from the left.
- pct = (xRange[1] - x) / (xRange[1] - xRange[0]);
- // There's a way to optimize that, but I'm copying the y-coord function
- // and am lazy.
- return 1 - pct;
+ return (x - xRange[0]) / (xRange[1] - xRange[0]);
}
/**
context.initialLeftmostDate = xRange[0];
context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1);
- // TODO(konigsberg): do that clever "undefined" thing.
- if (g.attr_("panFrame")) {
- var maxXPixelsToDraw = g.width_ * g.attr_("panFrame");
+ if (g.attr_("panEdgeFraction")) {
+ var maxXPixelsToDraw = g.width_ * g.attr_("panEdgeFraction");
var xExtremes = g.xAxisExtremes(); // I REALLY WANT TO CALL THIS xTremes!
var boundedLeftX = g.toDomXCoord(xExtremes[0]) - maxXPixelsToDraw;
context.boundedDates = [boundedLeftDate, boundedRightDate];
var boundedValues = [];
- var maxYPixelsToDraw = g.height_ * g.attr_("panFrame");
+ var maxYPixelsToDraw = g.height_ * g.attr_("panEdgeFraction");
for (var i = 0; i < g.axes_.length; i++) {
var axis = g.axes_[i];
var boundedTopValue = g.toDataYCoord(boundedTopY);
var boundedBottomValue = g.toDataYCoord(boundedBottomY);
- console.log(yExtremes[0], yExtremes[1], boundedTopValue, boundedBottomValue);
- // could reverse these, who knows?
boundedValues[i] = [boundedTopValue, boundedBottomValue];
}
context.boundedValues = boundedValues;
if (maxDate > context.boundedDates[1]) {
// Adjust minDate, and recompute maxDate.
minDate = minDate - (maxDate - context.boundedDates[1]);
- var maxDate = minDate + context.dateRange;
+ maxDate = minDate + context.dateRange;
}
}
px: 0,
py: 0,
- // Values for use with panFrame, which limit how far outside the
+ // Values for use with panEdgeFraction, which limit how far outside the
// graph's data boundaries it can be panned.
boundedDates: null, // [minDate, maxDate]
boundedValues: null, // [[minValue, maxValue] ...]
seriesForAxis[idx].push(series);
}
+ // If no series are defined or visible then fill in some reasonable defaults.
+ if (seriesForAxis.length == 0) {
+ var axis = this.axes_[0];
+ axis.computedValueRange = [0, 1];
+ var ret =
+ Dygraph.numericTicks(axis.computedValueRange[0],
+ axis.computedValueRange[1],
+ this,
+ axis);
+ axis.ticks = ret.ticks;
+ this.numYDigits_ = ret.numDigits;
+ return;
+ }
+
// Compute extreme values, a span and tick marks for each axis.
for (var i = 0; i < this.axes_.length; i++) {
var axis = this.axes_[i];
annotations.push(ann);
}
}
+
+ // Strip out infinities, which give dygraphs problems later on.
+ for (var j = 0; j < row.length; j++) {
+ if (!isFinite(row[j])) row[j] = null;
+ }
} else {
for (var j = 0; j < cols - 1; j++) {
row.push([ data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j) ]);
if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) {
outOfOrder = true;
}
-
- // Strip out infinities, which give dygraphs problems later on.
- for (var j = 0; j < row.length; j++) {
- if (!isFinite(row[j])) row[j] = null;
- }
ret.push(row);
}
"type": "boolean",
"description": "Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart."
},
- "panFrame": {
+ "panEdgeFraction": {
"default": "null",
- "labels": ["Axis Display?"],
+ "labels": ["Axis Display", "Interactive Elements"],
"type": "float",
"default": "null",
"description": "A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the displayed values. null means no bounds."