1 /** 2 * @fileOverview 3 * Copyright (c) 2013 Regione Autonoma della Sardegna 4 * Published under the GPL license.<br> 5 * See <a href="https://sardegnageoportale.it/webgis/license.txt">https://sardegnageoportale.it/webgis/license.txt</a> 6 * for the full text of the license. 7 * @version 0.1 8 */ 9 10 /** 11 * @namespace framework.widgets 12 */ 13 Ext.namespace("framework.widgets"), 14 15 /** 16 * ... 17 * @class ColumnChartWidtLegend 18 * @extends <a target="_blank" href="http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.panel.Panel">Ext.Panel</a> 19 */ 20 framework.widgets.ColumnChartWidtLegend = Ext.extend(Ext.Panel, { 21 /** 22 * [Optional] Store that hold the data used to populate the optional pie chart. 23 * If it's null or not specified the pie chart is not rendered. 24 * @public 25 * @type Store 26 */ 27 store: null, 28 /** 29 * xtype of the chart type 30 * @public 31 * @type String 32 */ 33 chartType: 'columnchart', 34 /** 35 * Name of the field in the store that contains the labels of the data used in the chart 36 * @public 37 * @type String 38 */ 39 chartCategoryField: 'label', 40 /** 41 * Name of the field in the store that contains the extended value of the labels of the data used in the chart 42 * @public 43 * @type String 44 */ 45 chartTipField: null, 46 /** 47 * Name of the field in the store that contains the values of the data used in the chart 48 * @public 49 * @type String 50 */ 51 chartDataField: 'count', 52 53 initComponent: function() { 54 // Ext.chart.Chart.CHART_URL = 'src/ext/resources/charts.swf'; 55 56 var chart = null; 57 if (this.store !== null) { 58 chart = { 59 xtype: this.chartType, 60 width: this.With, 61 store: this.store, 62 yField: this.chartDataField, 63 url: 'src/ext/resources/charts.swf', 64 xField: this.chartCategoryField, 65 _self: this, 66 tipField: this.chartTipField, 67 series:[{style: {color: 0xd54e13}}], 68 tipRenderer : function(chart, record, index, series){ 69 var c = (record.data[this._self.chartTipField]?record.data[this._self.chartTipField]:record.data[this._self.chartCategoryField]) + 70 '\n' + 71 record.data[this._self.chartDataField]; 72 return c; 73 }, 74 xAxis: new Ext.chart.CategoryAxis({ 75 title: this.xTitle 76 }), 77 yAxis: new Ext.chart.NumericAxis({ 78 title: this.yTitle 79 }), 80 extraStyle: { 81 xAxis: { 82 labelRotation: -45 83 } 84 } 85 86 } 87 } 88 89 this.items = [ 90 { 91 html:this.chartTitle 92 },chart 93 94 ] 95 96 var objReturn = framework.widgets.ColumnChartWidtLegend.superclass.initComponent.apply(this, arguments); 97 return objReturn; 98 } 99 100 }); 101 102 /** api: xtype = framework_columnchartwidtlegend */ 103 Ext.reg("framework_columnchartwidtlegend", framework.widgets.ColumnChartWidtLegend); 104 105