|
1 YUI.add('series-area', function (Y, NAME) { |
|
2 |
|
3 /** |
|
4 * Provides functionality for creating a area series. |
|
5 * |
|
6 * @module charts |
|
7 * @submodule series-area |
|
8 */ |
|
9 /** |
|
10 * The AreaSeries class renders quantitative data on a graph by creating a fill between 0 |
|
11 * and the relevant data points. |
|
12 * |
|
13 * @class AreaSeries |
|
14 * @extends CartesianSeries |
|
15 * @uses Fills |
|
16 * @constructor |
|
17 * @param {Object} config (optional) Configuration parameters. |
|
18 * @submodule series-area |
|
19 */ |
|
20 Y.AreaSeries = Y.Base.create("areaSeries", Y.CartesianSeries, [Y.Fills], { |
|
21 /** |
|
22 * @protected |
|
23 * |
|
24 * Renders the series. |
|
25 * |
|
26 * @method drawSeries |
|
27 */ |
|
28 drawSeries: function() |
|
29 { |
|
30 this.drawFill.apply(this, this._getClosingPoints()); |
|
31 }, |
|
32 |
|
33 /** |
|
34 * @protected |
|
35 * |
|
36 * Method used by `styles` setter. Overrides base implementation. |
|
37 * |
|
38 * @method _setStyles |
|
39 * @param {Object} newStyles Hash of properties to update. |
|
40 * @return Object |
|
41 */ |
|
42 _setStyles: function(val) |
|
43 { |
|
44 if(!val.area) |
|
45 { |
|
46 val = {area:val}; |
|
47 } |
|
48 return Y.AreaSeries.superclass._setStyles.apply(this, [val]); |
|
49 }, |
|
50 |
|
51 /** |
|
52 * @protected |
|
53 * |
|
54 * Gets the default value for the `styles` attribute. Overrides |
|
55 * base implementation. |
|
56 * |
|
57 * @method _getDefaultStyles |
|
58 * @return Object |
|
59 */ |
|
60 _getDefaultStyles: function() |
|
61 { |
|
62 var styles = this._mergeStyles({area:this._getAreaDefaults()}, Y.AreaSeries.superclass._getDefaultStyles()); |
|
63 return styles; |
|
64 } |
|
65 }, |
|
66 { |
|
67 ATTRS: { |
|
68 /** |
|
69 * Read-only attribute indicating the type of series. |
|
70 * |
|
71 * @attribute type |
|
72 * @type String |
|
73 * @default area |
|
74 */ |
|
75 type: { |
|
76 value:"area" |
|
77 } |
|
78 |
|
79 /** |
|
80 * Style properties used for drawing area fills. This attribute is inherited from `Renderer`. Below are the default values: |
|
81 * |
|
82 * <dl> |
|
83 * <dt>color</dt><dd>The color of the fill. The default value is determined by the order of the series on the graph. The color will be |
|
84 * retrieved from the following array: |
|
85 * `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]` |
|
86 * </dd> |
|
87 * <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1</dd> |
|
88 * </dl> |
|
89 * |
|
90 * @attribute styles |
|
91 * @type Object |
|
92 */ |
|
93 } |
|
94 }); |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 }, '@VERSION@', {"requires": ["series-cartesian", "series-fill-util"]}); |