X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/pkgs/pkg-charts-debug.js diff --git a/pkgs/pkg-charts-debug.js b/pkgs/pkg-charts-debug.js index 020f854c..a6478c12 100644 --- a/pkgs/pkg-charts-debug.js +++ b/pkgs/pkg-charts-debug.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -792,7 +792,7 @@ Ext.FlashComponent = Ext.extend(Ext.BoxComponent, { * @cfg {String} flashVersion * Indicates the version the flash content was published for. Defaults to '9.0.45'. */ - flashVersion : '9.0.45', + flashVersion : '9.0.115', /** * @cfg {String} backgroundColor @@ -805,6 +805,19 @@ Ext.FlashComponent = Ext.extend(Ext.BoxComponent, { * The wmode of the flash object. This can be used to control layering. Defaults to 'opaque'. */ wmode: 'opaque', + + /** + * @cfg {Object} flashVars + * A set of key value pairs to be passed to the flash object as flash variables. Defaults to undefined. + */ + flashVars: undefined, + + /** + * @cfg {Object} flashParams + * A set of key value pairs to be passed to the flash object as parameters. Possible parameters can be found here: + * http://kb2.adobe.com/cps/127/tn_12701.html Defaults to undefined. + */ + flashParams: undefined, /** * @cfg {String} url @@ -825,21 +838,28 @@ Ext.FlashComponent = Ext.extend(Ext.BoxComponent, { initComponent : function(){ Ext.FlashComponent.superclass.initComponent.call(this); - this.addEvents('initialize'); + this.addEvents( + /** + * @event initialize + * + * @param {Chart} this + */ + 'initialize' + ); }, onRender : function(){ Ext.FlashComponent.superclass.onRender.apply(this, arguments); - var params = { + var params = Ext.apply({ allowScriptAccess: 'always', bgcolor: this.backgroundColor, wmode: this.wmode - }, vars = { + }, this.flashParams), vars = Ext.apply({ allowedDomain: document.location.hostname, elementID: this.getId(), eventHandler: 'Ext.FlashEventProxy.onEvent' - }; + }, this.flashVars); new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion, this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params); @@ -909,17 +929,23 @@ Ext.FlashEventProxy = { * @extends Ext.FlashComponent * The Ext.chart package provides the capability to visualize data with flash based charting. * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart. + * To change the look and feel of a chart, see the {@link #chartStyle} and {@link #extraStyle} config options. * @constructor * @xtype chart */ Ext.chart.Chart = Ext.extend(Ext.FlashComponent, { refreshBuffer: 100, + + /** + * @cfg {String} backgroundColor + * @hide + */ /** * @cfg {Object} chartStyle - * Sets styles for this chart. Contains a number of default values. Modifying this property will override - * the base styles on the chart. + * Sets styles for this chart. This contains default styling, so modifying this property will override + * the built in styles of the chart. Use {@link #extraStyle} to add customizations to the default styling. */ chartStyle: { padding: 10, @@ -957,9 +983,75 @@ Ext.FlashEventProxy = { /** * @cfg {Object} extraStyle * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to null. + * For a detailed list of the options available, visit the YUI Charts site + * at http://developer.yahoo.com/yui/charts/#basicstyles
+ * Some of the options availabe:
+ * */ extraStyle: null, + /** + * @cfg {Object} seriesStyles + * Contains styles to apply to the series after a refresh. Defaults to null. + */ + seriesStyles: null, + /** * @cfg {Boolean} disableCaching * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE. @@ -982,7 +1074,20 @@ Ext.FlashEventProxy = { 'itemdoubleclick', 'itemdragstart', 'itemdrag', - 'itemdragend' + 'itemdragend', + /** + * @event beforerefresh + * Fires before a refresh to the chart data is called. If the beforerefresh handler returns + * false the {@link #refresh} action will be cancelled. + * @param {Chart} this + */ + 'beforerefresh', + /** + * @event refresh + * Fires after the chart data has been refreshed. + * @param {Chart} this + */ + 'refresh' ); this.store = Ext.StoreMgr.lookup(this.store); }, @@ -1012,6 +1117,7 @@ Ext.FlashEventProxy = { * @param styles {Array} Initializer for all Chart series styles. */ setSeriesStyles: function(styles){ + this.seriesStyles = styles; var s = []; Ext.each(styles, function(style){ s.push(Ext.encode(style)); @@ -1043,13 +1149,14 @@ Ext.FlashEventProxy = { */ bindStore : function(store, initial){ if(!initial && this.store){ - this.store.un("datachanged", this.refresh, this); - this.store.un("add", this.delayRefresh, this); - this.store.un("remove", this.delayRefresh, this); - this.store.un("update", this.delayRefresh, this); - this.store.un("clear", this.refresh, this); if(store !== this.store && this.store.autoDestroy){ this.store.destroy(); + }else{ + this.store.un("datachanged", this.refresh, this); + this.store.un("add", this.delayRefresh, this); + this.store.un("remove", this.delayRefresh, this); + this.store.un("update", this.delayRefresh, this); + this.store.un("clear", this.refresh, this); } } if(store){ @@ -1074,7 +1181,7 @@ Ext.FlashEventProxy = { this.swf.setType(this.type); if(this.chartStyle){ - this.setStyles(Ext.apply(this.extraStyle || {}, this.chartStyle)); + this.setStyles(Ext.apply({}, this.extraStyle, this.chartStyle)); } if(this.categoryNames){ @@ -1098,51 +1205,57 @@ Ext.FlashEventProxy = { }, refresh : function(){ - var styleChanged = false; - // convert the store data into something YUI charts can understand - var data = [], rs = this.store.data.items; - for(var j = 0, len = rs.length; j < len; j++){ - data[j] = rs[j].data; + if(this.fireEvent('beforerefresh', this) !== false){ + var styleChanged = false; + // convert the store data into something YUI charts can understand + var data = [], rs = this.store.data.items; + for(var j = 0, len = rs.length; j < len; j++){ + data[j] = rs[j].data; + } + //make a copy of the series definitions so that we aren't + //editing them directly. + var dataProvider = []; + var seriesCount = 0; + var currentSeries = null; + var i = 0; + if(this.series){ + seriesCount = this.series.length; + for(i = 0; i < seriesCount; i++){ + currentSeries = this.series[i]; + var clonedSeries = {}; + for(var prop in currentSeries){ + if(prop == "style" && currentSeries.style !== null){ + clonedSeries.style = Ext.encode(currentSeries.style); + styleChanged = true; + //we don't want to modify the styles again next time + //so null out the style property. + // this causes issues + // currentSeries.style = null; + } else{ + clonedSeries[prop] = currentSeries[prop]; + } + } + dataProvider.push(clonedSeries); + } + } + + if(seriesCount > 0){ + for(i = 0; i < seriesCount; i++){ + currentSeries = dataProvider[i]; + if(!currentSeries.type){ + currentSeries.type = this.type; + } + currentSeries.dataProvider = data; + } + } else{ + dataProvider.push({type: this.type, dataProvider: data}); + } + this.swf.setDataProvider(dataProvider); + if(this.seriesStyles){ + this.setSeriesStyles(this.seriesStyles); + } + this.fireEvent('refresh', this); } - //make a copy of the series definitions so that we aren't - //editing them directly. - var dataProvider = []; - var seriesCount = 0; - var currentSeries = null; - var i = 0; - if(this.series){ - seriesCount = this.series.length; - for(i = 0; i < seriesCount; i++){ - currentSeries = this.series[i]; - var clonedSeries = {}; - for(var prop in currentSeries){ - if(prop == "style" && currentSeries.style !== null){ - clonedSeries.style = Ext.encode(currentSeries.style); - styleChanged = true; - //we don't want to modify the styles again next time - //so null out the style property. - // this causes issues - // currentSeries.style = null; - } else{ - clonedSeries[prop] = currentSeries[prop]; - } - } - dataProvider.push(clonedSeries); - } - } - - if(seriesCount > 0){ - for(i = 0; i < seriesCount; i++){ - currentSeries = dataProvider[i]; - if(!currentSeries.type){ - currentSeries.type = this.type; - } - currentSeries.dataProvider = data; - } - } else{ - dataProvider.push({type: this.type, dataProvider: data}); - } - this.swf.setDataProvider(dataProvider); }, createFnProxy : function(fn, old){ @@ -1156,7 +1269,11 @@ Ext.FlashEventProxy = { onDestroy: function(){ Ext.chart.Chart.superclass.onDestroy.call(this); - delete window[this.tipFnName]; + this.bindStore(null); + var tip = this.tipFnName; + if(!Ext.isEmpty(tip)){ + delete window[tip]; + } } }); Ext.reg('chart', Ext.chart.Chart);