source: Dev/branches/rest-dojo-ui/client/dojox/charting/action2d/PlotAction.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 2.2 KB
Line 
1define(["dojo/_base/connect", "dojo/_base/declare", "./Base", "dojo/fx/easing", "dojox/lang/functional",
2                "dojox/lang/functional/object"],
3        function(hub, declare, Base, dfe, df, dlfo){
4       
5        /*=====
6        dojox.charting.action2d.__PlotActionCtorArgs = function(duration, easing){
7                //      summary:
8                //              The base keyword arguments object for creating an action2d.
9                //      duration: Number?
10                //              The amount of time in milliseconds for an animation to last.  Default is 400.
11                //      easing: dojo.fx.easing.*?
12                //              An easing object (see dojo.fx.easing) for use in an animation.  The
13                //              default is dojo.fx.easing.backOut.
14                this.duration = duration;
15                this.easing = easing;
16        }
17        var Base = dojox.charting.action2d.Base;
18        =====*/
19
20        var DEFAULT_DURATION = 400,     // ms
21                DEFAULT_EASING   = dfe.backOut;
22
23        return declare("dojox.charting.action2d.PlotAction", Base, {
24                //      summary:
25                //              Base action class for plot actions.
26
27                overOutEvents: {onmouseover: 1, onmouseout: 1},
28
29                constructor: function(chart, plot, kwargs){
30                        //      summary:
31                        //              Create a new base PlotAction.
32                        //      chart: dojox.charting.Chart
33                        //              The chart this action applies to.
34                        //      plot: String?
35                        //              The name of the plot this action belongs to.  If none is passed "default" is assumed.
36                        //      kwargs: dojox.charting.action2d.__PlotActionCtorArgs?
37                        //              Optional arguments for the action.
38                        this.anim = {};
39
40                        // process common optional named parameters
41                        if(!kwargs){ kwargs = {}; }
42                        this.duration = kwargs.duration ? kwargs.duration : DEFAULT_DURATION;
43                        this.easing   = kwargs.easing   ? kwargs.easing   : DEFAULT_EASING;
44                },
45
46                connect: function(){
47                        //      summary:
48                        //              Connect this action to the given plot.
49                        this.handle = this.chart.connectToPlot(this.plot.name, this, "process");
50                },
51
52                disconnect: function(){
53                        //      summary:
54                        //              Disconnect this action from the given plot, if connected.
55                        if(this.handle){
56                                hub.disconnect(this.handle);
57                                this.handle = null;
58                        }
59                },
60
61                reset: function(){
62                        //      summary:
63                        //              Reset the action.
64                },
65
66                destroy: function(){
67                        //      summary:
68                        //              Do any cleanup needed when destroying parent elements.
69                        this.inherited(arguments);
70                        df.forIn(this.anim, function(o){
71                                df.forIn(o, function(anim){
72                                        anim.action.stop(true);
73                                });
74                        });
75                        this.anim = {};
76                }
77        });
78});
Note: See TracBrowser for help on using the repository browser.