Commit 536a676d5af196a48c861d6f939a947687c6b181

Authored by Erdogan Furkan
1 parent 0b40a169

#10701 & #10702 Done

js/app/views/CatalogVisuHistogram.js
... ... @@ -17,7 +17,7 @@ Ext.define('amdaUI.CatalogVisuHistogram', {
17 17 this.callParent(arguments);
18 18 },
19 19  
20   - getChartConfig: function(catalogStore) {
  20 + getChartConfig: function(catalogStore,isColorBar=false) {
21 21 var paramOpt = {
22 22 paramId: '',
23 23 title: 'Parameter'
... ...
js/app/views/CatalogVisuScatter.js
... ... @@ -10,20 +10,52 @@
10 10 Ext.define('amdaUI.CatalogVisuScatter', {
11 11 extend: 'Ext.form.Panel',
12 12 alias: 'widget.panelCatalogVisuScatter',
  13 + requires: [
  14 + 'amdaPlotObj.PlotObjectConfig',
  15 + 'amdaPlotComp.PlotColorPicker'
  16 + ],
  17 +
  18 + availableSymbolsTypes: [
  19 + { 'key': 'circle', 'value': 'Dot' },
  20 + { 'key': 'cross-open', 'value': 'Plus' },
  21 + { 'key': 'circle-open', 'value': 'Circle' },
  22 + { 'key': 'x-open', 'value': 'Crux' },
  23 + { 'key': 'square-open', 'value': 'Square' },
  24 + { 'key': 'triangle-up-open', 'value': 'Triangle Up' },
  25 + { 'key': 'triangle-down-open', 'value': 'Triangle Down' },
  26 + { 'key': 'triangle-left-open', 'value': 'Triangle Left' },
  27 + { 'key': 'triangle-right-open', 'value': 'Triangle Right' },
  28 + { 'key': 'circle-cross-open', 'value': 'Crux in circle' },
  29 + { 'key': 'circle-open-dot', 'value': 'Dot in circle' },
  30 + { 'key': 'diamond', 'value': 'Diamond' },
  31 + { 'key': 'star-open', 'value': 'Star' },
  32 + { 'key': 'hexagram-star-open', 'value': 'Hexagram' },
  33 + { 'key': 'square', 'value': 'Full square' },
  34 + { 'key': 'star', 'value': 'Full star' }
  35 + ],
13 36  
14 37 constructor: function(config) {
15 38 this.init(config);
16 39 this.callParent(arguments);
17 40 },
18 41  
19   - getChartConfig: function(catalogStore) {
  42 + getChartConfig: function(catalogStore, isColorBar=true) {
20 43 var plotTypeField = Ext.getCmp('visu-scatter-type');
21 44 var plotType = plotTypeField.getValue();
22 45  
23 46 var plotColorField = Ext.getCmp('visu-scatter-color');
24   - plotColor = plotColorField.getValue();
  47 + var plotColor=plotColorField.ownerCt.colorDisplayer.value;
  48 +
  49 + var plotSizeField = Ext.getCmp('visu-scatter-size');
  50 + var plotSize = plotSizeField.getValue();
  51 +
  52 + var plotSymbolField = Ext.getCmp('visu-scatter-symbol');
  53 + var plotSymbol = plotSymbolField.getValue();
  54 +
  55 + //plotColor = plotColorField.getValue();
25 56 var xAxisOpt = this.getAxisOptions('X');
26 57 var yAxisOpt = this.getAxisOptions('Y');
  58 + var zAxisOpt = this.getAxisOptions('Z');
27 59  
28 60 if ((!xAxisOpt.paramId) || (xAxisOpt.paramId == '')) {
29 61 //myDesktopApp.errorMsg('Missing parameter selection for X axis');
... ... @@ -34,12 +66,21 @@ Ext.define('amdaUI.CatalogVisuScatter', {
34 66 //myDesktopApp.errorMsg('Missing parameter selection for Y axis');
35 67 return null;
36 68 }
  69 + if ((!zAxisOpt.paramId) || (zAxisOpt.paramId == '')) {
  70 + //myDesktopApp.errorMsg('Missing parameter selection for Y axis');
  71 + isColorBar= false;
  72 + }
  73 +
37 74 var x=[];
38 75 var y=[];
  76 + var z=[];
39 77 var text=[];
40 78 catalogStore.each(function(item){
41 79 x.push(item.get(xAxisOpt.paramId));
42 80 y.push(item.get(yAxisOpt.paramId));
  81 + if (isColorBar){
  82 + z.push(item.get(zAxisOpt.paramId));
  83 + }
43 84 text.push(''+item.get('start').toISOString()+'<br>'+item.get('stop').toISOString());
44 85 });
45 86  
... ... @@ -50,7 +91,18 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
50 91 mode: (plotType=='line') ? 'lines+markers' : 'markers',
51 92 text: text,
52 93 marker:{
53   - color:plotColor},
  94 + color: (isColorBar) ? z : plotColor,
  95 + colorbar:(isColorBar) ? {
  96 + len:0.7,
  97 + title: zAxisOpt.title,
  98 + titleside:'right',
  99 + titlefont:{size:10},
  100 + } : null,
  101 + colorscale: 'Jet',
  102 + showscale:isColorBar,
  103 + symbol: plotSymbol,
  104 + size : plotSize,
  105 + },
54 106 type: 'scatter'}];
55 107  
56 108 var layout = {
... ... @@ -93,8 +145,10 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
93 145 }
94 146  
95 147 var axisScalingField = Ext.getCmp('visu-scatter-'+axisName+'-scaling');
96   - var axisScaling = axisScalingField.getValue();
97   - if (axisScaling == 'manual') {
  148 + if (axisScalingField){
  149 + var axisScaling = axisScalingField.getValue();
  150 + }
  151 + if (axisScaling == 'manual') {
98 152 var axisRangeMinField = Ext.getCmp('visu-scatter-' + axisName + '-range-min');
99 153 var axisRangeMin = axisRangeMinField.getValue();
100 154 var axisRangeMaxField = Ext.getCmp('visu-scatter-' + axisName + '-range-max');
... ... @@ -105,12 +159,13 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
105 159 };
106 160 }
107 161  
108   - opt.logscale = Ext.getCmp('visu-scatter-' + axisName + '-logbox').getValue();
109   -
  162 + if (Ext.getCmp('visu-scatter-' + axisName + '-logbox')){
  163 + opt.logscale = Ext.getCmp('visu-scatter-' + axisName + '-logbox').getValue();
  164 + }
110 165 return opt;
111 166 },
112 167  
113   - getAxisConfig: function(axisIndex, axisName, parametersStore) {
  168 + getAxisConfig: function(axisIndex, axisName, parametersStore, isColorbar = false) {
114 169 var paramComboConfig = {
115 170 xtype: 'combo',
116 171 emptyText: 'select parameter',
... ... @@ -138,7 +193,7 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
138 193 forceSelection:true,
139 194 value: 'auto',
140 195 width: 80,
141   - id: 'visu-scatter-' + axisName + '-scaling',
  196 + id: 'visu-scatter-' + axisName + '-scaling',
142 197 listeners : {
143 198 scope : this,
144 199 change : function(combo, newValue, oldValue) {
... ... @@ -222,11 +277,13 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
222 277  
223 278 return {
224 279 xtype : 'fieldset',
  280 + collapsed:isColorbar,
  281 + collapsible:true,
  282 + checkboxToggle:isColorbar,
  283 + checkboxName:axisName + ' axis-checkbox',
225 284 title : axisName + ' axis',
226   - items : [
  285 + items : (isColorbar) ? [
227 286 paramComboConfig,
228   - axisRangeConfig,
229   - logbox,
230 287 {
231 288 xtype: 'textfield',
232 289 fieldLabel: axisName + ' title',
... ... @@ -237,14 +294,41 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
237 294 },
238 295 scope: this
239 296 },
240   - }
241   - ]
  297 + }] :
  298 + [
  299 + paramComboConfig,
  300 + axisRangeConfig,
  301 + logbox,
  302 + {
  303 + xtype: 'textfield',
  304 + fieldLabel: axisName + ' title',
  305 + id: 'visu-scatter-' + axisName + '-title',
  306 + listeners:{
  307 + change:function(){
  308 + this.visuUI.plotChart();
  309 + },
  310 + scope: this
  311 + },
  312 + }
  313 + ],
  314 + listeners: (isColorbar) ? {
  315 + collapse:function(){
  316 + this.visuUI.plotChart(false);
  317 +
  318 + },
  319 + expand : function(combo, newValue, oldValue){
  320 + this.visuUI.plotChart();
  321 + },
  322 + scope: this
  323 + }: null,
242 324 };
243 325 },
244 326  
245 327 getPlottingOptionConfig: function() {
246 328 var plotTypeComboConfig = {
247 329 xtype: 'combo',
  330 + fieldLabel:'Type',
  331 + margin:'2 2 2 2',
248 332 emptyText: 'select plot type',
249 333 editable: false,
250 334 store: ['scatter', 'line'],
... ... @@ -260,10 +344,12 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
260 344 }
261 345 },scope: this
262 346 };
263   -
264   - var plotThemeComboConfig = {
  347 + var plotThemeComboConfig = this.addColorsPicker('visu-scatter-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColorsNew, 'standard');
  348 + plotThemeComboConfig.add({id:'visu-scatter-color'});
  349 + /*var plotThemeComboConfig = {
265 350 xtype: 'combo',
266 351 emptyText: 'select theme',
  352 + fieldLabel:'Color',
267 353 editable: false,
268 354 store: ['Base','Green','Sky','Red','Purple','Blue','Yellow'],
269 355 queryMode: 'local',
... ... @@ -277,24 +363,101 @@ Ext.define(&#39;amdaUI.CatalogVisuScatter&#39;, {
277 363 this.visuUI.plotChart();
278 364 }
279 365 }
  366 + }; */
  367 +
  368 + var comboStore = Ext.create('Ext.data.Store', {
  369 + fields: [amdaPlotObj.PlotObjectConfig.fieldComboBox.key, amdaPlotObj.PlotObjectConfig.fieldComboBox.value],
  370 + data: this.availableSymbolsTypes
  371 + });
  372 + var plotSymbolConfig =
  373 + {
  374 + xtype: 'combo',
  375 + store: comboStore,
  376 + fieldLabel:'Symbol',
  377 + editable:false,
  378 + margin:'2 2 2 2',
  379 + queryMode: 'local',
  380 + displayField: 'value',
  381 + valueField: 'key',
  382 + value:'circle',
  383 + id: 'visu-scatter-symbol',
  384 + listeners: {
  385 + scope : this,
  386 + change : function(combo, newValue, oldValue) {
  387 + //this.chartConfig.theme = newValue;
  388 + this.visuUI.plotChart();
  389 + }
  390 + }
280 391 };
281 392  
  393 + var plotSizeNumber=
  394 + {
  395 + xtype: 'numberfield',
  396 + layout:'hbox',
  397 + hidden: true,
  398 + width: 50,
  399 + disabled: true,
  400 + value: 5,
  401 + id: 'visu-scatter-size'
  402 + };
  403 +
  404 + var plotSizeConfig = {
  405 + xtype: 'slider',
  406 + fieldLabel: 'Size',
  407 + layout:'hbox',
  408 + margin:'2 2 2 2',
  409 + width: 80,
  410 + value: 5,
  411 + increment: 1,
  412 + minValue: 1,
  413 + maxValue: 20,
  414 + id: 'visu-scatter-size2',
  415 + listeners: {
  416 + change: function ( slider, newValue, thumb, eOpts ) {
  417 + var binValueField = Ext.getCmp('visu-scatter-size');
  418 + binValueField.setValue(newValue);
  419 + },
  420 + changecomplete: function(){
  421 + this.visuUI.plotChart();
  422 + },
  423 + scope: this
  424 + }
  425 + };
  426 +
  427 +
282 428 return {
283 429 xtype : 'fieldset',
  430 + collapsed:true,
  431 + collapsible:true,
  432 + layout:'fit',
284 433 title : 'Plotting Options',
285 434 items : [
286 435 plotTypeComboConfig,
287   - plotThemeComboConfig
  436 + plotSymbolConfig,
  437 + plotSizeConfig,
  438 + plotSizeNumber,
  439 + plotThemeComboConfig,
288 440 ]
289 441 };
290 442 },
291 443  
  444 + addColorsPicker: function (name, label, availableColors, mode) {
  445 + if (!mode) {
  446 + mode = 'standard';
  447 + }
  448 + var me =this;
  449 + return new amdaPlotComp.PlotColorPicker({name: name, label: label, mode: mode, colors: availableColors, onChange: function(name, newValue, oldValue) {
  450 + me.visuUI.plotChart();
  451 + }});
  452 + },
  453 +
292 454 init : function (config)
293 455 {
294 456 var myConf = {
295 457 items: [
296 458 this.getAxisConfig(0,'X', config.parametersStore),
297 459 this.getAxisConfig(0,'Y', config.parametersStore),
  460 + this.getAxisConfig(0,'Z', config.parametersStore,true),
298 461 this.getPlottingOptionConfig()
299 462 ]
300 463 };
... ...
js/app/views/VisuUI.js
... ... @@ -149,9 +149,9 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
149 149 return false;
150 150 },
151 151  
152   - plotChart: function () {
  152 + plotChart: function (isColorBar) {
153 153 var tabPanel = Ext.getCmp('visu-tabpanel');
154   - var allData = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore);
  154 + var allData = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore,isColorBar);
155 155 this.replaceChart(allData);
156 156 },
157 157  
... ...