source: Dev/branches/rest-dojo-ui/client/dojox/charting/Series.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.0 KB
Line 
1define(["dojo/_base/lang", "dojo/_base/declare", "./Element"],
2        function(lang, declare, Element){
3        /*=====
4        dojox.charting.__SeriesCtorArgs = function(plot){
5                //      summary:
6                //              An optional arguments object that can be used in the Series constructor.
7                //      plot: String?
8                //              The plot (by name) that this series belongs to.
9                this.plot = plot;
10        }
11
12        var Element = dojox.charting.Element;
13        =====*/
14        return declare("dojox.charting.Series", Element, {
15                //      summary:
16                //              An object representing a series of data for plotting on a chart.
17                constructor: function(chart, data, kwArgs){
18                        //      summary:
19                        //              Create a new data series object for use within charting.
20                        //      chart: dojox.charting.Chart
21                        //              The chart that this series belongs to.
22                        //      data: Array|Object:
23                        //              The array of data points (either numbers or objects) that
24                        //              represents the data to be drawn. Or it can be an object. In
25                        //              the latter case, it should have a property "data" (an array),
26                        //              destroy(), and setSeriesObject().
27                        //      kwArgs: dojox.charting.__SeriesCtorArgs?
28                        //              An optional keyword arguments object to set details for this series.
29                        lang.mixin(this, kwArgs);
30                        if(typeof this.plot != "string"){ this.plot = "default"; }
31                        this.update(data);
32                },
33       
34                clear: function(){
35                        //      summary:
36                        //              Clear the calculated additional parameters set on this series.
37                        this.dyn = {};
38                },
39               
40                update: function(data){
41                        //      summary:
42                        //              Set data and make this object dirty, so it can be redrawn.
43                        //      data: Array|Object:
44                        //              The array of data points (either numbers or objects) that
45                        //              represents the data to be drawn. Or it can be an object. In
46                        //              the latter case, it should have a property "data" (an array),
47                        //              destroy(), and setSeriesObject().
48                        if(lang.isArray(data)){
49                                this.data = data;
50                        }else{
51                                this.source = data;
52                                this.data = this.source.data;
53                                if(this.source.setSeriesObject){
54                                        this.source.setSeriesObject(this);
55                                }
56                        }
57                        this.dirty = true;
58                        this.clear();
59                }
60        });
61
62});
Note: See TracBrowser for help on using the repository browser.