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