<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
- <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../prettify/prettify.js"></script>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-chart-series-Series'>/**
</span> * @class Ext.chart.series.Series
- *
- * Series is the abstract class containing the common logic to all chart series. Series includes
- * methods from Labels, Highlights, Tips and Callouts mixins. This class implements the logic of handling
+ *
+ * Series is the abstract class containing the common logic to all chart series. Series includes
+ * methods from Labels, Highlights, Tips and Callouts mixins. This class implements the logic of handling
* mouse events, animating, hiding, showing all elements and returning the color of the series to be used as a legend item.
*
* ## Listeners
* xField: 'category',
* yField: 'data1'
* }]
- *
*/
Ext.define('Ext.chart.series.Series', {
/* End Definitions */
<span id='Ext-chart-series-Series-cfg-highlight'> /**
-</span> * @cfg {Boolean|Object} highlight
+</span> * @cfg {Boolean/Object} highlight
* If set to `true` it will highlight the markers or the series when hovering
* with the mouse. This parameter can also be an object with the same style
* properties you would apply to a {@link Ext.draw.Sprite} to apply custom
* An array with shadow attributes
*/
shadowAttributes: null,
-
+
//@private triggerdrawlistener flag
triggerAfterDraw: false,
<span id='Ext-chart-series-Series-cfg-listeners'> /**
-</span> * @cfg {Object} listeners
+</span> * @cfg {Object} listeners
* An (optional) object with event callbacks. All event callbacks get the target *item* as first parameter. The callback functions are:
- *
- * <ul>
- * <li>itemmouseover</li>
- * <li>itemmouseout</li>
- * <li>itemmousedown</li>
- * <li>itemmouseup</li>
- * </ul>
+ *
+ * - itemmouseover
+ * - itemmouseout
+ * - itemmousedown
+ * - itemmouseup
*/
-
+
constructor: function(config) {
var me = this;
if (config) {
Ext.apply(me, config);
}
-
+
me.shadowGroups = [];
-
+
me.mixins.labels.constructor.call(me, config);
me.mixins.highlights.constructor.call(me, config);
me.mixins.tips.constructor.call(me, config);
mouseleave: me.onMouseLeave
});
},
+
+<span id='Ext-chart-series-Series-method-eachRecord'> /**
+</span> * Iterate over each of the records for this series. The default implementation simply iterates
+ * through the entire data store, but individual series implementations can override this to
+ * provide custom handling, e.g. adding/removing records.
+ * @param {Function} fn The function to execute for each record.
+ * @param {Object} scope Scope for the fn.
+ */
+ eachRecord: function(fn, scope) {
+ var chart = this.chart;
+ (chart.substore || chart.store).each(fn, scope);
+ },
+
+<span id='Ext-chart-series-Series-method-getRecordCount'> /**
+</span> * Return the number of records being displayed in this series. Defaults to the number of
+ * records in the store; individual series implementations can override to provide custom handling.
+ */
+ getRecordCount: function() {
+ var chart = this.chart,
+ store = chart.substore || chart.store;
+ return store ? store.getCount() : 0;
+ },
+
+<span id='Ext-chart-series-Series-method-isExcluded'> /**
+</span> * Determines whether the series item at the given index has been excluded, i.e. toggled off in the legend.
+ * @param index
+ */
+ isExcluded: function(index) {
+ var excludes = this.__excludes;
+ return !!(excludes && excludes[index]);
+ },
// @private set the bbox and clipBox for the series
setBBox: function(noGutter) {
'afteranimate': function() {
me.triggerAfterDraw = false;
me.fireEvent('afterrender');
- }
- }
+ }
+ }
}));
}
},
-
+
// @private return the gutter.
getGutters: function() {
return [0, 0];
},
// @private wrapper for the itemmouseover event.
- onItemMouseOver: function(item) {
+ onItemMouseOver: function(item) {
var me = this;
if (item.series === me) {
if (me.highlight) {
* series, if any.
* @param {Number} x
* @param {Number} y
- * @return {Object} An object describing the item, or null if there is no matching item. The exact contents of
- * this object will vary by series type, but should always contain at least the following:
- * <ul>
- * <li>{Ext.chart.series.Series} series - the Series object to which the item belongs</li>
- * <li>{Object} value - the value(s) of the item's data point</li>
- * <li>{Array} point - the x/y coordinates relative to the chart box of a single point
- * for this data item, which can be used as e.g. a tooltip anchor point.</li>
- * <li>{Ext.draw.Sprite} sprite - the item's rendering Sprite.
- * </ul>
+ * @return {Object} An object describing the item, or null if there is no matching item.
+ * The exact contents of this object will vary by series type, but should always contain the following:
+ * @return {Ext.chart.series.Series} return.series the Series object to which the item belongs
+ * @return {Object} return.value the value(s) of the item's data point
+ * @return {Array} return.point the x/y coordinates relative to the chart box of a single point
+ * for this data item, which can be used as e.g. a tooltip anchor point.
+ * @return {Ext.draw.Sprite} return.sprite the item's rendering Sprite.
*/
getItemForPoint: function(x, y) {
//if there are no items to query just return null.
return items[i];
}
}
-
+
return null;
},
-
+
isItemInPoint: function(x, y, item, i) {
return false;
},
hideAll: function() {
var me = this,
items = me.items,
- item, len, i, sprite;
+ item, len, i, j, l, sprite, shadows;
me.seriesIsHidden = true;
me._prevShowMarkers = me.showMarkers;
hidden: true
}, true);
}
+
+ if (sprite && sprite.shadows) {
+ shadows = sprite.shadows;
+ for (j = 0, l = shadows.length; j < l; ++j) {
+ shadows[j].setAttributes({
+ hidden: true
+ }, true);
+ }
+ }
}
},
me.drawSeries();
me.chart.animate = prevAnimate;
},
-
+
<span id='Ext-chart-series-Series-method-getLegendColor'> /**
-</span> * Returns a string with the color to be used for the series legend item.
+</span> * Returns a string with the color to be used for the series legend item.
*/
getLegendColor: function(index) {
var me = this, fill, stroke;
}
return '#000';
},
-
+
<span id='Ext-chart-series-Series-method-visibleInLegend'> /**
</span> * Checks whether the data field should be visible in the legend
* @private