for (var i = 0; i < setCount; i++) {
var setName = setNames[i];
- var setIdx = this.dygraph_.indexFromSetName(setName);
var color = this.colors[setName];
- var strokeWidth = this.dygraph_.attr_("strokeWidth", setIdx);
+ var strokeWidth = this.dygraph_.attr_("strokeWidth", setName);
// setup graphics context
context.save();
var point = this.layout.points[0];
- var pointSize = this.dygraph_.attr_("pointSize", setIdx);
+ var pointSize = this.dygraph_.attr_("pointSize", setName);
var prevX = null, prevY = null;
- var drawPoints = this.dygraph_.attr_("drawPoints", setIdx);
+ var drawPoints = this.dygraph_.attr_("drawPoints", setName);
var points = this.layout.points;
for (var j = 0; j < points.length; j++) {
var point = points[j];
this.start_();
};
-Dygraph.prototype.attr_ = function(name, series) {
- if (series &&
- typeof(this.user_attrs_[series]) != 'undefined' &&
- this.user_attrs_[series] != null &&
- typeof(this.user_attrs_[series][name]) != 'undefined') {
- return this.user_attrs_[series][name];
+Dygraph.prototype.attr_ = function(name, seriesName) {
+ if (seriesName &&
+ typeof(this.user_attrs_[seriesName]) != 'undefined' &&
+ this.user_attrs_[seriesName] != null &&
+ typeof(this.user_attrs_[seriesName][name]) != 'undefined') {
+ return this.user_attrs_[seriesName][name];
} else if (typeof(this.user_attrs_[name]) != 'undefined') {
return this.user_attrs_[name];
} else if (typeof(this.attrs_[name]) != 'undefined') {
if (this.previousVerticalX_ >= 0) {
// Determine the maximum highlight circle size.
var maxCircleSize = 0;
- var num_series = this.attr_('labels').length;
- for (var i = 1; i < num_series; i++) {
- var r = this.attr_('highlightCircleSize', i);
+ var labels = this.attr_('labels');
+ for (var i = 1; i < labels.length; i++) {
+ var r = this.attr_('highlightCircleSize', labels[i]);
if (r > maxCircleSize) maxCircleSize = r;
}
var px = this.previousVerticalX_;
ctx.save();
for (var i = 0; i < this.selPoints_.length; i++) {
if (!isOK(this.selPoints_[i].canvasy)) continue;
- var setIdx = this.indexFromSetName(this.selPoints_[i].name);
- var circleSize = this.attr_('highlightCircleSize', setIdx);
+ var circleSize =
+ this.attr_('highlightCircleSize', this.selPoints_[i].name);
ctx.beginPath();
ctx.fillStyle = this.plotter_.colors[this.selPoints_[i].name];
ctx.arc(canvasx, this.selPoints_[i].canvasy, circleSize,
for (var i = 0; i < labels.length; i++) {
new_labels.push(labels[i]);
if (i) new_colors.push(orig_colors[i - 1]);
- new_opts[new_colors.length] = null;
if (coeffs[i]) {
// Darken the series by 50% to generate its regression.
- new_labels.push(labels[i] + " Regression");
+ var label = labels[i] + " Regression";
+ new_labels.push(label);
var c = new RGBColor(orig_colors[i - 1]);
c.r = Math.floor(255 - 0.5 * (255 - c.r));
c.g = Math.floor(255 - 0.5 * (255 - c.g));
c.b = Math.floor(255 - 0.5 * (255 - c.b));
new_colors.push(c.toHex());
- new_opts[new_colors.length] = {
+ new_opts[label] = {
drawPoints: false,
strokeWidth: 1.0
};