From 600d841a16aaebfd39cabfa387a8043510c9a113 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 9 May 2011 09:04:22 -0700 Subject: [PATCH] no more renderer options! --- dygraph-canvas.js | 11 +++++++++-- dygraph.js | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 9ac88be..3aba3cd 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -433,6 +433,14 @@ DygraphCanvasRenderer.isSupported = function(canvasName) { }; /** + * @param { [String] } colors Array of color strings. Should have one entry for + * each series to be rendered. + */ +DygraphCanvasRenderer.prototype.setColors = function(colors) { + this.colorScheme_ = colors; +}; + +/** * Draw an X/Y grid on top of the existing plot */ DygraphCanvasRenderer.prototype.render = function() { @@ -837,7 +845,6 @@ DygraphCanvasRenderer.prototype._renderAnnotations = function() { DygraphCanvasRenderer.prototype._renderLineChart = function() { // TODO(danvk): use this.attr_ for many of these. var context = this.elementContext; - var colorScheme = this.attr_('colors'); var fillAlpha = this.attr_('fillAlpha'); var errorBars = this.attr_("errorBars"); var fillGraph = this.attr_("fillGraph"); @@ -855,7 +862,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { // TODO(danvk): Move this mapping into Dygraph and get it out of here. this.colors = {} for (var i = 0; i < setCount; i++) { - this.colors[setNames[i]] = colorScheme[i % colorScheme.length]; + this.colors[setNames[i]] = this.colorScheme_[i % this.colorScheme_.length]; } // Update Points diff --git a/dygraph.js b/dygraph.js index ac1bc03..aeb30e9 100644 --- a/dygraph.js +++ b/dygraph.js @@ -896,6 +896,8 @@ Dygraph.prototype.setColors_ = function() { this.colors_.push(colorStr); } } + + this.plotter_.setColors(this.colors_); }; /** -- 2.7.4