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