Commit 24b02d83daa0c197b2f252d7eaf10befb3ac354a

Authored by Benjamin Renard
1 parent 6a801541

Add definition of a time tick for a serie of a xyPlot

js/app/models/PlotObjects/PlotAxisObject.js
... ... @@ -28,12 +28,14 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
28 28 {name: 'axis-scale', type: 'string'},
29 29 {name: 'axis-range-min', type: 'float'},
30 30 {name: 'axis-range-max', type: 'float'},
31   - {name: 'axis-range-extend', type: 'bool'},
  31 + {name: 'axis-range-extend', type: 'boolean'},
32 32 {name: 'axis-color', type: 'string'},
33 33 {name: 'axis-thickness', type: 'int'},
  34 + {name: 'axis-tick-showmarks', type: 'boolean'},
34 35 {name: 'axis-tick-position', type: 'string'},
35   - {name: 'axis-grid-minor', type: 'bool'},
36   - {name: 'axis-grid-major', type: 'bool'},
  36 + {name: 'axis-grid-minor', type: 'boolean'},
  37 + {name: 'axis-grid-major', type: 'boolean'},
  38 + {name: 'axis-legend-activated', type: 'boolean'},
37 39 {name: 'axis-legend-text', type: 'string'},
38 40 {name: 'axis-legend-color', type: 'string'},
39 41 {name: 'axis-legend-font-activated', type: 'boolean'},
... ... @@ -68,9 +70,11 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
68 70 this.set('axis-range-extend', true);
69 71 this.set('axis-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.color);
70 72 this.set('axis-thickness', amdaPlotObj.PlotObjectConfig.defaultValues.axis.thickness);
  73 + this.set('axis-tick-showmarks', true);
71 74 this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition);
72 75 this.set('axis-grid-minor', false);
73 76 this.set('axis-grid-major', false);
  77 + this.set('axis-legend-activated', true);
