Commit 94abdb37e24194d2791aa14c6137490beb7e5bf8

Authored by Benjamin Renard
1 parent 24b02d83

Add params legend definition

js/app/models/PlotObjects/PlotLegendSeriesObject.js 0 → 100644
... ... @@ -0,0 +1,79 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotLegendSeriesObject.js
  4 + * @class amdaPlotObj.PlotLegendSeriesObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Series Legend Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotLegendSeriesObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :31/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'legend-series-activated', type: 'boolean'},
  25 + {name: 'legend-series-type', type: 'string'},
  26 + {name: 'legend-series-position', type: 'string'},
  27 + {name: 'legend-series-showparaminfo', type: 'boolean'},
  28 + {name: 'legend-series-defaulttextcolor', type: 'string'},
  29 + {name: 'legend-series-border-activated', type: 'boolean'},
  30 + {name: 'legend-series-border-color', type: 'string'},
  31 + {name: 'legend-series-intervalinfo-activated', type: 'boolean'},
  32 + {name: 'legend-series-intervalinfo-type', type: 'string'},
  33 + {name: 'legend-series-font-activated', type: 'boolean'},
  34 + {name: 'legend-series-font-name', type: 'string'},
  35 + {name: 'legend-series-font-size', type: 'int'},
  36 + {name: 'legend-series-font-bold', type: 'boolean'},
  37 + {name: 'legend-series-font-italic', type: 'boolean'}
  38 + ],
  39 +
  40 + setDefaultValues: function()
  41 + {
  42 + this.set('legend-series-activated', false);
  43 + this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type);
  44 + this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position);
  45 + this.set('legend-series-showparaminfo', true);
  46 + this.set('legend-series-defaulttextcolor', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.text.color);
  47 + this.set('legend-series-border-activated', false);
  48 + this.set('legend-series-border-color', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.border.color);
  49 + this.set('legend-series-intervalinfo-activated', false);
  50 + this.set('legend-series-intervalinfo-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.intervalinfo.type);
  51 + this.set('legend-series-font-activated', false);
  52 + this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name);
  53 + this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size);
  54 + this.set('legend-series-font-bold', false);
  55 + this.set('legend-series-font-italic', false);
  56 + },
  57 +
  58 + getJsonValues : function()
  59 + {
  60 + var legendValues = new Object();
  61 +
  62 + legendValues['legend-series-activated'] = this.get('legend-series-activated');
  63 + legendValues['legend-series-type'] = this.get('legend-series-type');
  64 + legendValues['legend-series-position'] = this.get('legend-series-position');
  65 + legendValues['legend-series-showparaminfo'] = this.get('legend-series-showparaminfo');
  66 + legendValues['legend-series-defaulttextcolor'] = this.get('legend-series-defaulttextcolor');
  67 + legendValues['legend-series-border-activated'] = this.get('legend-series-border-activated');
  68 + legendValues['legend-series-border-color'] = this.get('legend-series-border-color');
  69 + legendValues['legend-series-intervalinfo-activated'] = this.get('legend-series-intervalinfo-activated');
  70 + legendValues['legend-series-intervalinfo-type'] = this.get('legend-series-intervalinfo-type');
  71 + legendValues['legend-series-font-activated'] = this.get('legend-series-font-activated');
  72 + legendValues['legend-series-font-name'] = this.get('legend-series-font-name');
  73 + legendValues['legend-series-font-size'] = this.get('legend-series-font-size');
  74 + legendValues['legend-series-font-bold'] = this.get('legend-series-font-bold');
  75 + legendValues['legend-series-font-italic'] = this.get('legend-series-font-italic');
  76 +
  77 + return legendValues;
  78 + }
  79 +});
0 80 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -113,6 +113,25 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
113 113 },
114 114 spectro : {
115 115 yAxis : 'y-left'
  116 + },
  117 + legends : {
  118 + series : {
  119 + type : 'text-only',
  120 + position : 'outside',
  121 + text: {
  122 + color : '#000000'
  123 + },
  124 + border: {
  125 + color : '#000000'
  126 + },
  127 + intervalinfo : {
  128 + type : 'start-stop'
  129 + },
  130 + font : {
  131 + name : 'sans-serif',
  132 + size: '12'
  133 + }
  134 + }
116 135 }
117 136 },
118 137  
... ... @@ -274,5 +293,20 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
274 293 {'key' : 'auto', 'value' : 'Auto'},
275 294 {'key' : 'time-step', 'value' : 'Time step'},
276 295 {'key' : 'nb-major', 'value' : 'Num. of major symb.'}
277   - ]
  296 + ],
  297 +
  298 + availableLegendSeriesTypes : [
  299 + {'key' : 'text-line-symbol', 'value' : 'Text, Line & Symbols'},
  300 + {'key' : 'text-only', 'value' : 'Text only'}
  301 + ],
  302 +
  303 + availableLegendSeriesPositions : [
  304 + {'key' : 'inside', 'value' : 'Inside'},
  305 + {'key' : 'outside', 'value' : 'Outside'}
  306 + ],
  307 +
  308 + availableLegendSeriesIntervalInfoTypes : [
  309 + {'key' : 'index', 'value' : 'Interval Index'},
  310 + {'key' : 'start-stop', 'value' : 'Interval Start/Stop'}
  311 + ]
