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/
8
YUI.add('series-column', function (Y, NAME) {
11
* Provides functionality for creating a column series.
14
* @submodule series-column
17
* The ColumnSeries class renders columns positioned horizontally along a category or time axis. The columns'
18
* lengths are proportional to the values they represent along a vertical axis.
19
* and the relevant data points.
22
* @extends MarkerSeries
25
* @param {Object} config (optional) Configuration parameters.
26
* @submodule series-column
28
Y.ColumnSeries = Y.Base.create("columnSeries", Y.MarkerSeries, [Y.Histogram], {
30
* Helper method for calculating the size of markers.
32
* @method _getMarkerDimensions
33
* @param {Number} xcoord The x-coordinate representing the data point for the marker.
34
* @param {Number} ycoord The y-coordinate representing the data point for the marker.
35
* @param {Number} calculatedSize The calculated size for the marker. For a `BarSeries` is it the width. For a `ColumnSeries` it is the height.
36
* @param {Number} offset Distance of position offset dictated by other marker series in the same graph.
40
_getMarkerDimensions: function(xcoord, ycoord, calculatedSize, offset)
45
if(this._bottomOrigin >= ycoord)
48
config.calculatedSize = this._bottomOrigin - config.top;
52
config.top = this._bottomOrigin;
53
config.calculatedSize = ycoord - this._bottomOrigin;
59
* Resizes and positions markers based on a mouse interaction.
61
* @method updateMarkerState
62
* @param {String} type state of the marker
63
* @param {Number} i index of the marker
66
updateMarkerState: function(type, i)
68
if(this._markers && this._markers[i])
70
var styles = Y.clone(this.get("styles").marker),
72
state = this._getState(type),
73
xcoords = this.get("xcoords"),
74
ycoords = this.get("ycoords"),
75
marker = this._markers[i],
78
seriesCollection = this.get("seriesTypeCollection"),
79
seriesLen = seriesCollection.length,
85
order = this.get("order"),
87
markerStyles = state === "off" || !styles[state] ? Y.clone(styles) : Y.clone(styles[state]);
88
markerStyles.fill.color = this._getItemColor(markerStyles.fill.color, i);
89
markerStyles.border.color = this._getItemColor(markerStyles.border.color, i);
90
config = this._getMarkerDimensions(xcoords[i], ycoords[i], styles.width, offset);
91
markerStyles.height = config.calculatedSize;
92
markerStyles.width = Math.min(this._maxSize, markerStyles.width);
93
marker.set(markerStyles);
94
for(; n < seriesLen; ++n)
96
xs[n] = xcoords[i] + seriesSize;
97
seriesStyles = seriesCollection[n].get("styles").marker;
98
seriesSize += Math.min(this._maxSize, seriesStyles.width);
103
offset -= seriesSize/2;
105
for(n = 0; n < seriesLen; ++n)
107
markers = seriesCollection[n].get("markers");
110
renderer = markers[i];
111
if(renderer && renderer !== undefined)
113
renderer.set("x", (xs[n] - seriesSize/2));
122
* Read-only attribute indicating the type of series.
134
* Style properties used for drawing markers. This attribute is inherited from `MarkerSeries`. Below are the default values:
136
* <dt>fill</dt><dd>A hash containing the following values:
138
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
139
* will be retrieved from the below array:<br/>
140
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
142
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
145
* <dt>border</dt><dd>A hash containing the following values:
147
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
148
* will be retrieved from the below array:<br/>
149
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
150
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
151
* <dt>weight</dt><dd>Number indicating the width of the border. The default value is 1.</dd>
154
* <dt>width</dt><dd>indicates the width of the marker. The default value is 12.</dd>
155
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
156
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
157
* the default value for `marker.over.fill.color` is equivalent to `marker.fill.color`.</dd>
167
}, '3.10.3', {"requires": ["series-marker", "series-histogram-base"]});