From 7f7518bb9d90bf39939179e49306ebc256f9b39d Mon Sep 17 00:00:00 2001 From: Jamie Vigliotta Date: Wed, 15 Jul 2020 10:47:03 -0700 Subject: [PATCH] added units to plots and plot legends --- src/plugins/plot/res/templates/mct-plot.html | 10 +++++++++- .../plot/res/templates/plot-options-browse.html | 1 + src/plugins/plot/res/templates/plot-options-edit.html | 3 +++ src/plugins/plot/src/configuration/LegendModel.js | 3 ++- src/plugins/plot/src/configuration/PlotSeries.js | 1 + .../plot/src/inspector/PlotLegendFormController.js | 5 +++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/plot/res/templates/mct-plot.html b/src/plugins/plot/res/templates/mct-plot.html index c9d58c85bc..d2dc530f36 100644 --- a/src/plugins/plot/res/templates/mct-plot.html +++ b/src/plugins/plot/res/templates/mct-plot.html @@ -44,7 +44,7 @@ ng-style="{ 'background-color': series.get('color').asHexString() }"> - {{ series.get('name') }} + {{ series.get('name') + (series.get('unit') ? ' ' + series.get('unit') : '')}}
Value + + Unit + Min @@ -107,6 +110,11 @@ {{ series.formatY(series.closest) }} + + + {{ series.get('unit') }} + + diff --git a/src/plugins/plot/res/templates/plot-options-browse.html b/src/plugins/plot/res/templates/plot-options-browse.html index 4462b762dc..b8527859e0 100644 --- a/src/plugins/plot/res/templates/plot-options-browse.html +++ b/src/plugins/plot/res/templates/plot-options-browse.html @@ -135,6 +135,7 @@ Value Min Max + Units
diff --git a/src/plugins/plot/res/templates/plot-options-edit.html b/src/plugins/plot/res/templates/plot-options-edit.html index be3fa00eaf..a46f6c7724 100644 --- a/src/plugins/plot/res/templates/plot-options-edit.html +++ b/src/plugins/plot/res/templates/plot-options-edit.html @@ -197,6 +197,7 @@ + @@ -213,6 +214,8 @@ ng-model="form.showMinimumWhenExpanded"/> Minimum value
  • Maximum value
  • +
  • Units
  • diff --git a/src/plugins/plot/src/configuration/LegendModel.js b/src/plugins/plot/src/configuration/LegendModel.js index fd13073292..6cc0749131 100644 --- a/src/plugins/plot/src/configuration/LegendModel.js +++ b/src/plugins/plot/src/configuration/LegendModel.js @@ -52,7 +52,8 @@ define([ showTimestampWhenExpanded: true, showValueWhenExpanded: true, showMaximumWhenExpanded: true, - showMinimumWhenExpanded: true + showMinimumWhenExpanded: true, + showUnitsWhenExpanded: true }; } }); diff --git a/src/plugins/plot/src/configuration/PlotSeries.js b/src/plugins/plot/src/configuration/PlotSeries.js index f49ed2bdbb..61251a1a48 100644 --- a/src/plugins/plot/src/configuration/PlotSeries.js +++ b/src/plugins/plot/src/configuration/PlotSeries.js @@ -101,6 +101,7 @@ define([ var range = this.metadata.valuesForHints(['range'])[0]; return { name: options.domainObject.name, + unit: range.unit || '', xKey: options.collection.plot.xAxis.get('key'), yKey: range.key, markers: true, diff --git a/src/plugins/plot/src/inspector/PlotLegendFormController.js b/src/plugins/plot/src/inspector/PlotLegendFormController.js index adb8b86c4f..6832a2e7c6 100644 --- a/src/plugins/plot/src/inspector/PlotLegendFormController.js +++ b/src/plugins/plot/src/inspector/PlotLegendFormController.js @@ -60,6 +60,11 @@ define([ modelProp: 'showMinimumWhenExpanded', coerce: Boolean, objectPath: 'configuration.legend.showMinimumWhenExpanded' + }, + { + modelProp: 'showUnitsWhenExpanded', + coerce: Boolean, + objectPath: 'configuration.legend.showUnitsWhenExpanded' } ] });