1 | define(["dojo/_base/declare", "./Bars", "./commonStacked"], |
---|
2 | function(declare, Bars, commonStacked){ |
---|
3 | |
---|
4 | return declare("dojox.charting.plot2d.StackedBars", Bars, { |
---|
5 | // summary: |
---|
6 | // The plot object representing a stacked bar chart (horizontal bars). |
---|
7 | getSeriesStats: function(){ |
---|
8 | // summary: |
---|
9 | // Calculate the min/max on all attached series in both directions. |
---|
10 | // returns: Object |
---|
11 | // {hmin, hmax, vmin, vmax} min/max in both directions. |
---|
12 | var stats = commonStacked.collectStats(this.series), t; |
---|
13 | stats.hmin -= 0.5; |
---|
14 | stats.hmax += 0.5; |
---|
15 | t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t; |
---|
16 | t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t; |
---|
17 | return stats; // Object |
---|
18 | }, |
---|
19 | getValue: function(value, index, seriesIndex, indexed){ |
---|
20 | var y,x; |
---|
21 | if(indexed){ |
---|
22 | x = index; |
---|
23 | y = commonStacked.getIndexValue(this.series, seriesIndex, x); |
---|
24 | }else{ |
---|
25 | x = value.x - 1; |
---|
26 | y = commonStacked.getValue(this.series, seriesIndex, value.x); |
---|
27 | y = [ y[0]?y[0].y:null, y[1]?y[1]:null ]; |
---|
28 | } |
---|
29 | // in py we return the previous stack value as we need it to position labels on columns |
---|
30 | return { x: x, y: y[0], py: y[1] }; |
---|
31 | } |
---|
32 | }); |
---|
33 | }); |
---|