Changeset 13716

Show
Ignore:
Timestamp:
05/13/08 00:55:30 (3 months ago)
Author:
elazutkin
Message:

dojox.charting: more window-related fixes, added a test for that. !strict

Location:
dojox/trunk/charting
Files:
1 added
14 modified

Legend:

Unmodified
Added
Removed
  • dojox/trunk/charting/axis2d/Default.js

    r13715 r13716  
    7171                }, 
    7272                setWindow: function(scale, offset){ 
    73                         this.scale  = scale; 
    74                         this.offset = offset; 
     73                        if(scale == 1 && offset == 0){ 
     74                                delete this.scale; 
     75                                delete this.offset; 
     76                        }else{ 
     77                                this.scale  = scale; 
     78                                this.offset = offset; 
     79                        } 
    7580                        return this.clear(); 
     81                }, 
     82                getWindowScale: function(){ 
     83                        return "scale" in this ? this.scale : 1; 
     84                }, 
     85                getWindowOffset: function(){ 
     86                        return "offset" in this ? this.offset : 0; 
    7687                }, 
    7788                calculate: function(min, max, span, labels){ 
     
    8293                                // calculate new range 
    8394                                this.opt.from = this.scaler.bounds.lower + this.offset; 
    84                                 this.opt.to   = (this.scaler.bounds.upper - this.scaler.bounds.lower) / scale + this.opt.from; 
     95                                this.opt.to   = (this.scaler.bounds.upper - this.scaler.bounds.lower) / this.scale + this.opt.from; 
    8596                                // make sure that bounds are correct 
    86                                 if(isInfinite(this.opt.from) || isNaN(this.opt.from) || isInfinite(this.opt.to) || isNaN(this.opt.to) || 
    87                                                 this.opt.to - this.from.to >= this.scaler.bounds.upper - this.scaler.bounds.lower){ 
     97                                if(!isFinite(this.opt.from) || isNaN(this.opt.from) || !isFinite(this.opt.to) || isNaN(this.opt.to) || 
     98                                                this.opt.to - this.opt.from >= this.scaler.bounds.upper - this.scaler.bounds.lower){ 
    8899                                        // any error --- remove from/to bounds 
    89100                                        delete this.opt.from; 
  • dojox/trunk/charting/Chart2D.js

    r13715 r13716  
    216216                        } 
    217217                        df.forIn(this.axes, function(axis){ 
    218                                 var scale, offset, bounds = axis.scaler.bounds, 
     218                                var scale, offset, bounds = axis.getScaler().bounds, 
    219219                                        s = bounds.span / (bounds.upper - bounds.lower); 
    220220                                if(axis.vertical){ 
    221221                                        scale  = sy; 
    222                                         offset = ("offset" in axis ? axis.offset : 0) + dy / s / scale; 
     222                                        offset = dy / s / scale; 
    223223                                }else{ 
    224224                                        scale  = sx; 
    225                                         offset = ("offset" in axis ? axis.offset : 0) + dx / s / scale; 
     225                                        offset = dx / s / scale; 
    226226                                } 
    227227                                axis.setWindow(scale, offset); 
  • dojox/trunk/charting/plot2d/Bars.js

    r13715 r13716  
    4040                }, 
    4141                render: function(dim, offsets){ 
     42                        this.dirty = this.isDirty(); 
    4243                        if(this.dirty){ 
    4344                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/Base.js

    r13715 r13716  
    2525        calculateAxes: function(dim){ 
    2626                return this; 
     27        }, 
     28        isDirty: function(){ 
     29                return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty; 
    2730        }, 
    2831        render: function(dim, offsets){ 
  • dojox/trunk/charting/plot2d/Bubble.js

    r13715 r13716  
    1717                //      override the render so that we are plotting only circles. 
    1818                render: function(dim, offsets){ 
     19                        this.dirty = this.isDirty(); 
    1920                        if(this.dirty){ 
    2021                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/ClusteredBars.js

    r13715 r13716  
    1313        dojo.declare("dojox.charting.plot2d.ClusteredBars", dojox.charting.plot2d.Bars, { 
    1414                render: function(dim, offsets){ 
     15                        this.dirty = this.isDirty(); 
    1516                        if(this.dirty){ 
    1617                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/ClusteredColumns.js

    r13715 r13716  
    1313        dojo.declare("dojox.charting.plot2d.ClusteredColumns", dojox.charting.plot2d.Columns, { 
    1414                render: function(dim, offsets){ 
     15                        this.dirty = this.isDirty(); 
    1516                        if(this.dirty){ 
    1617                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/Columns.js

    r13715 r13716  
    3838                }, 
    3939                render: function(dim, offsets){ 
     40                        this.dirty = this.isDirty(); 
    4041                        if(this.dirty){ 
    4142                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/Default.js

    r13715 r13716  
    4848                }, 
    4949                render: function(dim, offsets){ 
     50                        this.dirty = this.isDirty(); 
    5051                        if(this.dirty){ 
    5152                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/Grid.js

    r13715 r13716  
    2626                        this.hAxis = this.opt.hAxis; 
    2727                        this.vAxis = this.opt.vAxis; 
     28                        this.dirty = true; 
    2829                }, 
    2930                clear: function(){ 
     
    4748                        return this; 
    4849                }, 
     50                isDirty: function(){ 
     51                        return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty; 
     52                }, 
    4953                getRequiredColors: function(){ 
    5054                        return 0; 
     
    5256                render: function(dim, offsets){ 
    5357                        // draw horizontal stripes and lines 
     58                        this.dirty = this.isDirty(); 
    5459                        if(!this.dirty){ return this; } 
    5560                        this.cleanGroup(); 
  • dojox/trunk/charting/plot2d/Stacked.js

    r13715 r13716  
    4141                        } 
    4242                        // draw runs in backwards 
     43                        this.dirty = this.isDirty(); 
    4344                        if(this.dirty){ 
    4445                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/StackedBars.js

    r13715 r13716  
    3434                        } 
    3535                        // draw runs in backwards 
     36                        this.dirty = this.isDirty(); 
    3637                        if(this.dirty){ 
    3738                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/plot2d/StackedColumns.js

    r13715 r13716  
    3232                        } 
    3333                        // draw runs in backwards 
     34                        this.dirty = this.isDirty(); 
    3435                        if(this.dirty){ 
    3536                                dojo.forEach(this.series, purgeGroup); 
  • dojox/trunk/charting/scaler/primitive.js

    r13715 r13716  
    99                                from:  min, 
    1010                                to:    max, 
    11                                 scale: span / (max - min) 
     11                                scale: span / (max - min), 
     12                                span:  span 
    1213                        }, 
    1314                        scaler: dojox.charting.scaler.primitive