// Compute the box which the chart should be drawn in. This is the canvas's
// box, less space needed for axis and chart labels.
+// TODO(danvk): this belongs in DygraphLayout.
DygraphCanvasRenderer.prototype.computeArea_ = function() {
var area = {
// TODO(danvk): per-axis setting.
var y = this.area.y + tick[1] * this.area.h;
context.beginPath();
context.moveTo(halfUp(x), halfDown(y));
- context.lineTo(halfUp(x - sgn * this.attr_('axisTickSize'), halfDown(y));
+ context.lineTo(halfUp(x - sgn * this.attr_('axisTickSize')), halfDown(y));
context.closePath();
context.stroke();
DygraphCanvasRenderer.prototype._renderLineChart = function() {
// TODO(danvk): use this.attr_ for many of these.
var context = this.elementContext;
- var colorCount = this.options.colorScheme.length;
- var colorScheme = this.options.colorScheme;
+ var colorScheme = this.attr_('colors');
var fillAlpha = this.attr_('fillAlpha');
var errorBars = this.attr_("errorBars");
var fillGraph = this.attr_("fillGraph");
}
var setCount = setNames.length;
+ // 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 % colorCount];
+ this.colors[setNames[i]] = colorScheme[i % colorScheme.length];
}
// Update Points
Dygraph.DEFAULT_ROLL_PERIOD = 1;
Dygraph.DEFAULT_WIDTH = 480;
Dygraph.DEFAULT_HEIGHT = 320;
-Dygraph.AXIS_LINE_WIDTH = 0.3;
Dygraph.LOG_SCALE = 10;
Dygraph.LN_TEN = Math.log(Dygraph.LOG_SCALE);
drawXAxis: true,
drawYAxis: true,
axisLineColor: "black",
- "axisLineWidth": 0.5,
+ "axisLineWidth": 0.3,
"axisLabelColor": "black",
"axisLabelFont": "Arial", // TODO(danvk): is this implemented?
"axisLabelWidth": 50,
// Create the grapher
this.layout_ = new DygraphLayout(this);
- // TODO(danvk): why does the Renderer need its own set of options?
- this.renderOptions_ = { colorScheme: this.colors_,
- strokeColor: null,
- axisLineWidth: Dygraph.AXIS_LINE_WIDTH };
- Dygraph.update(this.renderOptions_, this.attrs_);
- Dygraph.update(this.renderOptions_, this.user_attrs_);
-
this.createStatusMessage_();
this.createDragInterface_();
};
* @private
*/
Dygraph.prototype.setColors_ = function() {
- // TODO(danvk): compute this directly into this.attrs_['colorScheme'] and do
- // away with this.renderOptions_.
var num = this.attr_("labels").length - 1;
this.colors_ = [];
var colors = this.attr_('colors');
this.colors_.push(colorStr);
}
}
-
- // TODO(danvk): update this w/r/t/ the new options system.
- this.renderOptions_.colorScheme = this.colors_;
- Dygraph.update(this.plotter_.options, this.renderOptions_);
};
/**
this.plotter_ = new DygraphCanvasRenderer(this,
this.hidden_,
this.hidden_ctx_,
- this.layout_,
- this.renderOptions_);
+ this.layout_);
// The roller sits in the bottom left corner of the chart. We don't know where
// this will be until the options are available, so it's positioned here.
// highlightCircleSize
Dygraph.update(this.user_attrs_, attrs);
- Dygraph.update(this.renderOptions_, attrs);
this.labelsFromCSV_ = (this.attr_("labels") == null);