DygraphCanvasRenderer.prototype._drawStyledLine = function(
ctx, i, setName, color, strokeWidth, strokePattern, drawPoints,
drawPointCallback, pointSize) {
+ // TODO(konigsberg): Compute attributes outside this method call.
var stepPlot = this.attr_("stepPlot");
var firstIndexInSet = this.layout.setPointsOffsets[i];
var setLength = this.layout.setPointsLengths[i];
var borderWidth = this.dygraph_.attr_("strokeBorderWidth", setName);
var drawPointCallback = this.dygraph_.attr_("drawPointCallback", setName) ||
Dygraph.Circles.DEFAULT;
+
+ // TODO(konigsberg): Turn this into one call, and then consider inlining drawStyledLine.
if (borderWidth && strokeWidth) {
this._drawStyledLine(ctx, i, setName,
this.dygraph_.attr_("strokeBorderColor", setName),
// points and drawing the lines. The brunt of the cost comes from allocating
// the |point| structures.
var i = 0;
+
+ // Preallocating the size of points reduces reallocations, and therefore,
+ // calls to collect garbage.
var totalPoints = 0;
for (var setIdx = 0; setIdx < this.datasets.length; ++setIdx) {
totalPoints += this.datasets[setIdx].length;
// Range from 0-1 where 0 represents top and 1 represents bottom
var yNormal = DygraphLayout._calcYNormal(axis, yValue);
- if (connectSeparated && item[1] === null) {
+ if (connectSeparated && yValue === null) {
yValue = null;
}
this.points[i] = {