123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119 |
- if(!dojo._hasResource["dojox.charting.Chart"]){
- dojo._hasResource["dojox.charting.Chart"] = true;
- dojo.provide("dojox.charting.Chart");
- dojo.require("dojox.gfx");
- dojo.require("dojox.lang.functional");
- dojo.require("dojox.lang.functional.fold");
- dojo.require("dojox.lang.functional.reversed");
- dojo.require("dojox.charting.Element");
- dojo.require("dojox.charting.Theme");
- dojo.require("dojox.charting.Series");
- dojo.require("dojox.charting.axis2d.common");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting, g = dojox.gfx,
- clear = df.lambda("item.clear()"),
- purge = df.lambda("item.purgeGroup()"),
- destroy = df.lambda("item.destroy()"),
- makeClean = df.lambda("item.dirty = false"),
- makeDirty = df.lambda("item.dirty = true"),
- getName = df.lambda("item.name");
- dojo.declare("dojox.charting.Chart", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor: function(/* DOMNode */node, /* dojox.charting.__ChartCtorArgs? */kwArgs){
-
-
-
-
-
- if(!kwArgs){ kwArgs = {}; }
- this.margins = kwArgs.margins ? kwArgs.margins : {l: 10, t: 10, r: 10, b: 10};
- this.stroke = kwArgs.stroke;
- this.fill = kwArgs.fill;
- this.delayInMs = kwArgs.delayInMs || 200;
- this.title = kwArgs.title;
- this.titleGap = kwArgs.titleGap;
- this.titlePos = kwArgs.titlePos;
- this.titleFont = kwArgs.titleFont;
- this.titleFontColor = kwArgs.titleFontColor;
- this.chartTitle = null;
-
- this.theme = null;
- this.axes = {};
- this.stack = [];
- this.plots = {};
- this.series = [];
- this.runs = {};
- this.dirty = true;
- this.coords = null;
-
- this.node = dojo.byId(node);
- var box = dojo.marginBox(node);
- this.surface = g.createSurface(this.node, box.w || 400, box.h || 300);
- },
- destroy: function(){
-
-
-
- dojo.forEach(this.series, destroy);
- dojo.forEach(this.stack, destroy);
- df.forIn(this.axes, destroy);
- if(this.chartTitle && this.chartTitle.tagName){
-
- dojo.destroy(this.chartTitle);
- }
- this.surface.destroy();
- },
- getCoords: function(){
-
-
-
-
-
- if(!this.coords){
- this.coords = dojo.coords(this.node, true);
- }
- return this.coords;
- },
- setTheme: function(theme){
-
-
-
-
-
-
- this.theme = theme.clone();
- this.dirty = true;
- return this;
- },
- addAxis: function(name, kwArgs){
-
-
-
-
-
-
-
-
- var axis, axisType = kwArgs && kwArgs.type || "Default";
- if(typeof axisType == "string"){
- if(!dc.axis2d || !dc.axis2d[axisType]){
- throw Error("Can't find axis: " + axisType + " - didn't you forget to dojo" + ".require() it?");
- }
- axis = new dc.axis2d[axisType](this, kwArgs);
- }else{
- axis = new axisType(this, kwArgs);
- }
- axis.name = name;
- axis.dirty = true;
- if(name in this.axes){
- this.axes[name].destroy();
- }
- this.axes[name] = axis;
- this.dirty = true;
- return this;
- },
- getAxis: function(name){
-
-
-
-
-
-
- return this.axes[name];
- },
- removeAxis: function(name){
-
-
-
-
-
-
- if(name in this.axes){
-
- this.axes[name].destroy();
- delete this.axes[name];
-
- this.dirty = true;
- }
- return this;
- },
- addPlot: function(name, kwArgs){
-
-
-
-
-
-
-
-
-
-
-
- var plot, plotType = kwArgs && kwArgs.type || "Default";
- if(typeof plotType == "string"){
- if(!dc.plot2d || !dc.plot2d[plotType]){
- throw Error("Can't find plot: " + plotType + " - didn't you forget to dojo" + ".require() it?");
- }
- plot = new dc.plot2d[plotType](this, kwArgs);
- }else{
- plot = new plotType(this, kwArgs);
- }
- plot.name = name;
- plot.dirty = true;
- if(name in this.plots){
- this.stack[this.plots[name]].destroy();
- this.stack[this.plots[name]] = plot;
- }else{
- this.plots[name] = this.stack.length;
- this.stack.push(plot);
- }
- this.dirty = true;
- return this;
- },
- removePlot: function(name){
-
-
-
-
-
-
- if(name in this.plots){
-
- var index = this.plots[name];
- delete this.plots[name];
-
- this.stack[index].destroy();
-
- this.stack.splice(index, 1);
-
- df.forIn(this.plots, function(idx, name, plots){
- if(idx > index){
- plots[name] = idx - 1;
- }
- });
-
- var ns = dojo.filter(this.series, function(run){ return run.plot != name; });
- if(ns.length < this.series.length){
-
- dojo.forEach(this.series, function(run){
- if(run.plot == name){
- run.destroy();
- }
- });
-
- this.runs = {};
- dojo.forEach(ns, function(run, index){
- this.runs[run.plot] = index;
- }, this);
- this.series = ns;
- }
-
- this.dirty = true;
- }
- return this;
- },
- getPlotOrder: function(){
-
-
-
-
- return df.map(this.stack, getName);
- },
- setPlotOrder: function(newOrder){
-
-
-
-
-
-
-
- var names = {},
- order = df.filter(newOrder, function(name){
- if(!(name in this.plots) || (name in names)){
- return false;
- }
- names[name] = 1;
- return true;
- }, this);
- if(order.length < this.stack.length){
- df.forEach(this.stack, function(plot){
- var name = plot.name;
- if(!(name in names)){
- order.push(name);
- }
- });
- }
- var newStack = df.map(order, function(name){
- return this.stack[this.plots[name]];
- }, this);
- df.forEach(newStack, function(plot, i){
- this.plots[plot.name] = i;
- }, this);
- this.stack = newStack;
- this.dirty = true;
- return this;
- },
- movePlotToFront: function(name){
-
-
-
-
-
-
- if(name in this.plots){
- var index = this.plots[name];
- if(index){
- var newOrder = this.getPlotOrder();
- newOrder.splice(index, 1);
- newOrder.unshift(name);
- return this.setPlotOrder(newOrder);
- }
- }
- return this;
- },
- movePlotToBack: function(name){
-
-
-
-
-
-
- if(name in this.plots){
- var index = this.plots[name];
- if(index < this.stack.length - 1){
- var newOrder = this.getPlotOrder();
- newOrder.splice(index, 1);
- newOrder.push(name);
- return this.setPlotOrder(newOrder);
- }
- }
- return this;
- },
- addSeries: function(name, data, kwArgs){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var run = new dc.Series(this, data, kwArgs);
- run.name = name;
- if(name in this.runs){
- this.series[this.runs[name]].destroy();
- this.series[this.runs[name]] = run;
- }else{
- this.runs[name] = this.series.length;
- this.series.push(run);
- }
- this.dirty = true;
-
- if(!("ymin" in run) && "min" in run){ run.ymin = run.min; }
- if(!("ymax" in run) && "max" in run){ run.ymax = run.max; }
- return this;
- },
- removeSeries: function(name){
-
-
-
-
-
-
- if(name in this.runs){
-
- var index = this.runs[name];
- delete this.runs[name];
-
- this.series[index].destroy();
-
- this.series.splice(index, 1);
-
- df.forIn(this.runs, function(idx, name, runs){
- if(idx > index){
- runs[name] = idx - 1;
- }
- });
- this.dirty = true;
- }
- return this;
- },
- updateSeries: function(name, data){
-
-
-
-
-
-
-
-
-
-
-
- if(name in this.runs){
- var run = this.series[this.runs[name]];
- run.update(data);
- this._invalidateDependentPlots(run.plot, false);
- this._invalidateDependentPlots(run.plot, true);
- }
- return this;
- },
- getSeriesOrder: function(plotName){
-
-
-
-
-
-
- return df.map(df.filter(this.series, function(run){
- return run.plot == plotName;
- }), getName);
- },
- setSeriesOrder: function(newOrder){
-
-
-
-
-
-
-
-
- var plotName, names = {},
- order = df.filter(newOrder, function(name){
- if(!(name in this.runs) || (name in names)){
- return false;
- }
- var run = this.series[this.runs[name]];
- if(plotName){
- if(run.plot != plotName){
- return false;
- }
- }else{
- plotName = run.plot;
- }
- names[name] = 1;
- return true;
- }, this);
- df.forEach(this.series, function(run){
- var name = run.name;
- if(!(name in names) && run.plot == plotName){
- order.push(name);
- }
- });
- var newSeries = df.map(order, function(name){
- return this.series[this.runs[name]];
- }, this);
- this.series = newSeries.concat(df.filter(this.series, function(run){
- return run.plot != plotName;
- }));
- df.forEach(this.series, function(run, i){
- this.runs[run.name] = i;
- }, this);
- this.dirty = true;
- return this;
- },
- moveSeriesToFront: function(name){
-
-
-
-
-
-
- if(name in this.runs){
- var index = this.runs[name],
- newOrder = this.getSeriesOrder(this.series[index].plot);
- if(name != newOrder[0]){
- newOrder.splice(index, 1);
- newOrder.unshift(name);
- return this.setSeriesOrder(newOrder);
- }
- }
- return this;
- },
- moveSeriesToBack: function(name){
-
-
-
-
-
-
- if(name in this.runs){
- var index = this.runs[name],
- newOrder = this.getSeriesOrder(this.series[index].plot);
- if(name != newOrder[newOrder.length - 1]){
- newOrder.splice(index, 1);
- newOrder.push(name);
- return this.setSeriesOrder(newOrder);
- }
- }
- return this;
- },
- resize: function(width, height){
-
-
-
-
-
-
-
-
-
-
-
- var box;
- switch(arguments.length){
-
- case 1:
-
- box = dojo.mixin({}, width);
- dojo.marginBox(this.node, box);
- break;
- case 2:
- box = {w: width, h: height};
-
- dojo.marginBox(this.node, box);
- break;
- }
-
- box = dojo.marginBox(this.node);
-
- this.surface.setDimensions(box.w, box.h);
- this.dirty = true;
- this.coords = null;
- return this.render();
- },
- getGeometry: function(){
-
-
-
-
-
- var ret = {};
- df.forIn(this.axes, function(axis){
- if(axis.initialized()){
- ret[axis.name] = {
- name: axis.name,
- vertical: axis.vertical,
- scaler: axis.scaler,
- ticks: axis.ticks
- };
- }
- });
- return ret;
- },
- setAxisWindow: function(name, scale, offset, zoom){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var axis = this.axes[name];
- if(axis){
- axis.setWindow(scale, offset);
- dojo.forEach(this.stack,function(plot){
- if(plot.hAxis == name || plot.vAxis == name){
- plot.zoom = zoom;
- }
- })
- }
- return this;
- },
- setWindow: function(sx, sy, dx, dy, zoom){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(!("plotArea" in this)){
- this.calculateGeometry();
- }
- df.forIn(this.axes, function(axis){
- var scale, offset, bounds = axis.getScaler().bounds,
- s = bounds.span / (bounds.upper - bounds.lower);
- if(axis.vertical){
- scale = sy;
- offset = dy / s / scale;
- }else{
- scale = sx;
- offset = dx / s / scale;
- }
- axis.setWindow(scale, offset);
- });
- dojo.forEach(this.stack, function(plot){ plot.zoom = zoom; });
- return this;
- },
- zoomIn: function(name, range){
-
-
-
-
-
-
-
- var axis = this.axes[name];
- if(axis){
- var scale, offset, bounds = axis.getScaler().bounds;
- var lower = Math.min(range[0],range[1]);
- var upper = Math.max(range[0],range[1]);
- lower = range[0] < bounds.lower ? bounds.lower : lower;
- upper = range[1] > bounds.upper ? bounds.upper : upper;
- scale = (bounds.upper - bounds.lower) / (upper - lower);
- offset = lower - bounds.lower;
- this.setAxisWindow(name, scale, offset);
- this.render();
- }
- },
- calculateGeometry: function(){
-
-
-
-
-
- if(this.dirty){
- return this.fullGeometry();
- }
-
- var dirty = dojo.filter(this.stack, function(plot){
- return plot.dirty ||
- (plot.hAxis && this.axes[plot.hAxis].dirty) ||
- (plot.vAxis && this.axes[plot.vAxis].dirty);
- }, this);
- calculateAxes(dirty, this.plotArea);
- return this;
- },
- fullGeometry: function(){
-
-
-
-
-
-
- this._makeDirty();
-
- dojo.forEach(this.stack, clear);
-
-
- if(!this.theme){
- this.setTheme(new dojox.charting.Theme(dojox.charting._def));
- }
-
- dojo.forEach(this.series, function(run){
- if(!(run.plot in this.plots)){
- if(!dc.plot2d || !dc.plot2d.Default){
- throw Error("Can't find plot: Default - didn't you forget to dojo" + ".require() it?");
- }
- 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);
-
- 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);
-
-
- var dim = this.dim = this.surface.getDimensions();
- dim.width = g.normalizedLength(dim.width);
- dim.height = g.normalizedLength(dim.height);
- df.forIn(this.axes, clear);
- calculateAxes(this.stack, dim);
-
- 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; });
- });
-
- if(this.title){
- this.titleGap = (this.titleGap==0) ? 0 : this.titleGap || this.theme.chart.titleGap || 20;
- this.titlePos = this.titlePos || this.theme.chart.titlePos || "top";
- this.titleFont = this.titleFont || this.theme.chart.titleFont;
- this.titleFontColor = this.titleFontColor || this.theme.chart.titleFontColor || "black";
- var tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
- offsets[this.titlePos=="top" ? "t":"b"] += (tsize + this.titleGap);
- }
-
- df.forIn(this.margins, function(o, i){ offsets[i] += o; });
-
- this.plotArea = {
- width: dim.width - offsets.l - offsets.r,
- height: dim.height - offsets.t - offsets.b
- };
- df.forIn(this.axes, clear);
- calculateAxes(this.stack, this.plotArea);
- return this;
- },
- render: function(){
-
-
-
-
-
-
- if(this.theme){
- this.theme.clear();
- }
- if(this.dirty){
- return this.fullRender();
- }
- this.calculateGeometry();
-
- df.forEachRev(this.stack, function(plot){ plot.render(this.dim, this.offsets); }, this);
-
- df.forIn(this.axes, function(axis){ axis.render(this.dim, this.offsets); }, this);
- this._makeClean();
-
- if(this.surface.render){ this.surface.render(); };
-
- return this;
- },
- fullRender: function(){
-
-
-
-
-
-
- this.fullGeometry();
- var offsets = this.offsets, dim = this.dim, rect;
-
-
-
-
- dojo.forEach(this.series, purge);
- df.forIn(this.axes, purge);
- dojo.forEach(this.stack, purge);
- if(this.chartTitle && this.chartTitle.tagName){
-
- dojo.destroy(this.chartTitle);
- }
- this.surface.clear();
- this.chartTitle = null;
-
-
- var t = this.theme,
- fill = t.plotarea && t.plotarea.fill,
- stroke = t.plotarea && t.plotarea.stroke,
- rect = {
- x: offsets.l - 1, y: offsets.t - 1,
- width: dim.width - offsets.l - offsets.r + 2,
- height: dim.height - offsets.t - offsets.b + 2
- };
- if(fill){
- fill = dc.Element.prototype._shapeFill(dc.Element.prototype._plotFill(fill, dim, offsets), rect);
- this.surface.createRect(rect).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);
- }
-
- df.foldr(this.stack, function(z, plot){ return plot.render(dim, offsets), 0; }, 0);
-
- fill = this.fill !== undefined ? this.fill : (t.chart && t.chart.fill);
- stroke = this.stroke !== undefined ? this.stroke : (t.chart && t.chart.stroke);
-
- if(fill == "inherit"){
-
- var node = this.node, fill = new dojo.Color(dojo.style(node, "backgroundColor"));
- while(fill.a==0 && node!=document.documentElement){
- fill = new dojo.Color(dojo.style(node, "backgroundColor"));
- node = node.parentNode;
- }
- }
- if(fill){
- fill = dc.Element.prototype._plotFill(fill, dim, offsets);
- if(offsets.l){
- rect = {
- width: offsets.l,
- height: dim.height + 1
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.r){
- rect = {
- x: dim.width - offsets.r,
- width: offsets.r + 1,
- height: dim.height + 2
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.t){
- rect = {
- width: dim.width + 1,
- height: offsets.t
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.b){
- rect = {
- y: dim.height - offsets.b,
- width: dim.width + 1,
- height: offsets.b + 2
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- }
- if(stroke){
- this.surface.createRect({
- width: dim.width - 1,
- height: dim.height - 1
- }).setStroke(stroke);
- }
-
- if(this.title){
- var forceHtmlLabels = (g.renderer == "canvas"),
- labelType = forceHtmlLabels || !dojo.isIE && !dojo.isOpera ? "html" : "gfx",
- tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
- this.chartTitle = dc.axis2d.common.createText[labelType](
- this,
- this.surface,
- dim.width/2,
- this.titlePos=="top" ? tsize + this.margins.t : dim.height - this.margins.b,
- "middle",
- this.title,
- this.titleFont,
- this.titleFontColor
- );
- }
-
- df.forIn(this.axes, function(axis){ axis.render(dim, offsets); });
- this._makeClean();
-
- if(this.surface.render){ this.surface.render(); };
-
- return this;
- },
- delayedRender: function(){
-
-
-
-
-
- if(!this._delayedRenderHandle){
- this._delayedRenderHandle = setTimeout(
- dojo.hitch(this, function(){
- clearTimeout(this._delayedRenderHandle);
- this._delayedRenderHandle = null;
- this.render();
- }),
- this.delayInMs
- );
- }
- return this;
- },
- connectToPlot: function(name, object, method){
-
-
-
-
-
-
-
-
-
-
- return name in this.plots ? this.stack[this.plots[name]].connect(object, method) : null;
- },
- fireEvent: function(seriesName, eventName, index){
-
-
-
-
-
-
-
-
-
-
- if(seriesName in this.runs){
- var plotName = this.series[this.runs[seriesName]].plot;
- if(plotName in this.plots){
- var plot = this.stack[this.plots[plotName]];
- if(plot){
- plot.fireEvent(seriesName, eventName, index);
- }
- }
- }
- return this;
- },
- _makeClean: function(){
-
- dojo.forEach(this.axes, makeClean);
- dojo.forEach(this.stack, makeClean);
- dojo.forEach(this.series, makeClean);
- this.dirty = false;
- },
- _makeDirty: function(){
-
- dojo.forEach(this.axes, makeDirty);
- dojo.forEach(this.stack, makeDirty);
- dojo.forEach(this.series, makeDirty);
- this.dirty = true;
- },
- _invalidateDependentPlots: function(plotName, /* Boolean */ verticalAxis){
- if(plotName in this.plots){
- var plot = this.stack[this.plots[plotName]], axis,
- axisName = verticalAxis ? "vAxis" : "hAxis";
- if(plot[axisName]){
- axis = this.axes[plot[axisName]];
- if(axis && axis.dependOnData()){
- axis.dirty = true;
-
- dojo.forEach(this.stack, function(p){
- if(p[axisName] && p[axisName] == plot[axisName]){
- p.dirty = true;
- }
- });
- }
- }else{
- plot.dirty = true;
- }
- }
- }
- });
- function hSection(stats){
- return {min: stats.hmin, max: stats.hmax};
- }
- function vSection(stats){
- return {min: stats.vmin, max: stats.vmax};
- }
- function hReplace(stats, h){
- stats.hmin = h.min;
- stats.hmax = h.max;
- }
- function vReplace(stats, v){
- stats.vmin = v.min;
- stats.vmax = v.max;
- }
- function combineStats(target, source){
- if(target && source){
- target.min = Math.min(target.min, source.min);
- target.max = Math.max(target.max, source.max);
- }
- return target || source;
- }
- function calculateAxes(stack, plotArea){
- var plots = {}, axes = {};
- dojo.forEach(stack, function(plot){
- var stats = plots[plot.name] = plot.getSeriesStats();
- if(plot.hAxis){
- axes[plot.hAxis] = combineStats(axes[plot.hAxis], hSection(stats));
- }
- if(plot.vAxis){
- axes[plot.vAxis] = combineStats(axes[plot.vAxis], vSection(stats));
- }
- });
- dojo.forEach(stack, function(plot){
- var stats = plots[plot.name];
- if(plot.hAxis){
- hReplace(stats, axes[plot.hAxis]);
- }
- if(plot.vAxis){
- vReplace(stats, axes[plot.vAxis]);
- }
- plot.initializeScalers(plotArea, stats);
- });
- }
- })();
- }
|