Debian Codegraph @

dojox/charting/plot2d/Stacked.js

raw symbols SCIP
1 define(["dojo/_base/declare", "dojo/_base/lang", "./Default", "./commonStacked"],
2 function(declare, lang, Default, commonStacked){
3
4 return declare("dojox.charting.plot2d.Stacked", Default, {
5 // summary:
6 // Like the default plot, Stacked sets up lines, areas and markers
7 // in a stacked fashion (values on the y axis added to each other)
8 // as opposed to a direct one.
9 getSeriesStats: function(){
10 // summary:
11 // Calculate the min/max on all attached series in both directions.
12 // returns: Object
13 // {hmin, hmax, vmin, vmax} min/max in both directions.
14 var stats = commonStacked.collectStats(this.series, lang.hitch(this, "isNullValue"));
15 return stats; // Object
16 },
17
18 buildSegments: function(i, indexed){
19 var run = this.series[i],
20 min = indexed?Math.max(0, Math.floor(this._hScaler.bounds.from - 1)):0,
21 max = indexed?Math.min(run.data.length-1, Math.ceil(this._hScaler.bounds.to)):run.data.length-1,
22 rseg = null, segments = [], isNullValue = lang.hitch(this, "isNullValue");
23 // split the run data into dense segments (each containing no nulls)
24 // except if interpolates is false in which case ignore null between valid data
25 for(var j = min; j <= max; j++){
26 var value = indexed ? commonStacked.getIndexValue(this.series, i, j, isNullValue) : commonStacked.getValue(this.series, i, run.data[j] ?run.data[j].x: null, isNullValue);
27 if(!isNullValue(value[0]) && (indexed || value[0].y != null)){
28 if(!rseg){
29 rseg = [];
30 segments.push({index: j, rseg: rseg});
31 }
32 rseg.push(value[0]);
33 }else{
34 if(!this.opt.interpolate || indexed){
35 // we break the line only if not interpolating or if we have indexed data
36 rseg = null;
37 }
38 }
39 }
40 return segments;
41 }
42
43 });
44 });