From: Dan Vanderkam Date: Mon, 9 May 2011 16:04:22 +0000 (-0700) Subject: no more renderer options! X-Git-Tag: v1.0.0~499 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=600d841a16aaebfd39cabfa387a8043510c9a113;p=dygraphs.git no more renderer options! --- 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_); }; /**