Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1011 lines
32 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.chart.Chart"></div>/**
  16. * @class Ext.chart.Chart
  17. * @extends Ext.FlashComponent
  18. * The Ext.chart package provides the capability to visualize data with flash based charting.
  19. * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart.
  20. * To change the look and feel of a chart, see the {@link #chartStyle} and {@link #extraStyle} config options.
  21. * @constructor
  22. * @xtype chart
  23. */
  24. Ext.chart.Chart = Ext.extend(Ext.FlashComponent, {
  25. refreshBuffer: 100,
  26. <div id="cfg-Ext.chart.Chart-backgroundColor"></div>/**
  27. * @cfg {String} backgroundColor
  28. * @hide
  29. */
  30. <div id="cfg-Ext.chart.Chart-chartStyle"></div>/**
  31. * @cfg {Object} chartStyle
  32. * Sets styles for this chart. This contains default styling, so modifying this property will <b>override</b>
  33. * the built in styles of the chart. Use {@link #extraStyle} to add customizations to the default styling.
  34. */
  35. chartStyle: {
  36. padding: 10,
  37. animationEnabled: true,
  38. font: {
  39. name: 'Tahoma',
  40. color: 0x444444,
  41. size: 11
  42. },
  43. dataTip: {
  44. padding: 5,
  45. border: {
  46. color: 0x99bbe8,
  47. size:1
  48. },
  49. background: {
  50. color: 0xDAE7F6,
  51. alpha: .9
  52. },
  53. font: {
  54. name: 'Tahoma',
  55. color: 0x15428B,
  56. size: 10,
  57. bold: true
  58. }
  59. }
  60. },
  61. <div id="cfg-Ext.chart.Chart-url"></div>/**
  62. * @cfg {String} url
  63. * The url to load the chart from. This defaults to Ext.chart.Chart.CHART_URL, which should
  64. * be modified to point to the local charts resource.
  65. */
  66. <div id="cfg-Ext.chart.Chart-extraStyle"></div>/**
  67. * @cfg {Object} extraStyle
  68. * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to <tt>null</tt>.
  69. * For a detailed list of the options available, visit the YUI Charts site
  70. * at <a href="http://developer.yahoo.com/yui/charts/#basicstyles">http://developer.yahoo.com/yui/charts/#basicstyles</a><br/>
  71. * Some of the options availabe:<br />
  72. * <ul style="padding:5px;padding-left:16px;list-style-type:inherit;">
  73. * <li><b>padding</b> - The space around the edge of the chart's contents. Padding does not increase the size of the chart.</li>
  74. * <li><b>animationEnabled</b> - A Boolean value that specifies whether marker animations are enabled or not. Enabled by default.</li>
  75. * <li><b>font</b> - An Object defining the font style to be used in the chart. Defaults to <tt>{ name: 'Tahoma', color: 0x444444, size: 11 }</tt><br/>
  76. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  77. * <li><b>name</b> - font name</li>
  78. * <li><b>color</b> - font color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
  79. * <li><b>size</b> - font size in points (numeric portion only, ie: 11)</li>
  80. * <li><b>bold</b> - boolean</li>
  81. * <li><b>italic</b> - boolean</li>
  82. * <li><b>underline</b> - boolean</li>
  83. * </ul>
  84. * </li>
  85. * <li><b>border</b> - An object defining the border style around the chart. The chart itself will decrease in dimensions to accomodate the border.<br/>
  86. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  87. * <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
  88. * <li><b>size</b> - border size in pixels (numeric portion only, ie: 1)</li>
  89. * </ul>
  90. * </li>
  91. * <li><b>background</b> - An object defining the background style of the chart.<br/>
  92. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  93. * <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
  94. * <li><b>image</b> - an image URL. May be relative to the current document or absolute.</li>
  95. * </ul>
  96. * </li>
  97. * <li><b>legend</b> - An object defining the legend style<br/>
  98. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  99. * <li><b>display</b> - location of the legend. Possible values are "none", "left", "right", "top", and "bottom".</li>
  100. * <li><b>spacing</b> - an image URL. May be relative to the current document or absolute.</li>
  101. * <li><b>padding, border, background, font</b> - same options as described above.</li>
  102. * </ul></li>
  103. * <li><b>dataTip</b> - An object defining the style of the data tip (tooltip).<br/>
  104. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  105. * <li><b>padding, border, background, font</b> - same options as described above.</li>
  106. * </ul></li>
  107. * <li><b>xAxis and yAxis</b> - An object defining the style of the style of either axis.<br/>
  108. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  109. * <li><b>color</b> - same option as described above.</li>
  110. * <li><b>size</b> - same option as described above.</li>
  111. * <li><b>showLabels</b> - boolean</li>
  112. * <li><b>labelRotation</b> - a value in degrees from -90 through 90. Default is zero.</li>
  113. * </ul></li>
  114. * <li><b>majorGridLines and minorGridLines</b> - An object defining the style of the style of the grid lines.<br/>
  115. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  116. * <li><b>color, size</b> - same options as described above.</li>
  117. * </ul></li></li>
  118. * <li><b>zeroGridLine</b> - An object defining the style of the style of the zero grid line.<br/>
  119. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  120. * <li><b>color, size</b> - same options as described above.</li>
  121. * </ul></li></li>
  122. * <li><b>majorTicks and minorTicks</b> - An object defining the style of the style of ticks in the chart.<br/>
  123. * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
  124. * <li><b>color, size</b> - same options as described above.</li>
  125. * <li><b>length</b> - the length of each tick in pixels extending from the axis.</li>
  126. * <li><b>display</b> - how the ticks are drawn. Possible values are "none", "inside", "outside", and "cross".</li>
  127. * </ul></li></li>
  128. * </ul>
  129. */
  130. extraStyle: null,
  131. <div id="cfg-Ext.chart.Chart-seriesStyles"></div>/**
  132. * @cfg {Object} seriesStyles
  133. * Contains styles to apply to the series after a refresh. Defaults to <tt>null</tt>.
  134. */
  135. seriesStyles: null,
  136. <div id="cfg-Ext.chart.Chart-disableCaching"></div>/**
  137. * @cfg {Boolean} disableCaching
  138. * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE.
  139. */
  140. disableCaching: Ext.isIE || Ext.isOpera,
  141. disableCacheParam: '_dc',
  142. initComponent : function(){
  143. Ext.chart.Chart.superclass.initComponent.call(this);
  144. if(!this.url){
  145. this.url = Ext.chart.Chart.CHART_URL;
  146. }
  147. if(this.disableCaching){
  148. this.url = Ext.urlAppend(this.url, String.format('{0}={1}', this.disableCacheParam, new Date().getTime()));
  149. }
  150. this.addEvents(
  151. 'itemmouseover',
  152. 'itemmouseout',
  153. 'itemclick',
  154. 'itemdoubleclick',
  155. 'itemdragstart',
  156. 'itemdrag',
  157. 'itemdragend',
  158. <div id="event-Ext.chart.Chart-beforerefresh"></div>/**
  159. * @event beforerefresh
  160. * Fires before a refresh to the chart data is called. If the beforerefresh handler returns
  161. * <tt>false</tt> the {@link #refresh} action will be cancelled.
  162. * @param {Chart} this
  163. */
  164. 'beforerefresh',
  165. <div id="event-Ext.chart.Chart-refresh"></div>/**
  166. * @event refresh
  167. * Fires after the chart data has been refreshed.
  168. * @param {Chart} this
  169. */
  170. 'refresh'
  171. );
  172. this.store = Ext.StoreMgr.lookup(this.store);
  173. },
  174. <div id="method-Ext.chart.Chart-setStyle"></div>/**
  175. * Sets a single style value on the Chart instance.
  176. *
  177. * @param name {String} Name of the Chart style value to change.
  178. * @param value {Object} New value to pass to the Chart style.
  179. */
  180. setStyle: function(name, value){
  181. this.swf.setStyle(name, Ext.encode(value));
  182. },
  183. <div id="method-Ext.chart.Chart-setStyles"></div>/**
  184. * Resets all styles on the Chart instance.
  185. *
  186. * @param styles {Object} Initializer for all Chart styles.
  187. */
  188. setStyles: function(styles){
  189. this.swf.setStyles(Ext.encode(styles));
  190. },
  191. <div id="method-Ext.chart.Chart-setSeriesStyles"></div>/**
  192. * Sets the styles on all series in the Chart.
  193. *
  194. * @param styles {Array} Initializer for all Chart series styles.
  195. */
  196. setSeriesStyles: function(styles){
  197. this.seriesStyles = styles;
  198. var s = [];
  199. Ext.each(styles, function(style){
  200. s.push(Ext.encode(style));
  201. });
  202. this.swf.setSeriesStyles(s);
  203. },
  204. setCategoryNames : function(names){
  205. this.swf.setCategoryNames(names);
  206. },
  207. setLegendRenderer : function(fn, scope){
  208. var chart = this;
  209. scope = scope || chart;
  210. chart.removeFnProxy(chart.legendFnName);
  211. chart.legendFnName = chart.createFnProxy(function(name){
  212. return fn.call(scope, name);
  213. });
  214. chart.swf.setLegendLabelFunction(chart.legendFnName);
  215. },
  216. setTipRenderer : function(fn, scope){
  217. var chart = this;
  218. scope = scope || chart;
  219. chart.removeFnProxy(chart.tipFnName);
  220. chart.tipFnName = chart.createFnProxy(function(item, index, series){
  221. var record = chart.store.getAt(index);
  222. return fn.call(scope, chart, record, index, series);
  223. });
  224. chart.swf.setDataTipFunction(chart.tipFnName);
  225. },
  226. setSeries : function(series){
  227. this.series = series;
  228. this.refresh();
  229. },
  230. <div id="method-Ext.chart.Chart-bindStore"></div>/**
  231. * Changes the data store bound to this chart and refreshes it.
  232. * @param {Store} store The store to bind to this chart
  233. */
  234. bindStore : function(store, initial){
  235. if(!initial && this.store){
  236. if(store !== this.store && this.store.autoDestroy){
  237. this.store.destroy();
  238. }else{
  239. this.store.un("datachanged", this.refresh, this);
  240. this.store.un("add", this.delayRefresh, this);
  241. this.store.un("remove", this.delayRefresh, this);
  242. this.store.un("update", this.delayRefresh, this);
  243. this.store.un("clear", this.refresh, this);
  244. }
  245. }
  246. if(store){
  247. store = Ext.StoreMgr.lookup(store);
  248. store.on({
  249. scope: this,
  250. datachanged: this.refresh,
  251. add: this.delayRefresh,
  252. remove: this.delayRefresh,
  253. update: this.delayRefresh,
  254. clear: this.refresh
  255. });
  256. }
  257. this.store = store;
  258. if(store && !initial){
  259. this.refresh();
  260. }
  261. },
  262. onSwfReady : function(isReset){
  263. Ext.chart.Chart.superclass.onSwfReady.call(this, isReset);
  264. var ref;
  265. this.swf.setType(this.type);
  266. if(this.chartStyle){
  267. this.setStyles(Ext.apply({}, this.extraStyle, this.chartStyle));
  268. }
  269. if(this.categoryNames){
  270. this.setCategoryNames(this.categoryNames);
  271. }
  272. if(this.tipRenderer){
  273. ref = this.getFunctionRef(this.tipRenderer);
  274. this.setTipRenderer(ref.fn, ref.scope);
  275. }
  276. if(this.legendRenderer){
  277. ref = this.getFunctionRef(this.legendRenderer);
  278. this.setLegendRenderer(ref.fn, ref.scope);
  279. }
  280. if(!isReset){
  281. this.bindStore(this.store, true);
  282. }
  283. this.refresh.defer(10, this);
  284. },
  285. delayRefresh : function(){
  286. if(!this.refreshTask){
  287. this.refreshTask = new Ext.util.DelayedTask(this.refresh, this);
  288. }
  289. this.refreshTask.delay(this.refreshBuffer);
  290. },
  291. refresh : function(){
  292. if(this.fireEvent('beforerefresh', this) !== false){
  293. var styleChanged = false;
  294. // convert the store data into something YUI charts can understand
  295. var data = [], rs = this.store.data.items;
  296. for(var j = 0, len = rs.length; j < len; j++){
  297. data[j] = rs[j].data;
  298. }
  299. //make a copy of the series definitions so that we aren't
  300. //editing them directly.
  301. var dataProvider = [];
  302. var seriesCount = 0;
  303. var currentSeries = null;
  304. var i = 0;
  305. if(this.series){
  306. seriesCount = this.series.length;
  307. for(i = 0; i < seriesCount; i++){
  308. currentSeries = this.series[i];
  309. var clonedSeries = {};
  310. for(var prop in currentSeries){
  311. if(prop == "style" && currentSeries.style !== null){
  312. clonedSeries.style = Ext.encode(currentSeries.style);
  313. styleChanged = true;
  314. //we don't want to modify the styles again next time
  315. //so null out the style property.
  316. // this causes issues
  317. // currentSeries.style = null;
  318. } else{
  319. clonedSeries[prop] = currentSeries[prop];
  320. }
  321. }
  322. dataProvider.push(clonedSeries);
  323. }
  324. }
  325. if(seriesCount > 0){
  326. for(i = 0; i < seriesCount; i++){
  327. currentSeries = dataProvider[i];
  328. if(!currentSeries.type){
  329. currentSeries.type = this.type;
  330. }
  331. currentSeries.dataProvider = data;
  332. }
  333. } else{
  334. dataProvider.push({type: this.type, dataProvider: data});
  335. }
  336. this.swf.setDataProvider(dataProvider);
  337. if(this.seriesStyles){
  338. this.setSeriesStyles(this.seriesStyles);
  339. }
  340. this.fireEvent('refresh', this);
  341. }
  342. },
  343. // private
  344. createFnProxy : function(fn){
  345. var fnName = 'extFnProxy' + (++Ext.chart.Chart.PROXY_FN_ID);
  346. Ext.chart.Chart.proxyFunction[fnName] = fn;
  347. return 'Ext.chart.Chart.proxyFunction.' + fnName;
  348. },
  349. // private
  350. removeFnProxy : function(fn){
  351. if(!Ext.isEmpty(fn)){
  352. fn = fn.replace('Ext.chart.Chart.proxyFunction.', '');
  353. delete Ext.chart.Chart.proxyFunction[fn];
  354. }
  355. },
  356. // private
  357. getFunctionRef : function(val){
  358. if(Ext.isFunction(val)){
  359. return {
  360. fn: val,
  361. scope: this
  362. };
  363. }else{
  364. return {
  365. fn: val.fn,
  366. scope: val.scope || this
  367. };
  368. }
  369. },
  370. // private
  371. onDestroy: function(){
  372. if (this.refreshTask && this.refreshTask.cancel){
  373. this.refreshTask.cancel();
  374. }
  375. Ext.chart.Chart.superclass.onDestroy.call(this);
  376. this.bindStore(null);
  377. this.removeFnProxy(this.tipFnName);
  378. this.removeFnProxy(this.legendFnName);
  379. }
  380. });
  381. Ext.reg('chart', Ext.chart.Chart);
  382. Ext.chart.Chart.PROXY_FN_ID = 0;
  383. Ext.chart.Chart.proxyFunction = {};
  384. <div id="prop-Ext.chart.Chart-CHART_URL"></div>/**
  385. * Sets the url to load the chart from. This should be set to a local resource.
  386. * @static
  387. * @type String
  388. */
  389. Ext.chart.Chart.CHART_URL = 'http:/' + '/yui.yahooapis.com/2.8.2/build/charts/assets/charts.swf';
  390. <div id="cls-Ext.chart.PieChart"></div>/**
  391. * @class Ext.chart.PieChart
  392. * @extends Ext.chart.Chart
  393. * @constructor
  394. * @xtype piechart
  395. */
  396. Ext.chart.PieChart = Ext.extend(Ext.chart.Chart, {
  397. type: 'pie',
  398. onSwfReady : function(isReset){
  399. Ext.chart.PieChart.superclass.onSwfReady.call(this, isReset);
  400. this.setDataField(this.dataField);
  401. this.setCategoryField(this.categoryField);
  402. },
  403. setDataField : function(field){
  404. this.dataField = field;
  405. this.swf.setDataField(field);
  406. },
  407. setCategoryField : function(field){
  408. this.categoryField = field;
  409. this.swf.setCategoryField(field);
  410. }
  411. });
  412. Ext.reg('piechart', Ext.chart.PieChart);
  413. <div id="cls-Ext.chart.CartesianChart"></div>/**
  414. * @class Ext.chart.CartesianChart
  415. * @extends Ext.chart.Chart
  416. * @constructor
  417. * @xtype cartesianchart
  418. */
  419. Ext.chart.CartesianChart = Ext.extend(Ext.chart.Chart, {
  420. onSwfReady : function(isReset){
  421. Ext.chart.CartesianChart.superclass.onSwfReady.call(this, isReset);
  422. this.labelFn = [];
  423. if(this.xField){
  424. this.setXField(this.xField);
  425. }
  426. if(this.yField){
  427. this.setYField(this.yField);
  428. }
  429. if(this.xAxis){
  430. this.setXAxis(this.xAxis);
  431. }
  432. if(this.xAxes){
  433. this.setXAxes(this.xAxes);
  434. }
  435. if(this.yAxis){
  436. this.setYAxis(this.yAxis);
  437. }
  438. if(this.yAxes){
  439. this.setYAxes(this.yAxes);
  440. }
  441. if(Ext.isDefined(this.constrainViewport)){
  442. this.swf.setConstrainViewport(this.constrainViewport);
  443. }
  444. },
  445. setXField : function(value){
  446. this.xField = value;
  447. this.swf.setHorizontalField(value);
  448. },
  449. setYField : function(value){
  450. this.yField = value;
  451. this.swf.setVerticalField(value);
  452. },
  453. setXAxis : function(value){
  454. this.xAxis = this.createAxis('xAxis', value);
  455. this.swf.setHorizontalAxis(this.xAxis);
  456. },
  457. setXAxes : function(value){
  458. var axis;
  459. for(var i = 0; i < value.length; i++) {
  460. axis = this.createAxis('xAxis' + i, value[i]);
  461. this.swf.setHorizontalAxis(axis);
  462. }
  463. },
  464. setYAxis : function(value){
  465. this.yAxis = this.createAxis('yAxis', value);
  466. this.swf.setVerticalAxis(this.yAxis);
  467. },
  468. setYAxes : function(value){
  469. var axis;
  470. for(var i = 0; i < value.length; i++) {
  471. axis = this.createAxis('yAxis' + i, value[i]);
  472. this.swf.setVerticalAxis(axis);
  473. }
  474. },
  475. createAxis : function(axis, value){
  476. var o = Ext.apply({}, value),
  477. ref,
  478. old;
  479. if(this[axis]){
  480. old = this[axis].labelFunction;
  481. this.removeFnProxy(old);
  482. this.labelFn.remove(old);
  483. }
  484. if(o.labelRenderer){
  485. ref = this.getFunctionRef(o.labelRenderer);
  486. o.labelFunction = this.createFnProxy(function(v){
  487. return ref.fn.call(ref.scope, v);
  488. });
  489. delete o.labelRenderer;
  490. this.labelFn.push(o.labelFunction);
  491. }
  492. if(axis.indexOf('xAxis') > -1 && o.position == 'left'){
  493. o.position = 'bottom';
  494. }
  495. return o;
  496. },
  497. onDestroy : function(){
  498. Ext.chart.CartesianChart.superclass.onDestroy.call(this);
  499. Ext.each(this.labelFn, function(fn){
  500. this.removeFnProxy(fn);
  501. }, this);
  502. }
  503. });
  504. Ext.reg('cartesianchart', Ext.chart.CartesianChart);
  505. <div id="cls-Ext.chart.LineChart"></div>/**
  506. * @class Ext.chart.LineChart
  507. * @extends Ext.chart.CartesianChart
  508. * @constructor
  509. * @xtype linechart
  510. */
  511. Ext.chart.LineChart = Ext.extend(Ext.chart.CartesianChart, {
  512. type: 'line'
  513. });
  514. Ext.reg('linechart', Ext.chart.LineChart);
  515. <div id="cls-Ext.chart.ColumnChart"></div>/**
  516. * @class Ext.chart.ColumnChart
  517. * @extends Ext.chart.CartesianChart
  518. * @constructor
  519. * @xtype columnchart
  520. */
  521. Ext.chart.ColumnChart = Ext.extend(Ext.chart.CartesianChart, {
  522. type: 'column'
  523. });
  524. Ext.reg('columnchart', Ext.chart.ColumnChart);
  525. <div id="cls-Ext.chart.StackedColumnChart"></div>/**
  526. * @class Ext.chart.StackedColumnChart
  527. * @extends Ext.chart.CartesianChart
  528. * @constructor
  529. * @xtype stackedcolumnchart
  530. */
  531. Ext.chart.StackedColumnChart = Ext.extend(Ext.chart.CartesianChart, {
  532. type: 'stackcolumn'
  533. });
  534. Ext.reg('stackedcolumnchart', Ext.chart.StackedColumnChart);
  535. <div id="cls-Ext.chart.BarChart"></div>/**
  536. * @class Ext.chart.BarChart
  537. * @extends Ext.chart.CartesianChart
  538. * @constructor
  539. * @xtype barchart
  540. */
  541. Ext.chart.BarChart = Ext.extend(Ext.chart.CartesianChart, {
  542. type: 'bar'
  543. });
  544. Ext.reg('barchart', Ext.chart.BarChart);
  545. <div id="cls-Ext.chart.StackedBarChart"></div>/**
  546. * @class Ext.chart.StackedBarChart
  547. * @extends Ext.chart.CartesianChart
  548. * @constructor
  549. * @xtype stackedbarchart
  550. */
  551. Ext.chart.StackedBarChart = Ext.extend(Ext.chart.CartesianChart, {
  552. type: 'stackbar'
  553. });
  554. Ext.reg('stackedbarchart', Ext.chart.StackedBarChart);
  555. <div id="cls-Ext.chart.Axis"></div>/**
  556. * @class Ext.chart.Axis
  557. * Defines a CartesianChart's vertical or horizontal axis.
  558. * @constructor
  559. */
  560. Ext.chart.Axis = function(config){
  561. Ext.apply(this, config);
  562. };
  563. Ext.chart.Axis.prototype =
  564. {
  565. <div id="prop-Ext.chart.Axis-type"></div>/**
  566. * The type of axis.
  567. *
  568. * @property type
  569. * @type String
  570. */
  571. type: null,
  572. <div id="prop-Ext.chart.Axis-orientation"></div>/**
  573. * The direction in which the axis is drawn. May be "horizontal" or "vertical".
  574. *
  575. * @property orientation
  576. * @type String
  577. */
  578. orientation: "horizontal",
  579. <div id="prop-Ext.chart.Axis-reverse"></div>/**
  580. * If true, the items on the axis will be drawn in opposite direction.
  581. *
  582. * @property reverse
  583. * @type Boolean
  584. */
  585. reverse: false,
  586. <div id="prop-Ext.chart.Axis-labelFunction"></div>/**
  587. * A string reference to the globally-accessible function that may be called to
  588. * determine each of the label values for this axis.
  589. *
  590. * @property labelFunction
  591. * @type String
  592. */
  593. labelFunction: null,
  594. <div id="prop-Ext.chart.Axis-hideOverlappingLabels"></div>/**
  595. * If true, labels that overlap previously drawn labels on the axis will be hidden.
  596. *
  597. * @property hideOverlappingLabels
  598. * @type Boolean
  599. */
  600. hideOverlappingLabels: true,
  601. <div id="prop-Ext.chart.Axis-labelSpacing"></div>/**
  602. * The space, in pixels, between labels on an axis.
  603. *
  604. * @property labelSpacing
  605. * @type Number
  606. */
  607. labelSpacing: 2
  608. };
  609. <div id="cls-Ext.chart.NumericAxis"></div>/**
  610. * @class Ext.chart.NumericAxis
  611. * @extends Ext.chart.Axis
  612. * A type of axis whose units are measured in numeric values.
  613. * @constructor
  614. */
  615. Ext.chart.NumericAxis = Ext.extend(Ext.chart.Axis, {
  616. type: "numeric",
  617. <div id="prop-Ext.chart.NumericAxis-minimum"></div>/**
  618. * The minimum value drawn by the axis. If not set explicitly, the axis
  619. * minimum will be calculated automatically.
  620. *
  621. * @property minimum
  622. * @type Number
  623. */
  624. minimum: NaN,
  625. <div id="prop-Ext.chart.NumericAxis-maximum"></div>/**
  626. * The maximum value drawn by the axis. If not set explicitly, the axis
  627. * maximum will be calculated automatically.
  628. *
  629. * @property maximum
  630. * @type Number
  631. */
  632. maximum: NaN,
  633. <div id="prop-Ext.chart.NumericAxis-majorUnit"></div>/**
  634. * The spacing between major intervals on this axis.
  635. *
  636. * @property majorUnit
  637. * @type Number
  638. */
  639. majorUnit: NaN,
  640. <div id="prop-Ext.chart.NumericAxis-minorUnit"></div>/**
  641. * The spacing between minor intervals on this axis.
  642. *
  643. * @property minorUnit
  644. * @type Number
  645. */
  646. minorUnit: NaN,
  647. <div id="prop-Ext.chart.NumericAxis-snapToUnits"></div>/**
  648. * If true, the labels, ticks, gridlines, and other objects will snap to the
  649. * nearest major or minor unit. If false, their position will be based on
  650. * the minimum value.
  651. *
  652. * @property snapToUnits
  653. * @type Boolean
  654. */
  655. snapToUnits: true,
  656. <div id="prop-Ext.chart.NumericAxis-alwaysShowZero"></div>/**
  657. * If true, and the bounds are calculated automatically, either the minimum
  658. * or maximum will be set to zero.
  659. *
  660. * @property alwaysShowZero
  661. * @type Boolean
  662. */
  663. alwaysShowZero: true,
  664. <div id="prop-Ext.chart.NumericAxis-scale"></div>/**
  665. * The scaling algorithm to use on this axis. May be "linear" or
  666. * "logarithmic".
  667. *
  668. * @property scale
  669. * @type String
  670. */
  671. scale: "linear",
  672. <div id="prop-Ext.chart.NumericAxis-roundMajorUnit"></div>/**
  673. * Indicates whether to round the major unit.
  674. *
  675. * @property roundMajorUnit
  676. * @type Boolean
  677. */
  678. roundMajorUnit: true,
  679. <div id="prop-Ext.chart.NumericAxis-calculateByLabelSize"></div>/**
  680. * Indicates whether to factor in the size of the labels when calculating a
  681. * major unit.
  682. *
  683. * @property calculateByLabelSize
  684. * @type Boolean
  685. */
  686. calculateByLabelSize: true,
  687. <div id="prop-Ext.chart.NumericAxis-position"></div>/**
  688. * Indicates the position of the axis relative to the chart
  689. *
  690. * @property position
  691. * @type String
  692. */
  693. position: 'left',
  694. <div id="prop-Ext.chart.NumericAxis-adjustMaximumByMajorUnit"></div>/**
  695. * Indicates whether to extend maximum beyond data's maximum to the nearest
  696. * majorUnit.
  697. *
  698. * @property adjustMaximumByMajorUnit
  699. * @type Boolean
  700. */
  701. adjustMaximumByMajorUnit: true,
  702. <div id="prop-Ext.chart.NumericAxis-adjustMinimumByMajorUnit"></div>/**
  703. * Indicates whether to extend the minimum beyond data's minimum to the
  704. * nearest majorUnit.
  705. *
  706. * @property adjustMinimumByMajorUnit
  707. * @type Boolean
  708. */
  709. adjustMinimumByMajorUnit: true
  710. });
  711. <div id="cls-Ext.chart.TimeAxis"></div>/**
  712. * @class Ext.chart.TimeAxis
  713. * @extends Ext.chart.Axis
  714. * A type of axis whose units are measured in time-based values.
  715. * @constructor
  716. */
  717. Ext.chart.TimeAxis = Ext.extend(Ext.chart.Axis, {
  718. type: "time",
  719. <div id="prop-Ext.chart.TimeAxis-minimum"></div>/**
  720. * The minimum value drawn by the axis. If not set explicitly, the axis
  721. * minimum will be calculated automatically.
  722. *
  723. * @property minimum
  724. * @type Date
  725. */
  726. minimum: null,
  727. <div id="prop-Ext.chart.TimeAxis-maximum"></div>/**
  728. * The maximum value drawn by the axis. If not set explicitly, the axis
  729. * maximum will be calculated automatically.
  730. *
  731. * @property maximum
  732. * @type Number
  733. */
  734. maximum: null,
  735. <div id="prop-Ext.chart.TimeAxis-majorUnit"></div>/**
  736. * The spacing between major intervals on this axis.
  737. *
  738. * @property majorUnit
  739. * @type Number
  740. */
  741. majorUnit: NaN,
  742. <div id="prop-Ext.chart.TimeAxis-majorTimeUnit"></div>/**
  743. * The time unit used by the majorUnit.
  744. *
  745. * @property majorTimeUnit
  746. * @type String
  747. */
  748. majorTimeUnit: null,
  749. <div id="prop-Ext.chart.TimeAxis-majorUnit"></div>/**
  750. * The spacing between minor intervals on this axis.
  751. *
  752. * @property majorUnit
  753. * @type Number
  754. */
  755. minorUnit: NaN,
  756. <div id="prop-Ext.chart.TimeAxis-majorTimeUnit"></div>/**
  757. * The time unit used by the minorUnit.
  758. *
  759. * @property majorTimeUnit
  760. * @type String
  761. */
  762. minorTimeUnit: null,
  763. <div id="prop-Ext.chart.TimeAxis-snapToUnits"></div>/**
  764. * If true, the labels, ticks, gridlines, and other objects will snap to the
  765. * nearest major or minor unit. If false, their position will be based on
  766. * the minimum value.
  767. *
  768. * @property snapToUnits
  769. * @type Boolean
  770. */
  771. snapToUnits: true,
  772. <div id="prop-Ext.chart.TimeAxis-stackingEnabled"></div>/**
  773. * Series that are stackable will only stack when this value is set to true.
  774. *
  775. * @property stackingEnabled
  776. * @type Boolean
  777. */
  778. stackingEnabled: false,
  779. <div id="prop-Ext.chart.TimeAxis-calculateByLabelSize"></div>/**
  780. * Indicates whether to factor in the size of the labels when calculating a
  781. * major unit.
  782. *
  783. * @property calculateByLabelSize
  784. * @type Boolean
  785. */
  786. calculateByLabelSize: true
  787. });
  788. <div id="cls-Ext.chart.CategoryAxis"></div>/**
  789. * @class Ext.chart.CategoryAxis
  790. * @extends Ext.chart.Axis
  791. * A type of axis that displays items in categories.
  792. * @constructor
  793. */
  794. Ext.chart.CategoryAxis = Ext.extend(Ext.chart.Axis, {
  795. type: "category",
  796. <div id="prop-Ext.chart.CategoryAxis-categoryNames"></div>/**
  797. * A list of category names to display along this axis.
  798. *
  799. * @property categoryNames
  800. * @type Array
  801. */
  802. categoryNames: null,
  803. <div id="prop-Ext.chart.CategoryAxis-calculateCategoryCount"></div>/**
  804. * Indicates whether or not to calculate the number of categories (ticks and
  805. * labels) when there is not enough room to display all labels on the axis.
  806. * If set to true, the axis will determine the number of categories to plot.
  807. * If not, all categories will be plotted.
  808. *
  809. * @property calculateCategoryCount
  810. * @type Boolean
  811. */
  812. calculateCategoryCount: false
  813. });
  814. <div id="cls-Ext.chart.Series"></div>/**
  815. * @class Ext.chart.Series
  816. * Series class for the charts widget.
  817. * @constructor
  818. */
  819. Ext.chart.Series = function(config) { Ext.apply(this, config); };
  820. Ext.chart.Series.prototype =
  821. {
  822. <div id="prop-Ext.chart.Series-type"></div>/**
  823. * The type of series.
  824. *
  825. * @property type
  826. * @type String
  827. */
  828. type: null,
  829. <div id="prop-Ext.chart.Series-displayName"></div>/**
  830. * The human-readable name of the series.
  831. *
  832. * @property displayName
  833. * @type String
  834. */
  835. displayName: null
  836. };
  837. <div id="cls-Ext.chart.CartesianSeries"></div>/**
  838. * @class Ext.chart.CartesianSeries
  839. * @extends Ext.chart.Series
  840. * CartesianSeries class for the charts widget.
  841. * @constructor
  842. */
  843. Ext.chart.CartesianSeries = Ext.extend(Ext.chart.Series, {
  844. <div id="prop-Ext.chart.CartesianSeries-xField"></div>/**
  845. * The field used to access the x-axis value from the items from the data
  846. * source.
  847. *
  848. * @property xField
  849. * @type String
  850. */
  851. xField: null,
  852. <div id="prop-Ext.chart.CartesianSeries-yField"></div>/**
  853. * The field used to access the y-axis value from the items from the data
  854. * source.
  855. *
  856. * @property yField
  857. * @type String
  858. */
  859. yField: null,
  860. <div id="prop-Ext.chart.CartesianSeries-showInLegend"></div>/**
  861. * False to not show this series in the legend. Defaults to <tt>true</tt>.
  862. *
  863. * @property showInLegend
  864. * @type Boolean
  865. */
  866. showInLegend: true,
  867. <div id="prop-Ext.chart.CartesianSeries-axis"></div>/**
  868. * Indicates which axis the series will bind to
  869. *
  870. * @property axis
  871. * @type String
  872. */
  873. axis: 'primary'
  874. });
  875. <div id="cls-Ext.chart.ColumnSeries"></div>/**
  876. * @class Ext.chart.ColumnSeries
  877. * @extends Ext.chart.CartesianSeries
  878. * ColumnSeries class for the charts widget.
  879. * @constructor
  880. */
  881. Ext.chart.ColumnSeries = Ext.extend(Ext.chart.CartesianSeries, {
  882. type: "column"
  883. });
  884. <div id="cls-Ext.chart.LineSeries"></div>/**
  885. * @class Ext.chart.LineSeries
  886. * @extends Ext.chart.CartesianSeries
  887. * LineSeries class for the charts widget.
  888. * @constructor
  889. */
  890. Ext.chart.LineSeries = Ext.extend(Ext.chart.CartesianSeries, {
  891. type: "line"
  892. });
  893. <div id="cls-Ext.chart.BarSeries"></div>/**
  894. * @class Ext.chart.BarSeries
  895. * @extends Ext.chart.CartesianSeries
  896. * BarSeries class for the charts widget.
  897. * @constructor
  898. */
  899. Ext.chart.BarSeries = Ext.extend(Ext.chart.CartesianSeries, {
  900. type: "bar"
  901. });
  902. <div id="cls-Ext.chart.PieSeries"></div>/**
  903. * @class Ext.chart.PieSeries
  904. * @extends Ext.chart.Series
  905. * PieSeries class for the charts widget.
  906. * @constructor
  907. */
  908. Ext.chart.PieSeries = Ext.extend(Ext.chart.Series, {
  909. type: "pie",
  910. dataField: null,
  911. categoryField: null
  912. });</pre>
  913. </body>
  914. </html>