openmct/src/plugins/plot/res/templates/plot-options-edit.html
Pete Richards 63bb183bec [Plot] Misc bug fixes
* removed unused file

[Plot] Properly update yAxis on key change.

yAxis should update after the key for a series changes.

Fixes #2025.

[Plot] improve y-axis label handling

First, change the y-Axis label retrieval to retrieve the proper
value from the plot confoguration so that it uses the persisted
value, Fixes #2024

Secondly, when removing a series, if there are no series left in
the plot and a custom y-axis label has not been specified, then
clear the y-axis label.  Fixes #2014.

[Plot] don't use incorrect index in selected check

Alias the series form data so that it is not always necessary to
access it using $index.  This prevents $index getting clobbered
when looping over select options which results in the correct option
getting marked as selected.

Fixes bug reported in pull request review:
https://github.com/nasa/openmct/pull/2026#pullrequestreview-117404172
2018-06-29 11:26:22 -07:00

207 lines
11 KiB
HTML

<!--
Open MCT, Copyright (c) 2014-2018, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.
Open MCT is licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Open MCT includes source code licensed under additional open source
licenses. See the Open Source Licenses file (LICENSES.md) included with
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<div ng-controller="PlotOptionsController">
<ul class="tree l-inspector-part">
<h2 title="Display properties for this object">Plot Series Options</h2>
<li ng-repeat="series in config.series.models" ng-init="seriesForm = form.series[$index]">
<span class="tree-item menus-to-left">
<span class='ui-symbol view-control flex-elem'
ng-class="{ expanded: series.expanded }"
ng-click="series.expanded = !series.expanded">
</span>
<mct-representation class="rep-object-label"
key="'label'"
mct-object="series.oldObject">
</mct-representation>
</span>
<ul class="grid-properties" ng-show="series.expanded">
<li class="grid-row">
<!-- Value to be displayed -->
<div class="grid-cell label"
title="The field to be plotted as a value for this series.">Value</div>
<div class="grid-cell value">
<div class="select">
<select ng-model="seriesForm.yKey">
<option ng-repeat="option in seriesForm.yAxisOptions"
value="{{option.value}}"
ng-selected="option.value == seriesForm.yKey">
{{option.name}}
</option>
</select>
</div>
</div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="The line rendering style for this series.">Line Style</div>
<div class="grid-cell value">
<div class="select">
<select ng-model="seriesForm.interpolate">
<option value="none">None</option>
<option value="linear">Linear interpolate</option>
<option value="stepAfter">Step after</option>
</select>
</div>
</div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="Whether markers are displayed.">Markers</div>
<div class="grid-cell value"><input type="checkbox" ng-model="seriesForm.markers"/></div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="Display markers visually denoting points in alarm.">Alarm Markers</div>
<div class="grid-cell value"><input type="checkbox" ng-model="seriesForm.alarmMarkers"/></div>
</li>
<li class="grid-row" ng-show="seriesForm.markers || seriesForm.alarmMarkers">
<div class="grid-cell label"
title="The size of regular and alarm markers for this series.">Marker Size:</div>
<div class="grid-cell value"><input class="sm" type="text" ng-model="seriesForm.markerSize"/></div>
</li>
<li class="grid-row"
ng-controller="ClickAwayController as toggle"
ng-show="seriesForm.interpolate !== 'none' || seriesForm.markers">
<div class="grid-cell label"
title="Manually set the plot line and marker color for this series.">Color</div>
<div class="grid-cell value">
<div class="s-menu-button" ng-click="toggle.toggle()">
<span class="color-swatch" ng-style="{ background: series.get('color').asHexString() }">
</span>
</div>
<div class="l-inline-palette" ng-show="toggle.isActive()">
<!-- TODO: redo this as a grid -->
<div class="l-palette-row" ng-repeat="group in config.series.palette.groups()">
<div class="l-palette-item s-palette-item"
ng-repeat="color in group"
xng-class="{ 'icon-check': series.get('color') === color }"
ng-style="{ background: color.asHexString() }"
ng-click="setColor(series, color, config.series.models.indexOf(series))">
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
<div class="grid-properties" ng-show="!!config.series.models.length">
<ul class="l-inspector-part">
<h2>Y Axis</h2>
<li class="grid-row">
<div class="grid-cell label"
title="Manually override how the Y axis is labeled.">Label</div>
<div class="grid-cell value"><input class="control" type="text" ng-model="form.yAxis.label"/></div>
</li>
</ul>
<ul class="l-inspector-part" ng-show="!(form.yAxis.key == 'enum')">
<h2>Y Axis Scaling</h2>
<li class="grid-row">
<div class="grid-cell label"
title="Automatically scale the Y axis to keep all values in view.">Autoscale</div>
<div class="grid-cell value"><input type="checkbox" ng-model="form.yAxis.autoscale"/></div>
</li>
<li class="grid-row" ng-show="form.yAxis.autoscale">
<div class="grid-cell label"
title="Percentage of padding above and below plotted min and max values. 0.1, 1.0, etc.">
Padding</div>
<div class="grid-cell value">
<input class="sm" type="text" ng-model="form.yAxis.autoscalePadding"/>
</div>
</li>
</ul>
<ul class="l-inspector-part" ng-show="!form.yAxis.autoscale">
<div class="grid-span-all form-error"
ng-show="!(form.yAxis.key == 'enum') && !form.yAxis.autoscale && validation['form.yAxis.range']">
{{ validation['form.yAxis.range'] }}
</div>
<li class="grid-row force-border">
<div class="grid-cell label"
title="Minimum Y axis value.">Minimum Value</div>
<div class="grid-cell value">
<input class="sm" type="text" ng-model="form.yAxis.range.min"/>
</div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="Maximum Y axis value.">Maximum Value</div>
<div class="grid-cell value"><input class="sm" type="text" ng-model="form.yAxis.range.max"/></div>
</li>
</ul>
<ul class="l-inspector-part">
<h2 title="Legend options">Legend</h2>
<li class="grid-row">
<div class="grid-cell label"
title="The position of the legend relative to the plot display area.">Position</div>
<div class="grid-cell value">
<div class="select">
<select ng-model="form.legend.position">
<option value="hidden">Hidden</option>
<option value="top">Top</option>
<option value="right">Right</option>
<option value="bottom">Bottom</option>
<option value="left">Left</option>
</select>
</div>
</div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="Show the legend expanded by default">Expand by default</div>
<div class="grid-cell value"><input type="checkbox" ng-model="form.legend.expandByDefault"/></div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="What to display in the legend when it's collapsed.">When collapsed show</div>
<div class="grid-cell value">
<div class="select">
<select ng-model="form.legend.valueToShowWhenCollapsed">
<option value="none">nothing</option>
<option value="nearestTimestamp">nearest timestamp</option>
<option value="nearestValue">nearest Value</option>
<option value="min">minimum value</option>
<option value="max">maximum value</option>
</select>
</div>
</div>
</li>
<li class="grid-row">
<div class="grid-cell label"
title="What to display in the legend when it's expanded.">When expanded show</div>
<div class="grid-cell value">
<ul>
<li><input type="checkbox"
ng-model="form.legend.showTimestampWhenExpanded"/> Nearest timestamp</li>
<li><input type="checkbox"
ng-model="form.legend.showValueWhenExpanded"/> Nearest value</li>
<li><input type="checkbox"
ng-model="form.legend.showMinimumWhenExpanded"/> Minimum value</li>
<li><input type="checkbox"
ng-model="form.legend.showMaximumWhenExpanded"/> Maximum value</li>
</ul>
</div>
</li>
</ul>
</div>
</div>