Commit ccb80610e98f8363bed243c3d70ecb5ffbcafc36

Authored by elena
1 parent f8448f55

added options

Showing 1 changed file with 185 additions and 64 deletions   Show diff stats
js/app/views/VisuUI.js
... ... @@ -47,9 +47,15 @@ Ext.define('amdaUI.VisuUI', {
47 47 },
48 48  
49 49 reset : function() {
50   -
51   - this.parCombo.reset();
52   - this.parCombo1.reset();
  50 +
  51 + //reset all fieldsets except the first one (name, intervals)
  52 + var form = this.items.items[0].items.items[0];
  53 + for (var i = 1; i < 4; i++) {
  54 + var fieldset = form.items.items[i];
  55 + Ext.each(fieldset.query('field'), function(field) {
  56 + field.reset();
  57 + });
  58 + }
53 59 this.resetChart();
54 60  
55 61 },
... ... @@ -156,12 +162,27 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
156 162  
157 163 resetChart : function () {
158 164  
  165 + var emptyAxesConfig = [{
  166 + type: 'Numeric',
  167 + position: 'bottom',
  168 + fields: [],
  169 + title: 'x axe',
  170 + grid : true
  171 + }, {
  172 + type: 'Numeric',
  173 + position: 'left',
  174 + fields: [],
  175 + title: 'y axe',
  176 + grid: true
  177 + }];
  178 +
159 179 this.chartConfig.series[0].xField = '';
160 180 this.chartConfig.series[0].yField = '';
161   -
162   - this.chartConfig.axes[0].title = 'x axe';
163   - this.chartConfig.axes[1].title = 'y axe';
164 181  
  182 + this.chartConfig.theme = 'Blue';
  183 +
  184 + this.chartConfig.axes = emptyAxesConfig;
  185 +
165 186 var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
166 187 this.replaceChart(chart);
167 188  
... ... @@ -169,12 +190,45 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
169 190  
170 191 plotChart : function () {
171 192  
172   - this.chartConfig.store=this.chartStore;
173   - var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
  193 + this.chartConfig.store = this.chartStore;
  194 +
  195 + var xTitle = this.items.items[0].items.items[0].items.items[1].items.items[2].getValue();
  196 + var yTitle = this.items.items[0].items.items[0].items.items[2].items.items[2].getValue();
  197 +
  198 + if (xTitle) this.chartConfig.axes[0].title = xTitle;
  199 + if (xTitle) this.chartConfig.axes[1].title = yTitle;
  200 +
  201 + // axis modifs
  202 + if (this.comboXrange.getValue() == 'manual') {
  203 + var minX = this.comboXrange.next().next().getValue();
  204 + var maxX = this.comboXrange.next().next().next().next().getValue();
  205 + this.chartConfig.axes[0].minimum = minX;
  206 + this.chartConfig.axes[0].maximum = maxX ;
  207 + } else {
  208 + // unset min/max in config
  209 + delete this.chartConfig.axes[0].minimum;
  210 + delete this.chartConfig.axes[0].maximum;
  211 + }
  212 + if (this.comboYrange.getValue() == 'manual') {
  213 + var minX = this.comboYrange.next().next().getValue();
  214 + var maxX = this.comboYrange.next().next().next().next().getValue();
  215 + // if (minX && maxX) {
  216 + this.chartConfig.axes[1].minimum = minX;
  217 + this.chartConfig.axes[1].maximum = maxX;
  218 + // }
  219 + } else {
  220 + // unset min/max in config
  221 + delete this.chartConfig.axes[1].minimum;
  222 + delete this.chartConfig.axes[1].maximum;
  223 + }
  224 +
  225 + var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
  226 +
174 227 this.replaceChart(chart);
175 228  
176 229 },
177 230  
  231 +
178 232 replaceChart: function(chart) {
179 233  
180 234 var chartPanel = this.items.items[0].items.items[1];
... ... @@ -191,15 +245,21 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
191 245 autoload : false
192 246 });
193 247  
  248 + var rangeStore = Ext.create('Ext.data.Store', {
  249 + fields : [],
  250 + autoload : false
  251 + });
  252 +
  253 +
194 254 this.chartConfig = {
195 255 width: 500,
196 256 height: 500,
197 257 animate: false,
198 258 mask: false,
199 259 shadow: false,
200   - // theme:'Category2',
  260 + theme:'Blue',
201 261 store: store,
202   - axes: [{
  262 + axes: [{
203 263 type: 'Numeric',
204 264 position: 'bottom',
205 265 fields: [],
... ... @@ -214,7 +274,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
214 274 }],
215 275 series: [{
216 276 type: 'scatter',
217   - showMarkers: false,
  277 + showMarkers: true,
  278 + highlight: true,
218 279 // markerConfig: {
219 280 // radius: 5,
220 281 // size: 5
... ... @@ -222,42 +283,25 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
222 283 // // axes: ['left', 'bottom'],
223 284 xField: '',
224 285 yField: '',
225   - label: {
226   -// display: 'under',
227   -// renderer: function(value, label, storeItem, item, i, display, animate, index) {
228   -// return storeItem.param3;
229   -// }
230   - },
  286 +// label: {
  287 +// // display: 'under',
  288 +// // renderer: function(value, label, storeItem, item, i, display, animate, index) {
  289 +// // return storeItem.param3;
  290 +// // }
  291 +// },
231 292 tips: {
232 293 // trackMouse: true,
233 294 width: 10,
234 295 height: 20,
235 296 hideDelay: 100, //200 ms
236   -// mouseOffset: [10,10], //[15,18]
  297 + mouseOffset: [0,0], //[15,18]
237 298 renderer: function(storeItem, item) {
238   - this.setTitle(storeItem.index);
  299 + this.setTitle(storeItem.index + 1);
239 300 }
240 301 }
241 302 }
242   - ],
243   -
244   - listeners: {
245   -// select: {
246   -// fn: function(me, selection) {
247   -// me.setZoom(selection);
248   -// me.mask.hide();
249   -// }
250   -// }
251   - }
  303 + ]
252 304 }
253   -
254   - var plotTypeList = Ext.create('Ext.data.Store', {
255   - fields: ['type'],
256   - data: [
257   - { 'type': 'line' },
258   - { 'type': 'scatter' }
259   - ]
260   - });
261 305  
262 306 this.parList = Ext.create('Ext.data.Store', {
263 307 fields : [ 'text', 'id']
... ... @@ -296,7 +340,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
296 340 listeners : {
297 341 scope : this,
298 342 change : function(combo, newValue, oldValue) {
299   - if (newValue) {
  343 + if (newValue) {
300 344 this.chartConfig.axes[1].fields = [newValue];
301 345 var rec = combo.findRecordByValue(newValue);
302 346 this.chartConfig.axes[1].title = rec.get('text');
... ... @@ -309,19 +353,60 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
309 353 var plotTypeCombo = Ext.create('Ext.form.ComboBox', {
310 354 emptyText: 'select plot type',
311 355 editable: false,
312   - store: plotTypeList,
  356 + store: ['scatter', 'line'],
313 357 queryMode: 'local',
314   - displayField: 'type',
315 358 valueField: 'type',
  359 + value: 'scatter',
316 360 listeners : {
317 361 scope : this,
318 362 change : function(combo, newValue, oldValue) {
319 363 this.chartConfig.series[0].type = newValue;
320 364 }
321 365 }
322   - });
323   -
324   -
  366 + });
  367 +
  368 + var plotThemeCombo = Ext.create('Ext.form.ComboBox', {
  369 + emptyText: 'select theme',
  370 + editable: false,
  371 + store: ['Base','Green','Sky','Red','Purple','Blue','Yellow'],
  372 + //'Category1','Category2','Category3','Category4','Category5','Category6'],
  373 + queryMode: 'local',
  374 + valueField: 'type',
  375 + value: 'Blue',
  376 + listeners : {
  377 + scope : this,
  378 + change : function(combo, newValue, oldValue) {
  379 + this.chartConfig.theme = newValue;
  380 + }
  381 + }
  382 + });
  383 +
  384 + var comboRangeConfig = {
  385 + // fieldLabel:'X Range',
  386 + name:'scaling',
  387 + valueField: 'scaling',
  388 + queryMode:'local',
  389 + store:['auto','manual'],
  390 + forceSelection:true,
  391 + value: 'auto',
  392 + width: 80,
  393 + listeners : {
  394 + scope : this,
  395 + change : function(combo, newValue, oldValue) {
  396 + var minValue = combo.next().next();
  397 + var maxValue = minValue.next().next();
  398 + var disabled = newValue == "auto";
  399 + minValue.reset();
  400 + maxValue.reset();
  401 + minValue.setDisabled(disabled);
  402 + maxValue.setDisabled(disabled);
  403 + }
  404 + }
  405 + };
  406 +
  407 + this.comboXrange = Ext.create('Ext.form.ComboBox', comboRangeConfig);
  408 + this.comboYrange = Ext.create('Ext.form.ComboBox', comboRangeConfig);
  409 +
325 410 var formPanel = Ext.create('Ext.form.Panel', {
326 411 region : 'center',
327 412 layout: 'hbox',
... ... @@ -357,17 +442,31 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
357 442 xtype : 'fieldcontainer',
358 443 layout: 'hbox',
359 444 items: [{
360   - xtype: 'textfield',
361   - flex: 1
362   - }, {
363   - xtype: 'splitter'
364   - }, {
365   - xtype: 'textfield',
366   - flex: 1
  445 + xtype:'fieldset',
  446 + title: 'X Range',
  447 + border: false,
  448 + layout: 'hbox',
  449 + items: [
  450 + this.comboXrange,
  451 + {
  452 + xtype: 'splitter'
  453 + }, {
  454 + xtype: 'numberfield',
  455 + hideTrigger: true,
  456 + width: 50,
  457 + disabled: true
  458 + },{
  459 + xtype: 'splitter'
  460 + },{
  461 + xtype: 'numberfield',
  462 + hideTrigger: true,
  463 + width: 50,
  464 + disabled: true
  465 + }]
367 466 }]
368 467 },
369   - { xtype : 'checkbox' },
370   - { xtype : 'checkbox' }
  468 +// { xtype : 'checkbox', boxLabel: 'Logarithmic'},
  469 + { xtype: 'textfield', fieldLabel: 'X title', name: 'xtitle'}
371 470 ]
372 471 },
373 472 {
... ... @@ -379,25 +478,47 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
379 478 xtype : 'fieldcontainer',
380 479 layout: 'hbox',
381 480 items: [{
382   - xtype: 'textfield',
383   - flex: 1
384   - }, {
385   - xtype: 'splitter'
386   - }, {
387   - xtype: 'textfield',
388   - flex: 1
389   - }
390   - ]
  481 + xtype:'fieldset',
  482 + title: 'Y Range',
  483 + border: false,
  484 + layout: 'hbox',
  485 + items: [
  486 + this.comboYrange,
  487 + {
  488 + xtype: 'splitter'
  489 + }, {
  490 + xtype: 'numberfield',
  491 + hideTrigger: true,
  492 + width: 50,
  493 + disabled: true
  494 + },{
  495 + xtype: 'splitter'
  496 + },{
  497 + xtype: 'numberfield',
  498 + hideTrigger: true,
  499 + width: 50,
  500 + disabled: true
  501 + }]
  502 + }]
391 503 },
392   - { xtype : 'checkbox' },
393   - { xtype : 'checkbox' }
  504 +// { xtype : 'checkbox', boxLabel: 'Logarithmic',
  505 +// listeners: {
  506 +// scope: this,
  507 +// change : function( check, newValue, oldValue) {
  508 +//
  509 +// }
  510 +// }
  511 +// },
  512 + { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
  513 +
394 514 ]
395 515 },
396 516 {
397 517 xtype : 'fieldset',
398 518 title : 'Plotting Options',
399 519 items : [
400   - plotTypeCombo
  520 + plotTypeCombo,
  521 + plotThemeCombo
401 522 ]
402 523 }
403 524 ],
... ...