}
var setCount = setNames.length;
+ this.colors = {}
+ for (var i = 0; i < setCount; i++) {
+ this.colors[setNames[i]] = colorScheme[i % colorCount];
+ }
+
// Update Points
// TODO(danvk): here
for (var i = 0; i < this.layout.points.length; i++) {
for (var i = 0; i < setCount; i++) {
var setName = setNames[i];
- var color = colorScheme[i % colorCount];
+ var color = this.colors[setName];
// setup graphics context
ctx.save();
var setName = setNames[i];
var setNameLast;
if (i>0) setNameLast = setNames[i-1];
- var color = colorScheme[i % colorCount];
+ var color = this.colors[setName];
// setup graphics context
ctx.save();
for (var i = 0; i < setCount; i++) {
var setName = setNames[i];
- var color = colorScheme[i%colorCount];
+ var color = this.colors[setName];
// setup graphics context
context.save();
customBars: false,
fillGraph: false,
fillAlpha: 0.15,
+ connectSeparatedPoints: false,
stackedGraph: false,
hideOverlayOnMouseOut: true
var idx = -1;
for (var i = 0; i < points.length; i++) {
var dist = Math.abs(points[i].canvasx - canvasx);
- if (dist > minDist) break;
+ if (dist > minDist) continue;
minDist = dist;
idx = i;
}
replace += "<br/>";
}
var point = this.selPoints_[i];
- var c = new RGBColor(this.colors_[i%clen]);
+ var c = new RGBColor(this.plotter_.colors_[point.name]);
replace += " <b><font color='" + c.toHex() + "'>"
+ point.name + "</font></b>:"
+ this.round_(point.yval, 2);
// Draw colored circles over the center of each selected point
ctx.save();
for (var i = 0; i < this.selPoints_.length; i++) {
- if (!isOK(this.selPoints_[i%clen].canvasy)) continue;
+ if (!isOK(this.selPoints_[i].canvasy)) continue;
ctx.beginPath();
- ctx.fillStyle = this.colors_[i%clen];
- ctx.arc(canvasx, this.selPoints_[i%clen].canvasy, circleSize,
+ ctx.fillStyle = this.plotter_.colors_[this.selPoints_[i].name];
+ ctx.arc(canvasx, this.selPoints_[i].canvasy, circleSize,
0, 2 * Math.PI, false);
ctx.fill();
}
this.setColors_();
this.attrs_['pointSize'] = 0.5 * this.attr_('highlightCircleSize');
+ var connectSeparatedPoints = this.attr_('connectSeparatedPoints');
+
// For stacked series.
var cumulative_y = [];
var stacked_datasets = [];
var series = [];
for (var j = 0; j < data.length; j++) {
- var date = data[j][0];
- series[j] = [date, data[j][i]];
+ if (data[j][i] || !connectSeparatedPoints) {
+ var date = data[j][0];
+ series[j] = [date, data[j][i]];
+ }
}
series = this.rollingAverage(series, this.rollPeriod_);