1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-chart.Highlight'>/**
2 </span> * @class Ext.chart.Highlight
5 Ext.define('Ext.chart.Highlight', {
7 /* Begin Definitions */
9 requires: ['Ext.fx.Anim'],
13 <span id='Ext-chart.Highlight-property-highlight'> /**
14 </span> * Highlight the given series item.
15 * @param {Boolean|Object} Default's false. Can also be an object width style properties (i.e fill, stroke, radius)
16 * or just use default styles per series by setting highlight = true.
22 constructor: function(config) {
23 if (config.highlight) {
24 if (config.highlight !== true) { //is an object
25 this.highlightCfg = Ext.apply({}, config.highlight);
38 <span id='Ext-chart.Highlight-method-highlightItem'> /**
39 </span> * Highlight the given series item.
40 * @param {Object} item Info about the item; same format as returned by #getItemForPoint.
42 highlightItem: function(item) {
49 opts = me.highlightCfg,
50 surface = me.chart.surface,
51 animate = me.chart.animate,
57 if (!me.highlight || !sprite || sprite._highlighted) {
61 sprite._anim.paused = true;
63 sprite._highlighted = true;
64 if (!sprite._defaults) {
65 sprite._defaults = Ext.apply(sprite._defaults || {},
70 if (! (p in sprite._defaults)) {
71 sprite._defaults[p] = surface.availableAttrs[p];
73 from[p] = sprite._defaults[p];
75 if (Ext.isObject(opts[p])) {
78 Ext.apply(sprite._defaults[p], sprite.attr[p]);
79 Ext.apply(from[p], sprite._defaults[p]);
80 for (pi in sprite._defaults[p]) {
81 if (! (pi in opts[p])) {
82 to[p][pi] = from[p][pi];
84 to[p][pi] = opts[p][pi];
88 if (! (pi in to[p])) {
89 to[p][pi] = opts[p][pi];
98 sprite._anim = Ext.create('Ext.fx.Anim', {
105 sprite.setAttributes(sprite._to, true);
109 <span id='Ext-chart.Highlight-method-unHighlightItem'> /**
110 </span> * Un-highlight any existing highlights
112 unHighlightItem: function() {
113 if (!this.highlight || !this.items) {
120 opts = me.highlightCfg,
121 animate = me.chart.animate,
127 for (; i < len; i++) {
131 sprite = items[i].sprite;
132 if (sprite && sprite._highlighted) {
134 sprite._anim.paused = true;
138 if (Ext.isObject(sprite._defaults[p])) {
140 Ext.apply(obj[p], sprite._defaults[p]);
143 obj[p] = sprite._defaults[p];
147 sprite._anim = Ext.create('Ext.fx.Anim', {
154 sprite.setAttributes(obj, true);
156 delete sprite._highlighted;
157 //delete sprite._defaults;
162 cleanHighlights: function() {
163 if (!this.highlight) {
167 var group = this.group,
168 markerGroup = this.markerGroup,
171 for (l = group.getCount(); i < l; i++) {
172 delete group.getAt(i)._defaults;
175 for (l = markerGroup.getCount(); i < l; i++) {
176 delete markerGroup.getAt(i)._defaults;
180 });</pre></pre></body></html>