278 312 });
279 313 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -21,7 +21,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
21 21 requires: [
22 22 'amdaPlotObj.PlotObjectConfig',
23 23 'amdaPlotObj.PlotAxisObject',
24   - 'amdaPlotObj.PlotParamObject'
  24 + 'amdaPlotObj.PlotParamObject',
  25 + 'amdaPlotObj.PlotLegendSeriesObject'
25 26 ],
26 27  
27 28 fields : [
... ... @@ -72,7 +73,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
72 73 }
73 74 return value;
74 75 }
75   - }
  76 + },
  77 + //Only used for timePlot, xyPlot, epochPlot and instantPlot
  78 + {name: 'panel-legend-series', type: 'auto', defaultValue: null}
76 79 ],
77 80  
78 81 associations : [
... ... @@ -225,6 +228,17 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
225 228 }
226 229 });
227 230 this.initAxes();
  231 +
  232 + if ((plotType == 'timePlot') || (plotType == 'xyPlot') || (plotType == 'epochPlot') || (plotType == 'instantPlot'))
  233 + {
  234 + if (this.get('panel-legend-series') == null)
  235 + {
  236 + this.set('panel-legend-series', new amdaPlotObj.PlotLegendSeriesObject());
  237 + this.get('panel-legend-series').setDefaultValues();
  238 + }
  239 + }
  240 + else
  241 + this.set('panel-legend-series', null);
228 242 },
229 243  
230 244 setDefaultValues: function()
... ... @@ -322,6 +336,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
322 336 if (this.get('panel-plot-type') == 'instantPlot')
323 337 panelValues['panel-instant-time'] = this.get('panel-instant-time');
324 338  
  339 + if ((this.get('panel-legend-series') != null) && this.get('panel-legend-series').get('legend-series-activated'))
  340 + panelValues['panel-series-legend'] = this.get('panel-legend-series').getJsonValues();
  341 +
