|
1 YUI.add('series-line', function (Y, NAME) { |
|
2 |
|
3 /** |
|
4 * Provides functionality for creating a line series. |
|
5 * |
|
6 * @module charts |
|
7 * @submodule series-line |
|
8 */ |
|
9 /** |
|
10 * The LineSeries class renders quantitative data on a graph by connecting relevant data points. |
|
11 * |
|
12 * @class LineSeries |
|
13 * @extends CartesianSeries |
|
14 * @uses Lines |
|
15 * @constructor |
|
16 * @param {Object} config (optional) Configuration parameters. |
|
17 * @submodule series-line |
|
18 */ |
|
19 Y.LineSeries = Y.Base.create("lineSeries", Y.CartesianSeries, [Y.Lines], { |
|
20 /** |
|
21 * @protected |
|
22 * |
|
23 * @method drawSeries |
|
24 */ |
|
25 drawSeries: function() |
|
26 { |
|
27 this.drawLines(); |
|
28 }, |
|
29 |
|
30 /** |
|
31 * @protected |
|
32 * |
|
33 * Method used by `styles` setter. Overrides base implementation. |
|
34 * |
|
35 * @method _setStyles |
|
36 * @param {Object} newStyles Hash of properties to update. |
|
37 * @return Object |
|
38 */ |
|
39 _setStyles: function(val) |
|
40 { |
|
41 if(!val.line) |
|
42 { |
|
43 val = {line:val}; |
|
44 } |
|
45 return Y.LineSeries.superclass._setStyles.apply(this, [val]); |
|
46 }, |
|
47 |
|
48 /** |
|
49 * @protected |
|
50 * |
|
51 * Gets the default value for the `styles` attribute. Overrides |
|
52 * base implementation. |
|
53 * |
|
54 * @method _getDefaultStyles |
|
55 * @return Object |
|
56 */ |
|
57 _getDefaultStyles: function() |
|
58 { |
|
59 var styles = this._mergeStyles({line:this._getLineDefaults()}, Y.LineSeries.superclass._getDefaultStyles()); |
|
60 return styles; |
|
61 } |
|
62 }, |
|
63 { |
|
64 ATTRS: { |
|
65 /** |
|
66 * Read-only attribute indicating the type of series. |
|
67 * |
|
68 * @attribute type |
|
69 * @type String |
|
70 * @default line |
|
71 */ |
|
72 type: { |
|
73 value:"line" |
|
74 } |
|
75 |
|
76 /** |
|
77 * Style properties used for drawing lines. This attribute is inherited from `Renderer`. Below are the |
|
78 * default values: |
|
79 * <dl> |
|
80 * <dt>color</dt><dd>The color of the line. The default value is determined by the order of the series |
|
81 * on the graph. The color will be retrieved from the following array: |
|
82 * `["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"]` |
|
83 * <dt>weight</dt><dd>Number that indicates the width of the line. The default value is 6.</dd> |
|
84 * <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the line. The default value is 1.</dd> |
|
85 * <dt>lineType</dt><dd>Indicates whether the line is solid or dashed. The default value is solid.</dd> |
|
86 * <dt>dashLength</dt><dd>When the `lineType` is dashed, indicates the length of the dash. The default |
|
87 * value is 10.</dd> |
|
88 * <dt>gapSpace</dt><dd>When the `lineType` is dashed, indicates the distance between dashes. The default |
|
89 * value is 10.</dd> |
|
90 * <dt>connectDiscontinuousPoints</dt><dd>Indicates whether or not to connect lines when there is a missing |
|
91 * or null value between points. The default value is true.</dd> |
|
92 * <dt>discontinuousType</dt><dd>Indicates whether the line between discontinuous points is solid or dashed. |
|
93 * The default value is solid.</dd> |
|
94 * <dt>discontinuousDashLength</dt><dd>When the `discontinuousType` is dashed, indicates the length of the |
|
95 * dash. The default value is 10.</dd> |
|
96 * <dt>discontinuousGapSpace</dt><dd>When the `discontinuousType` is dashed, indicates the distance between |
|
97 * dashes. The default value is 10.</dd> |
|
98 * </dl> |
|
99 * |
|
100 * @attribute styles |
|
101 * @type Object |
|
102 */ |
|
103 } |
|
104 }); |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 }, '@VERSION@', {"requires": ["series-cartesian", "series-line-util"]}); |