source: Dev/trunk/src/client/dojox/charting/plot2d/StackedBars.js @ 493

Last change on this file since 493 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.1 KB
Line 
1define(["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});
Note: See TracBrowser for help on using the repository browser.