Merge pull request #2026 from nasa/plot-bug-hunt

[plot] misc bug fixes - Fixes Issues #2025, #2024, #2014
This commit is contained in:
Deep Tailor 2018-06-29 13:23:31 -07:00 committed by GitHub
commit 29de11167f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 190 deletions

View File

@ -22,7 +22,7 @@
<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">
<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 }"
@ -40,10 +40,10 @@
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="form.series[$index].yKey">
<option ng-repeat="option in form.series[$index].yAxisOptions"
<select ng-model="seriesForm.yKey">
<option ng-repeat="option in seriesForm.yAxisOptions"
value="{{option.value}}"
ng-selected="option.value == form.series[$index].yKey">
ng-selected="option.value == seriesForm.yKey">
{{option.name}}
</option>
</select>
@ -55,7 +55,7 @@
title="The line rendering style for this series.">Line Style</div>
<div class="grid-cell value">
<div class="select">
<select ng-model="form.series[$index].interpolate">
<select ng-model="seriesForm.interpolate">
<option value="none">None</option>
<option value="linear">Linear interpolate</option>
<option value="stepAfter">Step after</option>
@ -66,21 +66,21 @@
<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="form.series[$index].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="form.series[$index].alarmMarkers"/></div>
<div class="grid-cell value"><input type="checkbox" ng-model="seriesForm.alarmMarkers"/></div>
</li>
<li class="grid-row" ng-show="form.series[$index].markers || form.series[$index].alarmMarkers">
<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="form.series[$index].markerSize"/></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="form.series[$index].interpolate !== 'none' || form.series[$index].markers">
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">

View File

@ -146,10 +146,14 @@ define([
this.updateStats(seriesStats);
}
}, this);
this.listenTo(series, 'change:yKey', function () {
this.updateFromSeries(this.seriesCollection);
}, this);
},
untrackSeries: function (series) {
this.stopListening(series);
this.resetStats();
this.updateFromSeries(this.seriesCollection);
},
toggleAutoscale: function (autoscale) {
if (autoscale && this.has('stats')) {
@ -162,8 +166,13 @@ define([
* Update yAxis format, values, and label from known series.
*/
updateFromSeries: function (series) {
var plotModel = this.plot.get('domainObject');
var label = _.get(plotModel, 'configuration.yAxis.label');
var sampleSeries = series.first();
if (!sampleSeries) {
if (!label) {
this.unset('label');
}
return;
}
@ -172,9 +181,6 @@ define([
var yFormat = sampleSeries.formats[yKey];
this.set('format', yFormat.format.bind(yFormat));
this.set('values', yMetadata.values);
var plotModel = this.plot.get('domainObject');
var label = _.get(plotModel, 'configuration.xAxis.label');
if (!label) {
var labelUnits = series.map(function (s) {
return s.metadata.value(s.get('yKey')).units;

View File

@ -1,177 +0,0 @@
/*****************************************************************************
* 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.
*****************************************************************************/
define([
], function () {
/**
* A class for encapsulating structure and behaviour of the plot
* options form
* @memberOf platform/features/plot
* @param topic
* @constructor
*/
function PlotOptionsForm() {
/*
Defined below are the form structures for the plot options.
*/
this.xAxisForm = {
name: 'x-axis',
sections: [{
name: 'x-axis',
rows: [
{
name: 'Domain',
control: 'select',
key: 'key',
options: [
{
name: 'SCET',
value: 'scet'
},
{
name: 'ERT',
value: 'ert'
},
{
name: 'SCLK',
value: 'sclk'
},
{
name: 'LST',
value: 'lst'
}
]
}
]
}]};
this.yAxisForm = {
name: 'y-axis',
sections: [{
// Will need to be repeated for each y-axis, with a
// distinct name for each. Ideally the name of the axis
// itself.
name: 'y-axis',
rows: [
{
name: 'Range',
control: 'select',
key: 'key',
options: [
{
name: 'Autoselect',
value: 'auto'
},
{
name: 'EU',
value: 'eu'
},
{
name: 'DN',
value: 'dn'
},
{
name: 'Status',
value: 'enum'
}
]
},
{
name: 'Autoscale',
control: 'checkbox',
key: 'autoscale'
},
{
name: 'Min',
control: 'textfield',
key: 'min',
pattern: '[0-9]',
inputsize: 'sm'
},
{
name: 'Max',
control: 'textfield',
key: 'max',
pattern: '[0-9]',
inputsize: 'sm'
}
]
}]
};
this.plotSeriesForm = {
name: 'Series Options',
sections: [
{
rows: [
{
name: 'Color',
control: 'color',
key: 'color'
}]
},
{
rows: [
{
name: 'Markers',
control: 'checkbox',
key: 'markers',
layout: 'control-first'
}
]
},
{
rows: [
{
name: 'No Line',
control: 'radio',
key: 'interpolate',
value: 'none',
layout: 'control-first'
},
{
name: 'Step Line',
control: 'radio',
key: 'interpolate',
value: 'stepAfter',
layout: 'control-first'
},
{
name: 'Linear Line',
control: 'radio',
key: 'interpolate',
value: 'linear',
layout: 'control-first'
}
]
}
]
};
}
return PlotOptionsForm;
});