Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
YUI.add('series-cartesian', function (Y, NAME) {
2
 
3
/**
4
 * Provides functionality for creating a cartesian chart series.
5
 *
6
 * @module charts
7
 * @submodule series-cartesian
8
 */
9
var Y_Lang = Y.Lang;
10
 
11
/**
12
 * An abstract class for creating series instances with horizontal and vertical axes.
13
 * CartesianSeries provides the core functionality used by the following classes:
14
 * <ul>
15
 *      <li>{{#crossLink "LineSeries"}}{{/crossLink}}</li>
16
 *      <li>{{#crossLink "MarkerSeries"}}{{/crossLink}}</li>
17
 *      <li>{{#crossLink "AreaSeries"}}{{/crossLink}}</li>
18
 *      <li>{{#crossLink "SplineSeries"}}{{/crossLink}}</li>
19
 *      <li>{{#crossLink "AreaSplineSeries"}}{{/crossLink}}</li>
20
 *      <li>{{#crossLink "ComboSeries"}}{{/crossLink}}</li>
21
 *      <li>{{#crossLink "ComboSplineSeries"}}{{/crossLink}}</li>
22
 *      <li>{{#crossLink "Histogram"}}{{/crossLink}}</li>
23
 *  </ul>
24
 *
25
 * @class CartesianSeries
26
 * @extends SeriesBase
27
 * @constructor
28
 * @param {Object} config (optional) Configuration parameters.
29
 * @submodule series-base
30
 */
31
Y.CartesianSeries = Y.Base.create("cartesianSeries", Y.SeriesBase, [], {
32
    /**
33
     * Storage for `xDisplayName` attribute.
34
     *
35
     * @property _xDisplayName
36
     * @type String
37
     * @private
38
     */
39
    _xDisplayName: null,
40
 
41
    /**
42
     * Storage for `yDisplayName` attribute.
43
     *
44
     * @property _yDisplayName
45
     * @type String
46
     * @private
47
     */
48
    _yDisplayName: null,
49
 
50
    /**
51
     * Th x-coordinate for the left edge of the series.
52
     *
53
     * @property _leftOrigin
54
     * @type String
55
     * @private
56
     */
57
    _leftOrigin: null,
58
 
59
    /**
60
     * The y-coordinate for the bottom edge of the series.
61
     *
62
     * @property _bottomOrigin
63
     * @type String
64
     * @private
65
     */
66
    _bottomOrigin: null,
67
 
68
    /**
69
     * Adds event listeners.
70
     *
71
     * @method addListeners
72
     * @private
73
     */
74
    addListeners: function()
75
    {
76
        var xAxis = this.get("xAxis"),
77
            yAxis = this.get("yAxis");
78
        if(xAxis)
79
        {
80
            this._xDataReadyHandle = xAxis.after("dataReady", Y.bind(this._xDataChangeHandler, this));
81
            this._xDataUpdateHandle = xAxis.after("dataUpdate", Y.bind(this._xDataChangeHandler, this));
82
        }
83
        if(yAxis)
84
        {
85
            this._yDataReadyHandle = yAxis.after("dataReady", Y.bind(this._yDataChangeHandler, this));
86
            this._yDataUpdateHandle = yAxis.after("dataUpdate", Y.bind(this._yDataChangeHandler, this));
87
        }
88
        this._xAxisChangeHandle = this.after("xAxisChange", this._xAxisChangeHandler);
89
        this._yAxisChangeHandle = this.after("yAxisChange", this._yAxisChangeHandler);
90
        this._stylesChangeHandle = this.after("stylesChange", function() {
91
            var axesReady = this._updateAxisBase();
92
            if(axesReady)
93
            {
94
                this.draw();
95
            }
96
        });
97
        this._widthChangeHandle = this.after("widthChange", function() {
98
            var axesReady = this._updateAxisBase();
99
            if(axesReady)
100
            {
101
                this.draw();
102
            }
103
        });
104
        this._heightChangeHandle = this.after("heightChange", function() {
105
            var axesReady = this._updateAxisBase();
106
            if(axesReady)
107
            {
108
                this.draw();
109
            }
110
        });
111
        this._visibleChangeHandle = this.after("visibleChange", this._handleVisibleChange);
112
    },
113
 
114
    /**
115
     * Event handler for the xAxisChange event.
116
     *
117
     * @method _xAxisChangeHandler
118
     * @param {Object} e Event object.
119
     * @private
120
     */
121
    _xAxisChangeHandler: function()
122
    {
123
        var xAxis = this.get("xAxis");
124
        xAxis.after("dataReady", Y.bind(this._xDataChangeHandler, this));
125
        xAxis.after("dataUpdate", Y.bind(this._xDataChangeHandler, this));
126
    },
127
 
128
    /**
129
     * Event handler the yAxisChange event.
130
     *
131
     * @method _yAxisChangeHandler
132
     * @param {Object} e Event object.
133
     * @private
134
     */
135
    _yAxisChangeHandler: function()
136
    {
137
        var yAxis = this.get("yAxis");
138
        yAxis.after("dataReady", Y.bind(this._yDataChangeHandler, this));
139
        yAxis.after("dataUpdate", Y.bind(this._yDataChangeHandler, this));
140
    },
141
 
142
    /**
143
     * Constant used to generate unique id.
144
     *
145
     * @property GUID
146
     * @type String
147
     * @private
148
     */
149
    GUID: "yuicartesianseries",
150
 
151
    /**
152
     * Event handler for xDataChange event.
153
     *
154
     * @method _xDataChangeHandler
155
     * @param {Object} event Event object.
156
     * @private
157
     */
158
    _xDataChangeHandler: function()
159
    {
160
        var axesReady = this._updateAxisBase();
161
        if(axesReady)
162
        {
163
            this.draw();
164
        }
165
    },
166
 
167
    /**
168
     * Event handler for yDataChange event.
169
     *
170
     * @method _yDataChangeHandler
171
     * @param {Object} event Event object.
172
     * @private
173
     */
174
    _yDataChangeHandler: function()
175
    {
176
        var axesReady = this._updateAxisBase();
177
        if(axesReady)
178
        {
179
            this.draw();
180
        }
181
    },
182
 
183
    /**
184
     * Checks to ensure that both xAxis and yAxis data are available. If so, set the `xData` and `yData` attributes
185
     * and return `true`. Otherwise, return `false`.
186
     *
187
     * @method _updateAxisBase
188
     * @return Boolean
189
     * @private
190
     */
191
    _updateAxisBase: function()
192
    {
193
        var xAxis = this.get("xAxis"),
194
            yAxis = this.get("yAxis"),
195
            xKey = this.get("xKey"),
196
            yKey = this.get("yKey"),
197
            yData,
198
            xData,
199
            xReady,
200
            yReady,
201
            ready;
202
        if(!xAxis || !yAxis || !xKey || !yKey)
203
        {
204
            ready = false;
205
        }
206
        else
207
        {
208
            xData = xAxis.getDataByKey(xKey);
209
            yData = yAxis.getDataByKey(yKey);
210
            if(Y_Lang.isArray(xKey))
211
            {
212
                xReady = (xData && Y.Object.size(xData) > 0) ? this._checkForDataByKey(xData, xKey) : false;
213
            }
214
            else
215
            {
216
                xReady = xData ? true : false;
217
            }
218
            if(Y_Lang.isArray(yKey))
219
            {
220
                yReady = (yData && Y.Object.size(yData) > 0) ? this._checkForDataByKey(yData, yKey) : false;
221
            }
222
            else
223
            {
224
                yReady = yData ? true : false;
225
            }
226
            ready = xReady && yReady;
227
            if(ready)
228
            {
229
                this.set("xData", xData);
230
                this.set("yData", yData);
231
            }
232
        }
233
        return ready;
234
    },
235
 
236
    /**
237
     * Checks to see if all keys of a data object exist and contain data.
238
     *
239
     * @method _checkForDataByKey
240
     * @param {Object} obj The object to check
241
     * @param {Array} keys The keys to check
242
     * @return Boolean
243
     * @private
244
     */
245
    _checkForDataByKey: function(obj, keys)
246
    {
247
        var i,
248
            len = keys.length,
249
            hasData = false;
250
        for(i = 0; i < len; i = i + 1)
251
        {
252
            if(obj[keys[i]])
253
            {
254
                hasData = true;
255
                break;
256
            }
257
        }
258
        return hasData;
259
    },
260
 
261
    /**
262
     * Draws the series is the xAxis and yAxis data are both available.
263
     *
264
     * @method validate
265
     * @private
266
     */
267
    validate: function()
268
    {
269
        if((this.get("xData") && this.get("yData")) || this._updateAxisBase())
270
        {
271
            this.draw();
272
        }
273
        else
274
        {
275
            this.fire("drawingComplete");
276
        }
277
    },
278
 
279
    /**
280
     * Calculates the coordinates for the series.
281
     *
282
     * @method setAreaData
283
     * @protected
284
     */
285
    setAreaData: function()
286
    {
287
        var w = this.get("width"),
288
            h = this.get("height"),
289
            xAxis = this.get("xAxis"),
290
            yAxis = this.get("yAxis"),
291
            xData = this._copyData(this.get("xData")),
292
            yData = this._copyData(this.get("yData")),
293
            direction = this.get("direction"),
294
            dataLength = direction === "vertical" ? yData.length : xData.length,
295
            xOffset = xAxis.getEdgeOffset(xAxis.getTotalMajorUnits(), w),
296
            yOffset = yAxis.getEdgeOffset(yAxis.getTotalMajorUnits(), h),
297
            padding = this.get("styles").padding,
298
			leftPadding = padding.left,
299
			topPadding = padding.top,
300
			dataWidth = w - (leftPadding + padding.right + xOffset * 2),
301
			dataHeight = h - (topPadding + padding.bottom + yOffset * 2),
302
			xMax = xAxis.get("maximum"),
303
			xMin = xAxis.get("minimum"),
304
			yMax = yAxis.get("maximum"),
305
			yMin = yAxis.get("minimum"),
306
            graphic = this.get("graphic"),
307
            yAxisType = yAxis.get("type"),
308
            reverseYCoords = (yAxisType === "numeric" || yAxisType === "stacked"),
309
            xcoords,
310
            ycoords,
311
            xOriginValue = xAxis.getOrigin(),
312
            yOriginValue = yAxis.getOrigin();
313
        graphic.set("width", w);
314
        graphic.set("height", h);
315
        xOffset = xOffset + leftPadding;
316
        yOffset = reverseYCoords ? yOffset + dataHeight + topPadding + padding.bottom : topPadding + yOffset;
317
        this._leftOrigin = Math.round(xAxis._getCoordFromValue(xMin, xMax, dataWidth, xOriginValue, xOffset, false));
318
        this._bottomOrigin = Math.round(yAxis._getCoordFromValue(yMin, yMax, dataHeight, yOriginValue, yOffset, reverseYCoords));
319
 
320
        xcoords = this._getCoords(xMin, xMax, dataWidth, xData, xAxis, xOffset, false);
321
        ycoords = this._getCoords(yMin, yMax, dataHeight, yData, yAxis, yOffset, reverseYCoords);
322
        this.set("xcoords", xcoords);
323
		this.set("ycoords", ycoords);
324
        this._dataLength = dataLength;
325
        this._setXMarkerPlane(xcoords, dataLength);
326
        this._setYMarkerPlane(ycoords, dataLength);
327
    },
328
 
329
    /**
330
     * Returns either an array coordinates or an object key valued arrays of coordinates depending on the input.
331
     * If the input data is an array, an array is returned. If the input data is an object, an object will be returned.
332
     *
333
     * @method _getCoords
334
     * @param {Number} min The minimum value of the range of data.
335
     * @param {Number} max The maximum value of the range of data.
336
     * @param {Number} length The length, in pixels, of across which the coordinates will be calculated.
337
     * @param {AxisBase} axis The axis in which the data is bound.
338
     * @param {Number} offset The value in which to offet the first coordinate.
339
     * @param {Boolean} reverse Indicates whether to calculate the coordinates in reverse order.
340
     * @return Array|Object
341
     * @private
342
     */
343
    _getCoords: function(min, max, length, data, axis, offset, reverse)
344
    {
345
        var coords,
346
            key;
347
        if(Y_Lang.isArray(data))
348
        {
349
            coords = axis._getCoordsFromValues(min, max, length, data, offset, reverse);
350
        }
351
        else
352
        {
353
            coords = {};
354
            for(key in data)
355
            {
356
                if(data.hasOwnProperty(key))
357
                {
358
                    coords[key] = this._getCoords.apply(this, [min, max, length, data[key], axis, offset, reverse]);
359
                }
360
            }
361
        }
362
        return coords;
363
    },
364
 
365
    /**
366
     * Used to cache xData and yData in the setAreaData method. Returns a copy of an
367
     * array if an array is received as the param and returns an object literal of
368
     * array copies if an object literal is received as the param.
369
     *
370
     * @method _copyData
371
     * @param {Array|Object} val The object or array to be copied.
372
     * @return Array|Object
373
     * @private
374
     */
375
    _copyData: function(val)
376
    {
377
        var copy,
378
            key;
379
        if(Y_Lang.isArray(val))
380
        {
381
            copy = val.concat();
382
        }
383
        else
384
        {
385
            copy = {};
386
            for(key in val)
387
            {
388
                if(val.hasOwnProperty(key))
389
                {
390
                    copy[key] = val[key].concat();
391
                }
392
            }
393
        }
394
        return copy;
395
    },
396
 
397
    /**
398
     * Sets the marker plane for the series when the coords argument is an array.
399
     * If the coords argument is an object literal no marker plane is set.
400
     *
401
     * @method _setXMarkerPlane
402
     * @param {Array|Object} coords An array of x coordinates or an object literal
403
     * containing key value pairs mapped to an array of coordinates.
404
     * @param {Number} dataLength The length of data for the series.
405
     * @private
406
     */
407
    _setXMarkerPlane: function(coords, dataLength)
408
    {
409
        var i = 0,
410
            xMarkerPlane = [],
411
            xMarkerPlaneOffset = this.get("xMarkerPlaneOffset"),
412
            nextX;
413
        if(Y_Lang.isArray(coords))
414
        {
415
            for(i = 0; i < dataLength; i = i + 1)
416
            {
417
                nextX = coords[i];
418
                xMarkerPlane.push({start:nextX - xMarkerPlaneOffset, end: nextX + xMarkerPlaneOffset});
419
            }
420
            this.set("xMarkerPlane", xMarkerPlane);
421
        }
422
    },
423
 
424
    /**
425
     * Sets the marker plane for the series when the coords argument is an array.
426
     * If the coords argument is an object literal no marker plane is set.
427
     *
428
     * @method _setYMarkerPlane
429
     * @param {Array|Object} coords An array of y coordinates or an object literal
430
     * containing key value pairs mapped to an array of coordinates.
431
     * @param {Number} dataLength The length of data for the series.
432
     * @private
433
     */
434
    _setYMarkerPlane: function(coords, dataLength)
435
    {
436
        var i = 0,
437
            yMarkerPlane = [],
438
            yMarkerPlaneOffset = this.get("yMarkerPlaneOffset"),
439
            nextY;
440
        if(Y_Lang.isArray(coords))
441
        {
442
            for(i = 0; i < dataLength; i = i + 1)
443
            {
444
                nextY = coords[i];
445
                yMarkerPlane.push({start:nextY - yMarkerPlaneOffset, end: nextY + yMarkerPlaneOffset});
446
            }
447
            this.set("yMarkerPlane", yMarkerPlane);
448
        }
449
    },
450
 
451
    /**
452
     * Finds the first valid index of an array coordinates.
453
     *
454
     * @method _getFirstValidIndex
455
     * @param {Array} coords An array of x or y coordinates.
456
     * @return Number
457
     * @private
458
     */
459
    _getFirstValidIndex: function(coords)
460
    {
461
        var coord,
462
            i = -1,
463
            limit = coords.length;
464
        while(!Y_Lang.isNumber(coord) && i < limit)
465
        {
466
            i += 1;
467
            coord = coords[i];
468
        }
469
        return i;
470
    },
471
 
472
    /**
473
     * Finds the last valid index of an array coordinates.
474
     *
475
     * @method _getLastValidIndex
476
     * @param {Array} coords An array of x or y coordinates.
477
     * @return Number
478
     * @private
479
     */
480
    _getLastValidIndex: function(coords)
481
    {
482
        var coord,
483
            i = coords.length,
484
            limit = -1;
485
        while(!Y_Lang.isNumber(coord) && i > limit)
486
        {
487
            i -= 1;
488
            coord = coords[i];
489
        }
490
        return i;
491
    },
492
 
493
    /**
494
     * Draws the series.
495
     *
496
     * @method draw
497
     * @protected
498
     */
499
    draw: function()
500
    {
501
        var w = this.get("width"),
502
            h = this.get("height"),
503
            xcoords,
504
            ycoords;
505
        if(this.get("rendered"))
506
        {
507
            if((isFinite(w) && isFinite(h) && w > 0 && h > 0) &&
508
                ((this.get("xData") && this.get("yData")) ||
509
                this._updateAxisBase()))
510
            {
511
                if(this._drawing)
512
                {
513
                    this._callLater = true;
514
                    return;
515
                }
516
                this._drawing = true;
517
                this._callLater = false;
518
                this.setAreaData();
519
                xcoords = this.get("xcoords");
520
                ycoords = this.get("ycoords");
521
                if(xcoords && ycoords && xcoords.length > 0)
522
                {
523
                    this.drawSeries();
524
                }
525
                this._drawing = false;
526
                if(this._callLater)
527
                {
528
                    this.draw();
529
                }
530
                else
531
                {
532
                    this._toggleVisible(this.get("visible"));
533
                    this.fire("drawingComplete");
534
                }
535
            }
536
        }
537
    },
538
 
539
    /**
540
     * Default value for plane offsets when the parent chart's `interactiveType` is `planar`.
541
     *
542
     * @property _defaultPlaneOffset
543
     * @type Number
544
     * @private
545
     */
546
    _defaultPlaneOffset: 4,
547
 
548
    /**
549
     * Destructor implementation for the CartesianSeries class.
550
     * Calls destroy on all Graphic instances.
551
     *
552
     * @method destructor
553
     * @protected
554
     */
555
    destructor: function()
556
    {
557
        if(this.get("rendered"))
558
        {
559
            if(this._xDataReadyHandle)
560
            {
561
                this._xDataReadyHandle.detach();
562
            }
563
            if(this._xDataUpdateHandle)
564
            {
565
                this._xDataUpdateHandle.detach();
566
            }
567
            if(this._yDataReadyHandle)
568
            {
569
                this._yDataReadyHandle.detach();
570
            }
571
            if(this._yDataUpdateHandle)
572
            {
573
                this._yDataUpdateHandle.detach();
574
            }
575
            if(this._xAxisChangeHandle)
576
            {
577
                this._xAxisChangeHandle.detach();
578
            }
579
            if(this._yAxisChangeHandle)
580
            {
581
                this._yAxisChangeHandle.detach();
582
            }
583
        }
584
    }
585
        /**
586
         * Event handle for the x-axis' dataReady event.
587
         *
588
         * @property _xDataReadyHandle
589
         * @type {EventHandle}
590
         * @private
591
         */
592
 
593
        /**
594
         * Event handle for the x-axis dataUpdate event.
595
         *
596
         * @property _xDataUpdateHandle
597
         * @type {EventHandle}
598
         * @private
599
         */
600
 
601
        /**
602
         * Event handle for the y-axis dataReady event.
603
         *
604
         * @property _yDataReadyHandle
605
         * @type {EventHandle}
606
         * @private
607
         */
608
 
609
        /**
610
         * Event handle for the y-axis dataUpdate event.
611
         * @property _yDataUpdateHandle
612
         * @type {EventHandle}
613
         * @private
614
         */
615
 
616
        /**
617
         * Event handle for the xAxisChange event.
618
         * @property _xAxisChangeHandle
619
         * @type {EventHandle}
620
         * @private
621
         */
622
 
623
        /**
624
         * Event handle for the yAxisChange event.
625
         * @property _yAxisChangeHandle
626
         * @type {EventHandle}
627
         * @private
628
         */
629
 
630
        /**
631
         * Event handle for the stylesChange event.
632
         * @property _stylesChangeHandle
633
         * @type {EventHandle}
634
         * @private
635
         */
636
 
637
        /**
638
         * Event handle for the widthChange event.
639
         * @property _widthChangeHandle
640
         * @type {EventHandle}
641
         * @private
642
         */
643
 
644
        /**
645
         * Event handle for the heightChange event.
646
         * @property _heightChangeHandle
647
         * @type {EventHandle}
648
         * @private
649
         */
650
 
651
        /**
652
         * Event handle for the visibleChange event.
653
         * @property _visibleChangeHandle
654
         * @type {EventHandle}
655
         * @private
656
         */
657
}, {
658
    ATTRS: {
659
        /**
660
         * An array of all series of the same type used within a chart application.
661
         *
662
         * @attribute seriesTypeCollection
663
         * @type Array
664
         */
665
        seriesTypeCollection: {},
666
 
667
        /**
668
         * Name used for for displaying data related to the x-coordinate.
669
         *
670
         * @attribute xDisplayName
671
         * @type String
672
         */
673
        xDisplayName: {
674
            getter: function()
675
            {
676
                return this._xDisplayName || this.get("xKey");
677
            },
678
 
679
            setter: function(val)
680
            {
681
                this._xDisplayName = val.toString();
682
                return val;
683
            }
684
        },
685
 
686
        /**
687
         * Name used for for displaying data related to the y-coordinate.
688
         *
689
         * @attribute yDisplayName
690
         * @type String
691
         */
692
        yDisplayName: {
693
            getter: function()
694
            {
695
                return this._yDisplayName || this.get("yKey");
696
            },
697
 
698
            setter: function(val)
699
            {
700
                this._yDisplayName = val.toString();
701
                return val;
702
            }
703
        },
704
 
705
        /**
706
         * Name used for for displaying category data
707
         *
708
         * @attribute categoryDisplayName
709
         * @type String
710
         * @readOnly
711
         */
712
        categoryDisplayName: {
713
            lazyAdd: false,
714
 
715
            getter: function()
716
            {
717
                return this.get("direction") === "vertical" ? this.get("yDisplayName") : this.get("xDisplayName");
718
            },
719
 
720
            setter: function(val)
721
            {
722
                if(this.get("direction") === "vertical")
723
                {
724
                    this._yDisplayName = val;
725
                }
726
                else
727
                {
728
                    this._xDisplayName = val;
729
                }
730
                return val;
731
            }
732
        },
733
 
734
        /**
735
         * Name used for for displaying value data
736
         *
737
         * @attribute valueDisplayName
738
         * @type String
739
         * @readOnly
740
         */
741
        valueDisplayName: {
742
            lazyAdd: false,
743
 
744
            getter: function()
745
            {
746
                return this.get("direction") === "vertical" ? this.get("xDisplayName") : this.get("yDisplayName");
747
            },
748
 
749
            setter: function(val)
750
            {
751
                if(this.get("direction") === "vertical")
752
                {
753
                    this._xDisplayName = val;
754
                }
755
                else
756
                {
757
                    this._yDisplayName = val;
758
                }
759
                return val;
760
            }
761
        },
762
 
763
        /**
764
         * Read-only attribute indicating the type of series.
765
         *
766
         * @attribute type
767
         * @type String
768
         * @default cartesian
769
         */
770
        type: {
771
            value: "cartesian"
772
        },
773
 
774
        /**
775
         * Order of this instance of this `type`.
776
         *
777
         * @attribute order
778
         * @type Number
779
         */
780
        order: {},
781
 
782
        /**
783
         * Order of the instance
784
         *
785
         * @attribute graphOrder
786
         * @type Number
787
         */
788
        graphOrder: {},
789
 
790
        /**
791
         * x coordinates for the series.
792
         *
793
         * @attribute xcoords
794
         * @type Array
795
         */
796
        xcoords: {},
797
 
798
        /**
799
         * y coordinates for the series
800
         *
801
         * @attribute ycoords
802
         * @type Array
803
         */
804
        ycoords: {},
805
 
806
        /**
807
         * Reference to the `Axis` instance used for assigning
808
         * x-values to the graph.
809
         *
810
         * @attribute xAxis
811
         * @type Axis
812
         */
813
        xAxis: {},
814
 
815
        /**
816
         * Reference to the `Axis` instance used for assigning
817
         * y-values to the graph.
818
         *
819
         * @attribute yAxis
820
         * @type Axis
821
         */
822
        yAxis: {},
823
 
824
        /**
825
         * Indicates which array to from the hash of value arrays in
826
         * the x-axis `Axis` instance.
827
         *
828
         * @attribute xKey
829
         * @type String
830
         */
831
        xKey: {
832
            setter: function(val)
833
            {
834
                if(Y_Lang.isArray(val))
835
                {
836
                    return val;
837
                }
838
                else
839
                {
840
                    return val.toString();
841
                }
842
            }
843
        },
844
 
845
        /**
846
         * Indicates which array to from the hash of value arrays in
847
         * the y-axis `Axis` instance.
848
         *
849
         * @attribute yKey
850
         * @type String
851
         */
852
        yKey: {
853
            setter: function(val)
854
            {
855
                if(Y_Lang.isArray(val))
856
                {
857
                    return val;
858
                }
859
                else
860
                {
861
                    return val.toString();
862
                }
863
            }
864
        },
865
 
866
        /**
867
         * Array of x values for the series.
868
         *
869
         * @attribute xData
870
         * @type Array
871
         */
872
        xData: {},
873
 
874
        /**
875
         * Array of y values for the series.
876
         *
877
         * @attribute yData
878
         * @type Array
879
         */
880
        yData: {},
881
 
882
        /**
883
         * Collection of area maps along the xAxis. Used to determine mouseover for multiple
884
         * series.
885
         *
886
         * @attribute xMarkerPlane
887
         * @type Array
888
         */
889
        xMarkerPlane: {},
890
 
891
        /**
892
         * Collection of area maps along the yAxis. Used to determine mouseover for multiple
893
         * series.
894
         *
895
         * @attribute yMarkerPlane
896
         * @type Array
897
         */
898
        yMarkerPlane: {},
899
 
900
        /**
901
         * Distance from a data coordinate to the left/right for setting a hotspot.
902
         *
903
         * @attribute xMarkerPlaneOffset
904
         * @type Number
905
         */
906
        xMarkerPlaneOffset: {
907
            getter: function() {
908
                var marker = this.get("styles").marker;
909
                if(marker && marker.width && isFinite(marker.width))
910
                {
911
                    return marker.width * 0.5;
912
                }
913
                return this._defaultPlaneOffset;
914
            }
915
        },
916
 
917
        /**
918
         * Distance from a data coordinate to the top/bottom for setting a hotspot.
919
         *
920
         * @attribute yMarkerPlaneOffset
921
         * @type Number
922
         */
923
        yMarkerPlaneOffset: {
924
            getter: function() {
925
                var marker = this.get("styles").marker;
926
                if(marker && marker.height && isFinite(marker.height))
927
                {
928
                    return marker.height * 0.5;
929
                }
930
                return this._defaultPlaneOffset;
931
            }
932
        },
933
 
934
        /**
935
         * Direction of the series
936
         *
937
         * @attribute direction
938
         * @type String
939
         */
940
        direction: {
941
            value: "horizontal"
942
        }
943
    }
944
});
945
 
946
 
947
}, '3.18.1', {"requires": ["series-base"]});