dojox.charting.Chart2D.fullRender
dojo.require("dojox.charting.Chart2D");
defined in dojox/charting/Chart2D.js
Usage
function () (view source)
this._makeDirty(); // clear old values dojo.forEach(this.stack, clear); dojo.forEach(this.series, purge); df.forIn(this.axes, purge); dojo.forEach(this.stack, purge); this.surface.clear(); // rebuild new connections, and add defaults // assign series dojo.forEach(this.series, function(run){ if(!(run.plot in this.plots)){ var plot = new dc.plot2d.Default(this, {}); plot.name = run.plot; this.plots[run.plot] = this.stack.length; this.stack.push(plot); } this.stack[this.plots[run.plot]].addSeries(run); }, this); // assign axes dojo.forEach(this.stack, function(plot){ if(plot.hAxis){ plot.setAxis(this.axes[plot.hAxis]); } if(plot.vAxis){ plot.setAxis(this.axes[plot.vAxis]); } }, this); // set up a theme if(!this.theme){ this.theme = new dojox.charting.Theme(dojox.charting._def); } var requiredColors = df.foldl(this.stack, "z + plot.getRequiredColors()", 0); this.theme.defineColors({num: requiredColors, cache: false}); // calculate geometry // 1st pass var dim = this.dim = this.surface.getDimensions(); dim.width = dojox.gfx.normalizedLength(dim.width); dim.height = dojox.gfx.normalizedLength(dim.height); df.forIn(this.axes, clear); dojo.forEach(this.stack, function(plot){ plot.calculateAxes(dim); }); // assumption: we don't have stacked axes yet var offsets = this.offsets = {l: 0, r: 0, t: 0, b: 0}; df.forIn(this.axes, function(axis){ df.forIn(axis.getOffsets(), function(o, i){ offsets[i] += o; }); }); // add margins df.forIn(this.margins, function(o, i){ offsets[i] += o; }); // 2nd pass with realistic dimensions this.plotArea = {width: dim.width - offsets.l - offsets.r, height: dim.height - offsets.t - offsets.b}; df.forIn(this.axes, clear); dojo.forEach(this.stack, function(plot){ plot.calculateAxes(this.plotArea); }, this); // generate shapes // draw a chart background var t = this.theme, fill = this.fill ? this.fill : (t.chart && t.chart.fill), stroke = this.stroke ? this.stroke : (t.chart && t.chart.stroke); if(fill){ this.surface.createRect({ width: dim.width, height: dim.height }).setFill(fill); } if(stroke){ this.surface.createRect({ width: dim.width - 1, height: dim.height - 1 }).setStroke(stroke); } // draw a plot background fill = t.plotarea && t.plotarea.fill; stroke = t.plotarea && t.plotarea.stroke; if(fill){ this.surface.createRect({ x: offsets.l, y: offsets.t, width: dim.width - offsets.l - offsets.r, height: dim.height - offsets.t - offsets.b }).setFill(fill); } if(stroke){ this.surface.createRect({ x: offsets.l, y: offsets.t, width: dim.width - offsets.l - offsets.r - 1, height: dim.height - offsets.t - offsets.b - 1 }).setStroke(stroke); } // go over the stack backwards df.foldr(this.stack, function(z, plot){ return plot.render(dim, offsets), 0; }, 0); // go over axes df.forIn(this.axes, function(axis){ axis.render(dim, offsets); }); this._makeClean(); return this;