325 342 panelValues['axes'] = [];
326 343  
327 344 this.axes().each(function (axe, index) {
... ...
js/app/models/PlotObjects/PlotSerieObject.js
... ... @@ -78,7 +78,7 @@ Ext.define('amdaPlotObj.PlotSerieObject', {
78 78 this.set('serie-timetick-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.type);
79 79 this.set('serie-timetick-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.size);
80 80 this.set('serie-timetick-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.color);
81   - this.set('serie-timetick-firstsymbols-activated', false);
  81 + this.set('serie-timetick-firstsymbols-activated', true);
82 82 this.set('serie-timetick-firstsymbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.type);
83 83 this.set('serie-timetick-firstsymbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.size);
84 84 this.set('serie-timetick-firstsymbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.color);
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -232,12 +232,79 @@ Ext.define('amdaPlotObj.PlotParamTreeNode', {
232 232 }
233 233 });
234 234  
  235 +Ext.define('amdaPlotObj.PlotAdditionalObjectsTreeNode', {
  236 + extend: 'amdaPlotObj.PlotTreeNode',
  237 +
  238 + expanded: false,
  239 +
  240 + iconCls: 'icon-plot-add-objs',
  241 +
  242 + text: 'Additional Objects',
  243 +
  244 + type: 'objects'
  245 +});
  246 +
235 247 Ext.define('amdaPlotObj.PlotLegendsTreeNode', {
236 248 extend: 'amdaPlotObj.PlotTreeNode',
237 249  
238   - iconCls: 'icon-plot-legends',
  250 + iconCls: 'icon-plot-add-legends',
239 251  
240 252 text: 'Legends',
241 253  
242 254 type: 'legends'
243 255 });
  256 +
  257 +Ext.define('amdaPlotObj.PlotSeriesLegendTreeNode', {
  258 + extend: 'amdaPlotObj.PlotTreeNode',
  259 +
  260 + leaf: true,
  261 +
  262 + iconCls: 'icon-plot-add-legend-series',
  263 +
  264 + text: 'Series Legend',
  265 +
  266 + type: 'series-legend'
  267 +});
  268 +
  269 +Ext.define('amdaPlotObj.PlotTextLegendsTreeNode', {
  270 + extend: 'amdaPlotObj.PlotTreeNode',
  271 +
  272 + iconCls: 'icon-plot-add-legends-text',
  273 +
  274 + text: 'Text Legends',
  275 +
  276 + type: 'text-legends'
  277 +});
  278 +
  279 +Ext.define('amdaPlotObj.PlotTextLegendTreeNode', {
  280 + extend: 'amdaPlotObj.PlotTreeNode',
  281 +
  282 + leaf: true,
  283 +
  284 + iconCls: 'icon-plot-add-legend-text',
  285 +
  286 + text: 'Text Legend',
  287 +
  288 + type: 'text-legend'
  289 +});
  290 +
  291 +/*
  292 + * .icon-plot-add-objs {
  293 + background-image:url( ../images/16x16/plot_additional_objs.png ) !important;
  294 +}
  295 +
  296 +.icon-plot-add-legends {
  297 + background-image:url( ../images/16x16/plot_additional_legends.png ) !important;
  298 +}
  299 +
  300 +.icon-plot-add-legend-series {
  301 + background-image:url( ../images/16x16/plot_additional_series_legend.png ) !important;
  302 +}
  303 +
  304 +.icon-plot-add-legends-text {
  305 + background-image:url( ../images/16x16/plot_additional_text_legends.png ) !important;
  306 +}
  307 +
  308 +.icon-plot-add-legend-text {
  309 + background-image:url( ../images/16x16/plot_additional_text_legend.png ) !important;
  310 +}*/
... ...
js/app/views/PlotComponents/PlotElementPanel.js
... ... @@ -19,7 +19,8 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
19 19 'amdaPlotComp.PlotEpochAxisForm',
20 20 'amdaPlotComp.PlotColorAxisForm',
21 21 'amdaPlotComp.PlotParamForm',
22   - 'amdaPlotComp.PlotLayoutForm'
  22 + 'amdaPlotComp.PlotLayoutForm',
  23 + 'amdaPlotComp.PlotLegendSeriesForm'
23 24 ],
24 25  
25 26 elementFormsManager : new Ext.AbstractManager(),
... ... @@ -86,6 +87,9 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
86 87 case 'layout' :
87 88 this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId}));
88 89 break;
  90 + case 'series-legend' :
  91 + this.elementFormsManager.register(new amdaPlotComp.PlotLegendSeriesForm({id : formId}));
  92 + break;
89 93 case '' :
90 94 this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'}));
91 95 break;
... ...
js/app/views/PlotComponents/PlotLegendSeriesForm.js 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotLegendSeriesForm.js
  4 + * @class amdaPlotComp.PlotLegendSeriesForm
  5 + * @extends amdaPlotComp.PlotStandardForm
  6 + * @brief Form to define specifics series legend options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotLegendSeriesForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotLegendSeriesForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + setObject : function(object) {
  15 + this.object = object.get('panel-legend-series');
  16 + if (this.object != null)
  17 + this.loadRecord(this.object);
  18 + var legendTypeField = this.getForm().findField('legend-series-type');
  19 + var legendFieldSet = legendTypeField.findParentByType('fieldset');
  20 + legendFieldSet.setVisible(this.object != null);
  21 + },
  22 +
  23 + getFormItems: function() {
  24 + var borderItems = [
  25 + this.addStandardColor('legend-series-border-color', 'Border Color', amdaPlotObj.PlotObjectConfig.availableColors),
  26 + ];
  27 +
  28 + var intervalInfoItems = [
  29 + this.addStandardCombo('legend-series-intervalinfo-type', 'Type', amdaPlotObj.PlotObjectConfig.availableLegendSeriesIntervalInfoTypes)
  30 + ];
  31 +
  32 + var legendItems = [
  33 + this.addStandardCombo('legend-series-type', 'Type', amdaPlotObj.PlotObjectConfig.availableLegendSeriesTypes),
  34 + this.addStandardCombo('legend-series-position', 'Position', amdaPlotObj.PlotObjectConfig.availableLegendSeriesPositions),
  35 + this.addStandardColor('legend-series-defaulttextcolor', 'Default Text Color', amdaPlotObj.PlotObjectConfig.availableColors),
  36 + this.addStandardCheck('legend-series-showparaminfo', 'Show Param Info'),
  37 + this.addStandardFieldSet('Show Interval Info', 'legend-series-intervalinfo-activated', intervalInfoItems),
  38 + this.addStandardFieldSet('Border', 'legend-series-border-activated', borderItems),
  39 + this.addStandardFont('legend-series-font')
  40 + ];
  41 +
  42 + return [
  43 + this.addStandardFieldSet('Activate legend', 'legend-series-activated', legendItems)
  44 + ];
  45 + }
  46 +});
0 47 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -162,11 +162,51 @@ Ext.define('amdaPlotComp.PlotTree', {
162 162 this.getSelectionModel().select(selectedParamNode);
163 163 },
164 164  
  165 + buildPanelAdditionalObjectsNode: function(panelObject) {
  166 + var objectsNode = null;
  167 +
  168 + var me = this;
  169 + this.panelsNode.eachChild(function (panelNode) {
  170 + //Retrieve corresponding panel node
  171 + if (panelNode.object == panelObject)
  172 + {
  173 + //Retrieve additional objects node
  174 + objectsNode = panelNode.findChild('type', 'objects');
  175 + if (!objectsNode)
  176 + {
  177 + //create additional objects node
  178 + objectsNode = panelNode.appendChild(new amdaPlotObj.PlotAdditionalObjectsTreeNode({object : panelObject}));
  179 +
  180 + //create legends node
  181 + me.buildPanelLegendsNode(panelObject, objectsNode);
  182 + }
  183 + return;
  184 + }
  185 + });
  186 +
  187 + if (objectsNode == null)
  188 + return;
  189 +
  190 + this.getView().refresh();
  191 + },
  192 +
  193 + buildPanelLegendsNode: function(panelObject, objectsNode) {
  194 + var legendsNode = objectsNode.appendChild(new amdaPlotObj.PlotLegendsTreeNode({object : panelObject}));
  195 +
  196 + legendsNode.appendChild(new amdaPlotObj.PlotSeriesLegendTreeNode({object : panelObject}));
  197 +
  198 + legendsNode.appendChild(new amdaPlotObj.PlotTextLegendsTreeNode({object : panelObject}));
  199 + },
  200 +
165 201 addPanelNode: function(panelObject) {
166 202 var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject}));
167 203 if (!this.isSimplifiedView)
  204 + {
168 205 //Axes node
169 206 this.buildPanelAxesNode(panelObject);
  207 + //Additional objects
  208 + this.buildPanelAdditionalObjectsNode(panelObject);
  209 + }
170 210 //Params node
171 211 this.buildPanelParamsNode(panelObject);
172 212 return panelNode;
... ...
js/resources/css/amda.css
... ... @@ -410,10 +410,6 @@ p + p {
410 410 background-image:url( ../images/16x16/plot_axes.png ) !important;
411 411 }
412 412  
413   -.icon-plot-legends {
414   - background-image:url( ../images/16x16/plot_legends.png ) !important;
415   -}
416   -
417 413 .icon-plot-axis-t {
418 414 background-image:url( ../images/16x16/plot_axis_t.png ) !important;
419 415 }
... ... @@ -442,6 +438,26 @@ p + p {
442 438 background-image:url( ../images/16x16/plot_params.png ) !important;
443 439 }
444 440  
  441 +.icon-plot-add-objs {
  442 + background-image:url( ../images/16x16/plot_additional_objs.png ) !important;
  443 +}
  444 +
  445 +.icon-plot-add-legends {
  446 + background-image:url( ../images/16x16/plot_additional_legends.png ) !important;
  447 +}
  448 +
  449 +.icon-plot-add-legend-series {
  450 + background-image:url( ../images/16x16/plot_additional_series_legend.png ) !important;
  451 +}
  452 +
  453 +.icon-plot-add-legends-text {
  454 + background-image:url( ../images/16x16/plot_additional_text_legends.png ) !important;
  455 +}
  456 +
  457 +.icon-plot-add-legend-text {
  458 + background-image:url( ../images/16x16/plot_additional_text_legend.png ) !important;
  459 +}
  460 +
445 461 .x-item-disabled .x-form-item-label {
446 462 filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100) !important;
447 463 opacity: 1.0 !important;
... ...
js/resources/images/16x16/plot_additional_legends.png 0 → 100644

222 Bytes

js/resources/images/16x16/plot_additional_objs.png 0 → 100644

207 Bytes

js/resources/images/16x16/plot_additional_series_legend.png 0 → 100644

189 Bytes

js/resources/images/16x16/plot_additional_text_legend.png 0 → 100644

186 Bytes

js/resources/images/16x16/plot_additional_text_legends.png 0 → 100644

189 Bytes