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