74 78 this.set('axis-legend-text', '');
75 79 this.set('axis-legend-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.color);
76 80 this.set('axis-legend-font-activated', false);
... ... @@ -97,9 +101,11 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
97 101 axisValues['axis-range-extend'] = this.get('axis-range-extend');
98 102 axisValues['axis-color'] = this.get('axis-color');
99 103 axisValues['axis-thickness'] = this.get('axis-thickness');
  104 + axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks');
100 105 axisValues['axis-tick-position'] = this.get('axis-tick-position');
101 106 axisValues['axis-grid-minor'] = this.get('axis-grid-minor');
102 107 axisValues['axis-grid-major'] = this.get('axis-grid-major');
  108 + axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
103 109 axisValues['axis-legend-text'] = this.get('axis-legend-text');
104 110 axisValues['axis-legend-color'] = this.get('axis-legend-color');
105 111 axisValues['axis-legend-font-activated'] = this.get('axis-legend-font-activated');
... ...
js/app/models/PlotObjects/PlotInstantSerieObject.js
... ... @@ -22,11 +22,11 @@ Ext.define('amdaPlotObj.PlotInstantSerieObject', {
22 22  
23 23 fields : [
24 24 {name: 'iserie-tableonx', type: 'boolean'},
25   - {name: 'iserie-lines-activated', type: 'bool'},
  25 + {name: 'iserie-lines-activated', type: 'boolean'},
26 26 {name: 'iserie-lines-style', type: 'string'},
27 27 {name: 'iserie-lines-width', type: 'float'},
28 28 {name: 'iserie-lines-color', type: 'string'},
29   - {name: 'iserie-symbols-activated', type: 'bool'},
  29 + {name: 'iserie-symbols-activated', type: 'boolean'},
30 30 {name: 'iserie-symbols-type', type: 'string'},
31 31 {name: 'iserie-symbols-size', type: 'float'},
32 32 {name: 'iserie-symbols-color', type: 'string'}
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -88,7 +88,28 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
88 88 size : 3,
89 89 color : 'auto'
90 90 },
91   - resamplingMode : 'xparam'
  91 + resamplingMode : 'xparam',
  92 + timetick : {
  93 + type: 'auto',
  94 + step: 3600,
  95 + nbmajor : 5,
  96 + nbminor : 5,
  97 + color : '#FF0000',
  98 + symbols : {
  99 + type: 'full-circle',
  100 + size: 10,
  101 + color: '#FF0000'
  102 + },
  103 + firstsymbols : {
  104 + type: 'triangle',
  105 + size: 4,
  106 + color: '#00FF00'
  107 + },
  108 + font : {
  109 + name : 'sans-serif',
  110 + size: '12'
  111 + }
  112 + }
92 113 },
93 114 spectro : {
94 115 yAxis : 'y-left'
... ... @@ -211,13 +232,15 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
211 232 availableColors : [
212 233 {'color' : '#000000', 'value' : 'Black'},
213 234 {'color' : '#0000FF', 'value' : 'Blue'},
214   - {'color' : '#FF0000', 'value' : 'Red'}
  235 + {'color' : '#FF0000', 'value' : 'Red'},
  236 + {'color' : '#00FF00', 'value' : 'Green'}
215 237 ],
216 238  
217 239 availableBackgroundColors : [
218 240 {'color' : 'none', 'value' : 'None'},
219 241 {'color' : '#0000FF', 'value' : 'Blue'},
220   - {'color' : '#FF0000', 'value' : 'Red'}
  242 + {'color' : '#FF0000', 'value' : 'Red'},
  243 + {'color' : '#00FF00', 'value' : 'Green'}
221 244 ],
222 245  
223 246 availableStatusBarPositions : [
... ... @@ -245,5 +268,11 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
245 268 availableDimsOnXAxis : [
246 269 {'key' : '0', 'value' : 'First dimension'},
247 270 {'key' : '1', 'value' : 'Second dimension'}
  271 + ],
  272 +
  273 + availableTimeTickTypes : [
  274 + {'key' : 'auto', 'value' : 'Auto'},
  275 + {'key' : 'time-step', 'value' : 'Time step'},
  276 + {'key' : 'nb-major', 'value' : 'Num. of major symb.'}
248 277 ]
249 278 });
250 279 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotSerieObject.js
... ... @@ -22,18 +22,38 @@ Ext.define('amdaPlotObj.PlotSerieObject', {
22 22  
23 23 fields : [
24 24 {name: 'serie-yaxis', type: 'string'},
25   - {name: 'serie-lines-activated', type: 'bool'},
  25 + {name: 'serie-lines-activated', type: 'boolean'},
26 26 {name: 'serie-lines-style', type: 'string'},
27 27 {name: 'serie-lines-width', type: 'float'},
28 28 {name: 'serie-lines-color', type: 'string'},
29   - {name: 'serie-symbols-activated', type: 'bool'},
  29 + {name: 'serie-symbols-activated', type: 'boolean'},
30 30 {name: 'serie-symbols-type', type: 'string'},
31 31 {name: 'serie-symbols-size', type: 'float'},
32 32 {name: 'serie-symbols-color', type: 'string'},
33 33 {name: 'serie-colored-param', type: 'string'},
  34 +
34 35 //Only used for xyPlot
35 36 {name: 'serie-xaxis-param', type: 'string'},
36   - {name: 'serie-resampling-mode', type: 'string'}
  37 + {name: 'serie-resampling-mode', type: 'string'},
  38 + //Time tick
  39 + {name: 'serie-timetick-activated', type: 'boolean'},
  40 + {name: 'serie-timetick-type', type: 'string'},
  41 + {name: 'serie-timetick-step', type: 'float'},
  42 + {name: 'serie-timetick-nbmajor', type: 'int'},
  43 + {name: 'serie-timetick-nbminor', type: 'int'},
  44 + {name: 'serie-timetick-color', type: 'string'},
  45 + {name: 'serie-timetick-symbols-type', type: 'string'},
  46 + {name: 'serie-timetick-symbols-size', type: 'float'},
  47 + {name: 'serie-timetick-symbols-color', type: 'string'},
  48 + {name: 'serie-timetick-firstsymbols-activated', type: 'boolean'},
  49 + {name: 'serie-timetick-firstsymbols-type', type: 'string'},
  50 + {name: 'serie-timetick-firstsymbols-size', type: 'float'},
  51 + {name: 'serie-timetick-firstsymbols-color', type: 'string'},
  52 + {name: 'serie-timetick-font-activated', type: 'boolean'},
  53 + {name: 'serie-timetick-font-name', type: 'string'},
  54 + {name: 'serie-timetick-font-size', type: 'int'},
  55 + {name: 'serie-timetick-font-bold', type: 'boolean'},
  56 + {name: 'serie-timetick-font-italic', type: 'boolean'}
37 57 ],
38 58  
39 59 setDefaultValues: function()
... ... @@ -48,6 +68,26 @@ Ext.define('amdaPlotObj.PlotSerieObject', {
48 68 this.set('serie-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.size);
49 69 this.set('serie-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.color);
50 70 this.set('serie-colored-param', '');
  71 +
  72 + this.set('serie-timetick-activated', false);
  73 + this.set('serie-timetick-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.type);
  74 + this.set('serie-timetick-step', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.step);
  75 + this.set('serie-timetick-nbmajor', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.nbmajor);
  76 + this.set('serie-timetick-nbminor', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.nbminor);
  77 + this.set('serie-timetick-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.color);
  78 + this.set('serie-timetick-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.type);
  79 + this.set('serie-timetick-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.size);
  80 + this.set('serie-timetick-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.color);
  81 + this.set('serie-timetick-firstsymbols-activated', false);
  82 + this.set('serie-timetick-firstsymbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.type);
  83 + this.set('serie-timetick-firstsymbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.size);
  84 + this.set('serie-timetick-firstsymbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.color);
  85 + this.set('serie-timetick-font-activated', false);
  86 + this.set('serie-timetick-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.font.name);
  87 + this.set('serie-timetick-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.font.size);
  88 + this.set('serie-timetick-font-bold', false);
  89 + this.set('serie-timetick-font-italic', false);
  90 +
51 91 this.set('serie-xaxis-param', '');
52 92 this.set('serie-resampling-mode', amdaPlotObj.PlotObjectConfig.defaultValues.serie.resamplingMode);
53 93 },
... ... @@ -69,6 +109,28 @@ Ext.define('amdaPlotObj.PlotSerieObject', {
69 109 serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param');
70 110 serieValues['serie-resampling-mode'] = this.get('serie-resampling-mode');
71 111  
  112 + if (this.get('serie-timetick-activated'))
  113 + {
  114 + serieValues['serie-timetick'] = new Object();
  115 + serieValues['serie-timetick']['serie-timetick-type'] = this.get('serie-timetick-type');
  116 + serieValues['serie-timetick']['serie-timetick-step'] = this.get('serie-timetick-step');
  117 + serieValues['serie-timetick']['serie-timetick-nbmajor'] = this.get('serie-timetick-nbmajor');
  118 + serieValues['serie-timetick']['serie-timetick-nbminor'] = this.get('serie-timetick-nbminor');
  119 + serieValues['serie-timetick']['serie-timetick-color'] = this.get('serie-timetick-color');
  120 + serieValues['serie-timetick']['serie-timetick-symbols-type'] = this.get('serie-timetick-symbols-type');
  121 + serieValues['serie-timetick']['serie-timetick-symbols-size'] = this.get('serie-timetick-symbols-size');
  122 + serieValues['serie-timetick']['serie-timetick-symbols-color'] = this.get('serie-timetick-symbols-color');
  123 + serieValues['serie-timetick']['serie-timetick-firstsymbols-activated'] = this.get('serie-timetick-firstsymbols-activated');
  124 + serieValues['serie-timetick']['serie-timetick-firstsymbols-type'] = this.get('serie-timetick-firstsymbols-type');
  125 + serieValues['serie-timetick']['serie-timetick-firstsymbols-size'] = this.get('serie-timetick-firstsymbols-size');
  126 + serieValues['serie-timetick']['serie-timetick-firstsymbols-color'] = this.get('serie-timetick-firstsymbols-color');
  127 + serieValues['serie-timetick']['serie-timetick-font-activated'] = this.get('serie-timetick-font-activated');
  128 + serieValues['serie-timetick']['serie-timetick-font-name'] = this.get('serie-timetick-font-name');
  129 + serieValues['serie-timetick']['serie-timetick-font-size'] = this.get('serie-timetick-font-size');
  130 + serieValues['serie-timetick']['serie-timetick-font-bold'] = this.get('serie-timetick-font-bold');
  131 + serieValues['serie-timetick']['serie-timetick-font-italic'] = this.get('serie-timetick-font-italic');
  132 + }
  133 +
72 134 return serieValues;
73 135 }
74 136 });
75 137 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotBaseAxisForm.js
... ... @@ -24,15 +24,16 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', {
24 24 ];
25 25  
26 26 var legendItems = [
27   - this.addStandardText('axis-legend-text', 'Text'),
  27 + this.addStandardText('axis-legend-text', 'Text'),
28 28 this.addStandardColor('axis-legend-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
29 29 this.addStandardFont('axis-legend-font')
30 30 ];
31 31  
32 32 var tickGridItems = [
33 33 this.addStandardCombo('axis-tick-position', 'Ticks position', amdaPlotObj.PlotObjectConfig.availableTicksPositions),
34   - this.addStandardCheck('axis-grid-major', 'Major grid'),
35   - this.addStandardCheck('axis-grid-minor', 'Minor grid')
  34 + this.addStandardCheck('axis-tick-showmarks', 'Show tick marks'),
  35 + this.addStandardCheck('axis-grid-major', 'Show major grid'),
  36 + this.addStandardCheck('axis-grid-minor', 'Show minor grid')
36 37 ];
37 38  
38 39 var axisItems = [];
... ... @@ -44,7 +45,7 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', {
44 45 axisItems.push(this.addStandardCheck('axis-reverse', 'Reverse direction'));
45 46 if (this.showRangeOptions)
46 47 axisItems.push(this.addStandardFieldSet('Range', '', rangeItems));
47   - axisItems.push(this.addStandardFieldSet('Legend', '', legendItems));
  48 + axisItems.push(this.addStandardFieldSet('Legend', 'axis-legend-activated', legendItems));
48 49 if (this.showTickGridOptions)
49 50 axisItems.push(this.addStandardFieldSet('Ticks and Grid', '', tickGridItems));
50 51  
... ...
js/app/views/PlotComponents/PlotInstantSerieForm.js
... ... @@ -17,22 +17,12 @@ Ext.define('amdaPlotComp.PlotInstantSerieForm', {
17 17 },
18 18  
19 19 getFormItems: function() {
20   - var linesItems = [
21   - this.addStandardCombo('iserie-lines-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
22   - this.addStandardFloat('iserie-lines-width', 'Width', 1, 10),
23   - this.addStandardColor('iserie-lines-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
24   - ];
25 20  
26   - var symbolsItems = [
27   - this.addStandardCombo('iserie-symbols-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
28   - this.addStandardFloat('iserie-symbols-size', 'Size', 1, 10),
29   - this.addStandardColor('iserie-symbols-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
30   - ];
31 21  
32 22 return [
33 23 this.addStandardCheck('iserie-tableonx', 'Table on X axis'),
34   - this.addStandardFieldSet('Lines', 'iserie-lines-activated', linesItems),
35   - this.addStandardFieldSet('Symbols', 'iserie-symbols-activated', symbolsItems)
  24 + this.addStandardFieldSet('Lines', 'iserie-lines-activated', this.addStandardLineItems('iserie-lines')),
  25 + this.addStandardFieldSet('Symbols', 'iserie-symbols-activated', this.addStandardSymbolsItems('iserie-symbols'))
36 26 ];
37 27 }
38 28 });
39 29 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotSerieForm.js
... ... @@ -18,33 +18,65 @@ Ext.define('amdaPlotComp.PlotSerieForm', {
18 18 },
19 19  
20 20 updateOptions: function(plotType) {
  21 + var isScatter = (plotType == 'xyPlot');
  22 +
21 23 var xParamField = this.getForm().findField('serie-xaxis-param');
22 24 var resamplingModeField = this.getForm().findField('serie-resampling-mode');
23   - var isScatter = (plotType == 'xyPlot');
  25 + var timeTickTypeField = this.getForm().findField('serie-timetick-type');
  26 + var timeTickFieldSet = timeTickTypeField.findParentByType('fieldset');
  27 +
24 28 xParamField.setVisible(isScatter);
25 29 resamplingModeField.setVisible(isScatter);
  30 + timeTickFieldSet.setVisible(isScatter);
  31 +
  32 + if (isScatter)
  33 + {
  34 + //Update Time Tick field
  35 + var timeTickStepField = this.getForm().findField('serie-timetick-step');
  36 + var timeTickNbMajorField = this.getForm().findField('serie-timetick-nbmajor');
  37 + switch (timeTickTypeField.getValue())
  38 + {
  39 + case 'time-step' :
  40 + timeTickStepField.setVisible(true);
  41 + timeTickNbMajorField.setVisible(false);
  42 + break;
  43 + case 'nb-major' :
  44 + timeTickStepField.setVisible(false);
  45 + timeTickNbMajorField.setVisible(true);
  46 + break;
  47 + case 'auto' :
  48 + default :
  49 + timeTickStepField.setVisible(false);
  50 + timeTickNbMajorField.setVisible(false);
  51 + }
  52 + }
26 53 },
27 54  
28   - getFormItems: function() {
29   - var linesItems = [
30   - this.addStandardCombo('serie-lines-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
31   - this.addStandardFloat('serie-lines-width', 'Width', 1, 10),
32   - this.addStandardColor('serie-lines-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  55 + getTimeTickItems: function() {
  56 + var me = this;
  57 + return [
  58 + this.addStandardCombo('serie-timetick-type', 'Type', amdaPlotObj.PlotObjectConfig.availableTimeTickTypes, function(name, value, oldValue) {
  59 + me.updateOptions(me.crtTree.getSelectedPlotType());
  60 + }),
  61 + this.addStandardFloat('serie-timetick-step', 'Time step (sec.)'),
  62 + this.addStandardFloat('serie-timetick-nbmajor', 'Number of major ticks'),
  63 + this.addStandardFloat('serie-timetick-nbminor', 'Number of minor ticks'),
  64 + this.addStandardColor('serie-timetick-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
  65 + this.addStandardFieldSet('Symbols', '', this.addStandardSymbolsItems('serie-timetick-symbols')),
  66 + this.addStandardFieldSet('First symbol', 'serie-timetick-firstsymbols-activated', this.addStandardSymbolsItems('serie-timetick-firstsymbols')),
  67 + this.addStandardFont('serie-timetick-font')
33 68 ];
34   -
35   - var symbolsItems = [
36   - this.addStandardCombo('serie-symbols-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
37   - this.addStandardFloat('serie-symbols-size', 'Size', 1, 10),
38   - this.addStandardColor('serie-symbols-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
39   - ];
40   -
  69 + },
  70 +
  71 + getFormItems: function() {
41 72 return [
42 73 this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter'),
43 74 this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaPlotObj.PlotObjectConfig.availableResamplingModes),
44 75 this.addStandardCombo('serie-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes),
45 76 this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'),
46   - this.addStandardFieldSet('Lines', 'serie-lines-activated', linesItems),
47   - this.addStandardFieldSet('Symbols', 'serie-symbols-activated', symbolsItems)
  77 + this.addStandardFieldSet('Lines', 'serie-lines-activated', this.addStandardLineItems('serie-lines')),
  78 + this.addStandardFieldSet('Symbols', 'serie-symbols-activated', this.addStandardSymbolsItems('serie-symbols')),
  79 + this.addStandardFieldSet('Time ticks', 'serie-timetick-activated', this.getTimeTickItems())
48 80 ];
49 81 }
50 82 });
51 83 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -283,6 +283,22 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
283 283 };
284 284 },
285 285  
  286 + addStandardLineItems: function(namePrefix) {
  287 + return [
  288 + this.addStandardCombo(namePrefix+'-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
  289 + this.addStandardFloat(namePrefix+'-width', 'Width', 1, 10),
  290 + this.addStandardColor(namePrefix+'-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  291 + ];
  292 + },
  293 +
  294 + addStandardSymbolsItems: function(namePrefix) {
  295 + return [
  296 + this.addStandardCombo(namePrefix+'-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
  297 + this.addStandardFloat(namePrefix+'-size', 'Size', 1, 10),
  298 + this.addStandardColor(namePrefix+'-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  299 + ];
  300 + },
  301 +
286 302 init : function(config) {
287 303 var me = this;
288 304  
... ...