diff --git a/js/app/models/PlotObjects/PlotLegendSeriesObject.js b/js/app/models/PlotObjects/PlotLegendSeriesObject.js new file mode 100644 index 0000000..7e6f8c2 --- /dev/null +++ b/js/app/models/PlotObjects/PlotLegendSeriesObject.js @@ -0,0 +1,79 @@ +/** + * Project  : AMDA-NG + * Name : PlotLegendSeriesObject.js + * @class amdaPlotObj.PlotLegendSeriesObject + * @extends Ext.data.Model + * @brief Plot Series Legend Business Object Definition + * @author Benjamin Renard + * @version $Id: PlotLegendSeriesObject.js benjamin $ + ****************************************************************************** + * FT Id : Date : Name - Description + ****************************************************************************** + * : :31/08/2015: BRE - file creation + */ + + +Ext.define('amdaPlotObj.PlotLegendSeriesObject', { + extend: 'Ext.data.Model', + + requires: [ + 'amdaPlotObj.PlotObjectConfig' + ], + + fields : [ + {name: 'legend-series-activated', type: 'boolean'}, + {name: 'legend-series-type', type: 'string'}, + {name: 'legend-series-position', type: 'string'}, + {name: 'legend-series-showparaminfo', type: 'boolean'}, + {name: 'legend-series-defaulttextcolor', type: 'string'}, + {name: 'legend-series-border-activated', type: 'boolean'}, + {name: 'legend-series-border-color', type: 'string'}, + {name: 'legend-series-intervalinfo-activated', type: 'boolean'}, + {name: 'legend-series-intervalinfo-type', type: 'string'}, + {name: 'legend-series-font-activated', type: 'boolean'}, + {name: 'legend-series-font-name', type: 'string'}, + {name: 'legend-series-font-size', type: 'int'}, + {name: 'legend-series-font-bold', type: 'boolean'}, + {name: 'legend-series-font-italic', type: 'boolean'} + ], + + setDefaultValues: function() + { + this.set('legend-series-activated', false); + this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type); + this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position); + this.set('legend-series-showparaminfo', true); + this.set('legend-series-defaulttextcolor', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.text.color); + this.set('legend-series-border-activated', false); + this.set('legend-series-border-color', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.border.color); + this.set('legend-series-intervalinfo-activated', false); + this.set('legend-series-intervalinfo-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.intervalinfo.type); + this.set('legend-series-font-activated', false); + this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name); + this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size); + this.set('legend-series-font-bold', false); + this.set('legend-series-font-italic', false); + }, + + getJsonValues : function() + { + var legendValues = new Object(); + + legendValues['legend-series-activated'] = this.get('legend-series-activated'); + legendValues['legend-series-type'] = this.get('legend-series-type'); + legendValues['legend-series-position'] = this.get('legend-series-position'); + legendValues['legend-series-showparaminfo'] = this.get('legend-series-showparaminfo'); + legendValues['legend-series-defaulttextcolor'] = this.get('legend-series-defaulttextcolor'); + legendValues['legend-series-border-activated'] = this.get('legend-series-border-activated'); + legendValues['legend-series-border-color'] = this.get('legend-series-border-color'); + legendValues['legend-series-intervalinfo-activated'] = this.get('legend-series-intervalinfo-activated'); + legendValues['legend-series-intervalinfo-type'] = this.get('legend-series-intervalinfo-type'); + legendValues['legend-series-font-activated'] = this.get('legend-series-font-activated'); + legendValues['legend-series-font-name'] = this.get('legend-series-font-name'); + legendValues['legend-series-font-size'] = this.get('legend-series-font-size'); + legendValues['legend-series-font-bold'] = this.get('legend-series-font-bold'); + legendValues['legend-series-font-italic'] = this.get('legend-series-font-italic'); + + return legendValues; + } +}); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotObjectConfig.js b/js/app/models/PlotObjects/PlotObjectConfig.js index 93762e7..80c7f2f 100644 --- a/js/app/models/PlotObjects/PlotObjectConfig.js +++ b/js/app/models/PlotObjects/PlotObjectConfig.js @@ -113,6 +113,25 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { }, spectro : { yAxis : 'y-left' + }, + legends : { + series : { + type : 'text-only', + position : 'outside', + text: { + color : '#000000' + }, + border: { + color : '#000000' + }, + intervalinfo : { + type : 'start-stop' + }, + font : { + name : 'sans-serif', + size: '12' + } + } } }, @@ -274,5 +293,20 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { {'key' : 'auto', 'value' : 'Auto'}, {'key' : 'time-step', 'value' : 'Time step'}, {'key' : 'nb-major', 'value' : 'Num. of major symb.'} - ] + ], + + availableLegendSeriesTypes : [ + {'key' : 'text-line-symbol', 'value' : 'Text, Line & Symbols'}, + {'key' : 'text-only', 'value' : 'Text only'} + ], + + availableLegendSeriesPositions : [ + {'key' : 'inside', 'value' : 'Inside'}, + {'key' : 'outside', 'value' : 'Outside'} + ], + + availableLegendSeriesIntervalInfoTypes : [ + {'key' : 'index', 'value' : 'Interval Index'}, + {'key' : 'start-stop', 'value' : 'Interval Start/Stop'} + ] }); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotPanelObject.js b/js/app/models/PlotObjects/PlotPanelObject.js index 1ee5885..9954c2e 100644 --- a/js/app/models/PlotObjects/PlotPanelObject.js +++ b/js/app/models/PlotObjects/PlotPanelObject.js @@ -21,7 +21,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', { requires: [ 'amdaPlotObj.PlotObjectConfig', 'amdaPlotObj.PlotAxisObject', - 'amdaPlotObj.PlotParamObject' + 'amdaPlotObj.PlotParamObject', + 'amdaPlotObj.PlotLegendSeriesObject' ], fields : [ @@ -72,7 +73,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { } return value; } - } + }, + //Only used for timePlot, xyPlot, epochPlot and instantPlot + {name: 'panel-legend-series', type: 'auto', defaultValue: null} ], associations : [ @@ -225,6 +228,17 @@ Ext.define('amdaPlotObj.PlotPanelObject', { } }); this.initAxes(); + + if ((plotType == 'timePlot') || (plotType == 'xyPlot') || (plotType == 'epochPlot') || (plotType == 'instantPlot')) + { + if (this.get('panel-legend-series') == null) + { + this.set('panel-legend-series', new amdaPlotObj.PlotLegendSeriesObject()); + this.get('panel-legend-series').setDefaultValues(); + } + } + else + this.set('panel-legend-series', null); }, setDefaultValues: function() @@ -322,6 +336,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { if (this.get('panel-plot-type') == 'instantPlot') panelValues['panel-instant-time'] = this.get('panel-instant-time'); + if ((this.get('panel-legend-series') != null) && this.get('panel-legend-series').get('legend-series-activated')) + panelValues['panel-series-legend'] = this.get('panel-legend-series').getJsonValues(); + panelValues['axes'] = []; this.axes().each(function (axe, index) { diff --git a/js/app/models/PlotObjects/PlotSerieObject.js b/js/app/models/PlotObjects/PlotSerieObject.js index df98259..b92cbeb 100644 --- a/js/app/models/PlotObjects/PlotSerieObject.js +++ b/js/app/models/PlotObjects/PlotSerieObject.js @@ -78,7 +78,7 @@ Ext.define('amdaPlotObj.PlotSerieObject', { this.set('serie-timetick-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.type); this.set('serie-timetick-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.size); this.set('serie-timetick-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.color); - this.set('serie-timetick-firstsymbols-activated', false); + this.set('serie-timetick-firstsymbols-activated', true); this.set('serie-timetick-firstsymbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.type); this.set('serie-timetick-firstsymbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.size); this.set('serie-timetick-firstsymbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.color); diff --git a/js/app/models/PlotObjects/PlotTreeNode.js b/js/app/models/PlotObjects/PlotTreeNode.js index e463334..883c3cc 100644 --- a/js/app/models/PlotObjects/PlotTreeNode.js +++ b/js/app/models/PlotObjects/PlotTreeNode.js @@ -232,12 +232,79 @@ Ext.define('amdaPlotObj.PlotParamTreeNode', { } }); +Ext.define('amdaPlotObj.PlotAdditionalObjectsTreeNode', { + extend: 'amdaPlotObj.PlotTreeNode', + + expanded: false, + + iconCls: 'icon-plot-add-objs', + + text: 'Additional Objects', + + type: 'objects' +}); + Ext.define('amdaPlotObj.PlotLegendsTreeNode', { extend: 'amdaPlotObj.PlotTreeNode', - iconCls: 'icon-plot-legends', + iconCls: 'icon-plot-add-legends', text: 'Legends', type: 'legends' }); + +Ext.define('amdaPlotObj.PlotSeriesLegendTreeNode', { + extend: 'amdaPlotObj.PlotTreeNode', + + leaf: true, + + iconCls: 'icon-plot-add-legend-series', + + text: 'Series Legend', + + type: 'series-legend' +}); + +Ext.define('amdaPlotObj.PlotTextLegendsTreeNode', { + extend: 'amdaPlotObj.PlotTreeNode', + + iconCls: 'icon-plot-add-legends-text', + + text: 'Text Legends', + + type: 'text-legends' +}); + +Ext.define('amdaPlotObj.PlotTextLegendTreeNode', { + extend: 'amdaPlotObj.PlotTreeNode', + + leaf: true, + + iconCls: 'icon-plot-add-legend-text', + + text: 'Text Legend', + + type: 'text-legend' +}); + +/* + * .icon-plot-add-objs { + background-image:url( ../images/16x16/plot_additional_objs.png ) !important; +} + +.icon-plot-add-legends { + background-image:url( ../images/16x16/plot_additional_legends.png ) !important; +} + +.icon-plot-add-legend-series { + background-image:url( ../images/16x16/plot_additional_series_legend.png ) !important; +} + +.icon-plot-add-legends-text { + background-image:url( ../images/16x16/plot_additional_text_legends.png ) !important; +} + +.icon-plot-add-legend-text { + background-image:url( ../images/16x16/plot_additional_text_legend.png ) !important; +}*/ diff --git a/js/app/views/PlotComponents/PlotElementPanel.js b/js/app/views/PlotComponents/PlotElementPanel.js index 4f4e540..8e91636 100644 --- a/js/app/views/PlotComponents/PlotElementPanel.js +++ b/js/app/views/PlotComponents/PlotElementPanel.js @@ -19,7 +19,8 @@ Ext.define('amdaPlotComp.PlotElementPanel', { 'amdaPlotComp.PlotEpochAxisForm', 'amdaPlotComp.PlotColorAxisForm', 'amdaPlotComp.PlotParamForm', - 'amdaPlotComp.PlotLayoutForm' + 'amdaPlotComp.PlotLayoutForm', + 'amdaPlotComp.PlotLegendSeriesForm' ], elementFormsManager : new Ext.AbstractManager(), @@ -86,6 +87,9 @@ Ext.define('amdaPlotComp.PlotElementPanel', { case 'layout' : this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId})); break; + case 'series-legend' : + this.elementFormsManager.register(new amdaPlotComp.PlotLegendSeriesForm({id : formId})); + break; case '' : this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'})); break; diff --git a/js/app/views/PlotComponents/PlotLegendSeriesForm.js b/js/app/views/PlotComponents/PlotLegendSeriesForm.js new file mode 100644 index 0000000..0277092 --- /dev/null +++ b/js/app/views/PlotComponents/PlotLegendSeriesForm.js @@ -0,0 +1,46 @@ +/** + * Project  : AMDA-NG + * Name : PlotLegendSeriesForm.js + * @class amdaPlotComp.PlotLegendSeriesForm + * @extends amdaPlotComp.PlotStandardForm + * @brief Form to define specifics series legend options + * @author Benjamin Renard + * @version $Id: PlotLegendSeriesForm.js benjamin $ + */ + +Ext.define('amdaPlotComp.PlotLegendSeriesForm', { + extend: 'amdaPlotComp.PlotStandardForm', + + setObject : function(object) { + this.object = object.get('panel-legend-series'); + if (this.object != null) + this.loadRecord(this.object); + var legendTypeField = this.getForm().findField('legend-series-type'); + var legendFieldSet = legendTypeField.findParentByType('fieldset'); + legendFieldSet.setVisible(this.object != null); + }, + + getFormItems: function() { + var borderItems = [ + this.addStandardColor('legend-series-border-color', 'Border Color', amdaPlotObj.PlotObjectConfig.availableColors), + ]; + + var intervalInfoItems = [ + this.addStandardCombo('legend-series-intervalinfo-type', 'Type', amdaPlotObj.PlotObjectConfig.availableLegendSeriesIntervalInfoTypes) + ]; + + var legendItems = [ + this.addStandardCombo('legend-series-type', 'Type', amdaPlotObj.PlotObjectConfig.availableLegendSeriesTypes), + this.addStandardCombo('legend-series-position', 'Position', amdaPlotObj.PlotObjectConfig.availableLegendSeriesPositions), + this.addStandardColor('legend-series-defaulttextcolor', 'Default Text Color', amdaPlotObj.PlotObjectConfig.availableColors), + this.addStandardCheck('legend-series-showparaminfo', 'Show Param Info'), + this.addStandardFieldSet('Show Interval Info', 'legend-series-intervalinfo-activated', intervalInfoItems), + this.addStandardFieldSet('Border', 'legend-series-border-activated', borderItems), + this.addStandardFont('legend-series-font') + ]; + + return [ + this.addStandardFieldSet('Activate legend', 'legend-series-activated', legendItems) + ]; + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index 1560398..cad3328 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -162,11 +162,51 @@ Ext.define('amdaPlotComp.PlotTree', { this.getSelectionModel().select(selectedParamNode); }, + buildPanelAdditionalObjectsNode: function(panelObject) { + var objectsNode = null; + + var me = this; + this.panelsNode.eachChild(function (panelNode) { + //Retrieve corresponding panel node + if (panelNode.object == panelObject) + { + //Retrieve additional objects node + objectsNode = panelNode.findChild('type', 'objects'); + if (!objectsNode) + { + //create additional objects node + objectsNode = panelNode.appendChild(new amdaPlotObj.PlotAdditionalObjectsTreeNode({object : panelObject})); + + //create legends node + me.buildPanelLegendsNode(panelObject, objectsNode); + } + return; + } + }); + + if (objectsNode == null) + return; + + this.getView().refresh(); + }, + + buildPanelLegendsNode: function(panelObject, objectsNode) { + var legendsNode = objectsNode.appendChild(new amdaPlotObj.PlotLegendsTreeNode({object : panelObject})); + + legendsNode.appendChild(new amdaPlotObj.PlotSeriesLegendTreeNode({object : panelObject})); + + legendsNode.appendChild(new amdaPlotObj.PlotTextLegendsTreeNode({object : panelObject})); + }, + addPanelNode: function(panelObject) { var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject})); if (!this.isSimplifiedView) + { //Axes node this.buildPanelAxesNode(panelObject); + //Additional objects + this.buildPanelAdditionalObjectsNode(panelObject); + } //Params node this.buildPanelParamsNode(panelObject); return panelNode; diff --git a/js/resources/css/amda.css b/js/resources/css/amda.css index 6c8cfb9..60d4af7 100644 --- a/js/resources/css/amda.css +++ b/js/resources/css/amda.css @@ -410,10 +410,6 @@ p + p { background-image:url( ../images/16x16/plot_axes.png ) !important; } -.icon-plot-legends { - background-image:url( ../images/16x16/plot_legends.png ) !important; -} - .icon-plot-axis-t { background-image:url( ../images/16x16/plot_axis_t.png ) !important; } @@ -442,6 +438,26 @@ p + p { background-image:url( ../images/16x16/plot_params.png ) !important; } +.icon-plot-add-objs { + background-image:url( ../images/16x16/plot_additional_objs.png ) !important; +} + +.icon-plot-add-legends { + background-image:url( ../images/16x16/plot_additional_legends.png ) !important; +} + +.icon-plot-add-legend-series { + background-image:url( ../images/16x16/plot_additional_series_legend.png ) !important; +} + +.icon-plot-add-legends-text { + background-image:url( ../images/16x16/plot_additional_text_legends.png ) !important; +} + +.icon-plot-add-legend-text { + background-image:url( ../images/16x16/plot_additional_text_legend.png ) !important; +} + .x-item-disabled .x-form-item-label { filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100) !important; opacity: 1.0 !important; diff --git a/js/resources/images/16x16/plot_additional_legends.png b/js/resources/images/16x16/plot_additional_legends.png new file mode 100644 index 0000000..4a28efb Binary files /dev/null and b/js/resources/images/16x16/plot_additional_legends.png differ diff --git a/js/resources/images/16x16/plot_additional_objs.png b/js/resources/images/16x16/plot_additional_objs.png new file mode 100644 index 0000000..3860d32 Binary files /dev/null and b/js/resources/images/16x16/plot_additional_objs.png differ diff --git a/js/resources/images/16x16/plot_additional_series_legend.png b/js/resources/images/16x16/plot_additional_series_legend.png new file mode 100644 index 0000000..3f8f797 Binary files /dev/null and b/js/resources/images/16x16/plot_additional_series_legend.png differ diff --git a/js/resources/images/16x16/plot_additional_text_legend.png b/js/resources/images/16x16/plot_additional_text_legend.png new file mode 100644 index 0000000..3afec92 Binary files /dev/null and b/js/resources/images/16x16/plot_additional_text_legend.png differ diff --git a/js/resources/images/16x16/plot_additional_text_legends.png b/js/resources/images/16x16/plot_additional_text_legends.png new file mode 100644 index 0000000..58b8390 Binary files /dev/null and b/js/resources/images/16x16/plot_additional_text_legends.png differ -- libgit2 0.21.2