diff --git a/js/app/views/VisuUI.js b/js/app/views/VisuUI.js index 09b6708..adce4c4 100644 --- a/js/app/views/VisuUI.js +++ b/js/app/views/VisuUI.js @@ -73,6 +73,7 @@ Ext.define('amdaUI.VisuUI', { Ext.Array.each(result.parameters, function(obj) { + index = 'param'+(i+2).toString(); fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name, convert: function(value, record) { @@ -138,11 +139,8 @@ Ext.define('amdaUI.VisuUI', { { // load object into form //this.formPanel.getForm().loadRecord(this.object); - - - var me = this; - - + + var me = this; }, @@ -158,18 +156,6 @@ Ext.define('amdaUI.VisuUI', { plotChart : function () { - var x = this.parCombo.getValue( ); - var y = this.parCombo1.getValue( ); - var xRec = this.parCombo.findRecordByValue(x); - var yRec = this.parCombo.findRecordByValue(y); - - this.chartConfig.axes[0].fields = [x]; - this.chartConfig.axes[0].title = xRec.get('text'); - this.chartConfig.axes[1].fields = [y]; - this.chartConfig.axes[1].title = yRec.get('text'); - this.chartConfig.series[0].xField = x; - this.chartConfig.series[0].yField = y; - this.chartConfig.store=this.chartStore; var chart = Ext.create('Ext.chart.Chart', this.chartConfig); @@ -240,7 +226,17 @@ Ext.define('amdaUI.VisuUI', { store: parList, queryMode: 'local', displayField: 'text', - valueField: 'id' + valueField: 'id', + listeners : { + scope : this, + change : function(combo, newValue, oldValue) { + + this.chartConfig.axes[0].fields = [newValue]; + var rec = combo.findRecordByValue(newValue); + this.chartConfig.axes[0].title = rec.get('text'); + this.chartConfig.series[0].xField = newValue; + } + } }); this.parCombo1 = Ext.create('Ext.form.ComboBox', { @@ -249,7 +245,17 @@ Ext.define('amdaUI.VisuUI', { store: parList, queryMode: 'local', displayField: 'text', - valueField: 'id' + valueField: 'id', + listeners : { + scope : this, + change : function(combo, newValue, oldValue) { + + this.chartConfig.axes[1].fields = [newValue]; + var rec = combo.findRecordByValue(newValue); + this.chartConfig.axes[1].title = rec.get('text'); + this.chartConfig.series[0].yField = newValue; + } + } }); @@ -336,10 +342,19 @@ Ext.define('amdaUI.VisuUI', { chart ], fbar:[ - { - type: 'button', - text: 'Save' - } + { + type: 'button', + text: 'Save Chart', + scope: this, + handler: function() { + var chartPanel = this.items.items[0].items.items[1]; + var chart = chartPanel.down('chart'); + chart.save({ + type: 'image/png' + }); + } + + } ] } ] -- libgit2 0.21.2