mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 18:50:11 +00:00
Compare commits
35 Commits
v2.1.3
...
deep-plotl
Author | SHA1 | Date | |
---|---|---|---|
043d6aa9c3 | |||
ecfab8f7f3 | |||
05c38c37aa | |||
ce78925119 | |||
26aca0f433 | |||
41259bbd40 | |||
580640ff47 | |||
a4aec5d492 | |||
00b3f3ac0b | |||
c185f77a15 | |||
0dff431f4a | |||
61d238a097 | |||
f9deb80350 | |||
021d730814 | |||
ae62b15abf | |||
ba41c1a30e | |||
b9a85d9c4d | |||
80eab8bad1 | |||
b2d8d640ae | |||
56e6fa66c2 | |||
9fa4707c82 | |||
7e2cfa36de | |||
aaa60a1545 | |||
717231fed2 | |||
7fb2bc9729 | |||
addeb635e9 | |||
608d63a7b0 | |||
10679e5f4f | |||
38b8f03b1a | |||
779a42c28c | |||
80c2504768 | |||
80359e3f16 | |||
66aa4f099f | |||
aa6c6cb88b | |||
4e5cc840d7 |
@ -2,7 +2,9 @@
|
|||||||
"name": "openmct",
|
"name": "openmct",
|
||||||
"version": "1.0.0-snapshot",
|
"version": "1.0.0-snapshot",
|
||||||
"description": "The Open MCT core platform",
|
"description": "The Open MCT core platform",
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"plotly.js-dist": "^1.54.1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"angular": "1.7.9",
|
"angular": "1.7.9",
|
||||||
"angular-route": "1.4.14",
|
"angular-route": "1.4.14",
|
||||||
@ -53,7 +55,7 @@
|
|||||||
"marked": "^0.3.5",
|
"marked": "^0.3.5",
|
||||||
"mini-css-extract-plugin": "^0.4.1",
|
"mini-css-extract-plugin": "^0.4.1",
|
||||||
"minimist": "^1.1.1",
|
"minimist": "^1.1.1",
|
||||||
"moment": "^2.11.1",
|
"moment": "^2.25.3",
|
||||||
"moment-duration-format": "^2.2.2",
|
"moment-duration-format": "^2.2.2",
|
||||||
"moment-timezone": "^0.5.21",
|
"moment-timezone": "^0.5.21",
|
||||||
"node-bourbon": "^4.2.3",
|
"node-bourbon": "^4.2.3",
|
||||||
|
@ -252,6 +252,7 @@ define([
|
|||||||
// Plugin's that are installed by default
|
// Plugin's that are installed by default
|
||||||
|
|
||||||
this.install(this.plugins.Plot());
|
this.install(this.plugins.Plot());
|
||||||
|
this.install(this.plugins.PlotlyPlot());
|
||||||
this.install(this.plugins.TelemetryTable());
|
this.install(this.plugins.TelemetryTable());
|
||||||
this.install(PreviewPlugin.default());
|
this.install(PreviewPlugin.default());
|
||||||
this.install(LegacyIndicatorsPlugin());
|
this.install(LegacyIndicatorsPlugin());
|
||||||
|
@ -69,7 +69,6 @@ export default class ConditionClass extends EventEmitter {
|
|||||||
console.log('no data received');
|
console.log('no data received');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.criteria.forEach(criterion => {
|
this.criteria.forEach(criterion => {
|
||||||
if (this.isAnyOrAllTelemetry(criterion)) {
|
if (this.isAnyOrAllTelemetry(criterion)) {
|
||||||
criterion.getResult(datum, this.conditionManager.telemetryObjects);
|
criterion.getResult(datum, this.conditionManager.telemetryObjects);
|
||||||
|
@ -57,6 +57,7 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
endpoint,
|
endpoint,
|
||||||
this.telemetryReceived.bind(this, endpoint)
|
this.telemetryReceived.bind(this, endpoint)
|
||||||
);
|
);
|
||||||
|
// TODO check if this is needed
|
||||||
this.updateConditionTelemetry();
|
this.updateConditionTelemetry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
src/plugins/plotlyPlot/PlotlyTelemetryProvider.js
Normal file
35
src/plugins/plotlyPlot/PlotlyTelemetryProvider.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
export default class PlotlyTelemetryProvider {
|
||||||
|
constructor(openmct) {
|
||||||
|
this.openmct = openmct;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTelemetryObject(domainObject) {
|
||||||
|
return domainObject.type === 'plotlyPlot';
|
||||||
|
}
|
||||||
|
|
||||||
|
supportsRequest(domainObject) {
|
||||||
|
return domainObject.type === 'plotlyPlot';
|
||||||
|
}
|
||||||
|
|
||||||
|
supportsSubscribe(domainObject) {
|
||||||
|
return domainObject.type === 'plotlyPlot';
|
||||||
|
}
|
||||||
|
|
||||||
|
request(domainObject) {
|
||||||
|
// let conditionManager = this.getConditionManager(domainObject);
|
||||||
|
|
||||||
|
// return conditionManager.requestLADConditionSetOutput()
|
||||||
|
// .then(latestOutput => {
|
||||||
|
// return latestOutput;
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(domainObject, callback) {
|
||||||
|
// let conditionManager = this.getConditionManager(domainObject);
|
||||||
|
|
||||||
|
// conditionManager.on('conditionSetResultUpdated', callback);
|
||||||
|
|
||||||
|
// return this.destroyConditionManager.bind(this, this.openmct.objects.makeKeyString(domainObject.identifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
73
src/plugins/plotlyPlot/PlotlyViewProvider.js
Normal file
73
src/plugins/plotlyPlot/PlotlyViewProvider.js
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2019, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import PlotlyViewLayout from './components/PlotlyViewLayout.vue';
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
export default function PlotlyViewProvider(openmct) {
|
||||||
|
return {
|
||||||
|
key: 'plotlyPlot',
|
||||||
|
name: 'Plotly Plot',
|
||||||
|
cssClass: 'icon-plot-overlay',
|
||||||
|
canView: function (domainObject) {
|
||||||
|
return domainObject.type === 'plotlyPlot';
|
||||||
|
},
|
||||||
|
canEdit: function (domainObject) {
|
||||||
|
return domainObject.type === 'plotlyPlot';
|
||||||
|
},
|
||||||
|
view: function (domainObject, objectPath) {
|
||||||
|
let component;
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: function (element, isEditing) {
|
||||||
|
component = new Vue({
|
||||||
|
provide: {
|
||||||
|
openmct,
|
||||||
|
domainObject,
|
||||||
|
objectPath
|
||||||
|
},
|
||||||
|
el: element,
|
||||||
|
components: {
|
||||||
|
PlotlyViewLayout
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isEditing
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: '<plotly-view-layout :isEditing="isEditing"></plotly-view-layout>'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onEditModeChange: function (isEditing) {
|
||||||
|
component.isEditing = isEditing;
|
||||||
|
},
|
||||||
|
destroy: function (element) {
|
||||||
|
component.$destroy();
|
||||||
|
component = undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
priority: function () {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
138
src/plugins/plotlyPlot/components/PlotlyViewLayout.vue
Normal file
138
src/plugins/plotlyPlot/components/PlotlyViewLayout.vue
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<div class="l-view-section"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Plotly from 'plotly.js-dist';
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
inject: ['openmct', 'domainObject', 'objectPath'],
|
||||||
|
data: function () {
|
||||||
|
|
||||||
|
return {
|
||||||
|
telemetryObjects: []
|
||||||
|
// currentDomainObject: this.domainObject
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.composition = this.openmct.composition.get(this.domainObject);
|
||||||
|
this.composition.on('add', this.addTelemetry);
|
||||||
|
this.composition.load();
|
||||||
|
|
||||||
|
this.metadata = this.openmct.telemetry.getMetadata(this.domainObject);
|
||||||
|
|
||||||
|
console.log('this.metadata', this.metadata);
|
||||||
|
|
||||||
|
// this.keystring = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
|
// this.subscribe(this.domainObject);
|
||||||
|
this.plotElement = document.querySelector('.l-view-section');
|
||||||
|
// Plotly.newPlot(this.plotElement, [{
|
||||||
|
// x: [1, 2, 3, 4, 5],
|
||||||
|
// y: [1, 2, 4, 8, 16]
|
||||||
|
// }], this.getLayout(), {displayModeBar: false});
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getLayout() {
|
||||||
|
return {
|
||||||
|
hovermode: 'compare',
|
||||||
|
hoverdistance: -1,
|
||||||
|
autosize: "true",
|
||||||
|
showlegend: false,
|
||||||
|
font: {
|
||||||
|
family: "'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||||
|
size: "12px",
|
||||||
|
color: "#666"
|
||||||
|
},
|
||||||
|
xaxis: {
|
||||||
|
// title: this.plotAxisTitle.xAxisTitle,
|
||||||
|
zeroline: false
|
||||||
|
},
|
||||||
|
yaxis: {
|
||||||
|
// title: this.plotAxisTitle.yAxisTitle,
|
||||||
|
zeroline: false
|
||||||
|
},
|
||||||
|
margin: {
|
||||||
|
l: 20,
|
||||||
|
r: 10,
|
||||||
|
b: 20,
|
||||||
|
t: 10
|
||||||
|
},
|
||||||
|
paper_bgcolor: 'transparent',
|
||||||
|
plot_bgcolor: 'transparent'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addTelemetry(telemetryObject) {
|
||||||
|
return this.openmct.telemetry.request(telemetryObject)
|
||||||
|
.then(telemetryData => {
|
||||||
|
this.createPlot(telemetryData, telemetryObject);
|
||||||
|
}, () => {console.log(error)});
|
||||||
|
},
|
||||||
|
formatDatumX(datum) {
|
||||||
|
let timestamp = moment.utc(datum.utc).format('YYYY-MM-DD hh:mm:ss.ms');
|
||||||
|
return timestamp;
|
||||||
|
},
|
||||||
|
formatDatumY(datum) {
|
||||||
|
return datum.sin;
|
||||||
|
},
|
||||||
|
createPlot(telemetryData, telemetryObject) {
|
||||||
|
let x = [],
|
||||||
|
y = [];
|
||||||
|
|
||||||
|
telemetryData.forEach((datum, index) => {
|
||||||
|
x.push(this.formatDatumX(datum));
|
||||||
|
y.push(this.formatDatumY(datum));
|
||||||
|
})
|
||||||
|
|
||||||
|
let data = [{
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
mode: 'line'
|
||||||
|
}];
|
||||||
|
var layout = {
|
||||||
|
title:'Line and Scatter Plot'
|
||||||
|
};
|
||||||
|
Plotly.newPlot(
|
||||||
|
this.plotElement,
|
||||||
|
data,
|
||||||
|
this.getLayout()
|
||||||
|
)
|
||||||
|
|
||||||
|
this.subscribe(telemetryObject);
|
||||||
|
},
|
||||||
|
subscribe(domainObject) {
|
||||||
|
// this.date = ''
|
||||||
|
// this.openmct.objects.get(this.keystring)
|
||||||
|
// .then((object) => {
|
||||||
|
// const metadata = this.openmct.telemetry.getMetadata(this.domainObject);
|
||||||
|
// console.log('metadata', metadata);
|
||||||
|
// // this.timeKey = this.openmct.time.timeSystem().key;
|
||||||
|
// // this.timeFormat = this.openmct.telemetry.getValueFormatter(metadata.value(this.timeKey));
|
||||||
|
// // // this.imageFormat = this.openmct.telemetry.getValueFormatter(metadata.valuesForHints(['image'])[0]);
|
||||||
|
// // this.unsubscribe = this.openmct.telemetry
|
||||||
|
// // .subscribe(this.domainObject, (datum) => {
|
||||||
|
// // this.updateHistory(datum);
|
||||||
|
// // this.updateValues(datum);
|
||||||
|
// // });
|
||||||
|
|
||||||
|
// // this.requestHistory(this.openmct.time.bounds());
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.openmct.telemetry.subscribe(domainObject, (datum) => {
|
||||||
|
this.updateData(datum)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateData(datum) {
|
||||||
|
Plotly.extendTraces(
|
||||||
|
this.plotElement,
|
||||||
|
{
|
||||||
|
x: [[this.formatDatumX(datum)]],
|
||||||
|
y: [[this.formatDatumY(datum)]]
|
||||||
|
},
|
||||||
|
[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
2
src/plugins/plotlyPlot/components/plotly.scss
Normal file
2
src/plugins/plotlyPlot/components/plotly.scss
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.plot svg {
|
||||||
|
}
|
20
src/plugins/plotlyPlot/plugin.js
Normal file
20
src/plugins/plotlyPlot/plugin.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import PlotlyViewProvider from './PlotlyViewProvider.js';
|
||||||
|
import PlotlyTelemetryProvider from './PlotlyTelemetryProvider.js';
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
return function install(openmct) {
|
||||||
|
openmct.objectViews.addProvider(new PlotlyViewProvider(openmct));
|
||||||
|
openmct.telemetry.addProvider(new PlotlyTelemetryProvider(openmct));
|
||||||
|
|
||||||
|
openmct.types.addType('plotlyPlot', {
|
||||||
|
name: "Plotly Plot",
|
||||||
|
description: "Simple plot rendered by plotly.js",
|
||||||
|
creatable: true,
|
||||||
|
cssClass: 'icon-plot-overlay',
|
||||||
|
initialize: function (domainObject) {
|
||||||
|
domainObject.composition = [];
|
||||||
|
domainObject.telemetry = {};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
@ -34,6 +34,7 @@ define([
|
|||||||
'./URLIndicatorPlugin/URLIndicatorPlugin',
|
'./URLIndicatorPlugin/URLIndicatorPlugin',
|
||||||
'./telemetryMean/plugin',
|
'./telemetryMean/plugin',
|
||||||
'./plot/plugin',
|
'./plot/plugin',
|
||||||
|
'./plotlyPlot/plugin',
|
||||||
'./telemetryTable/plugin',
|
'./telemetryTable/plugin',
|
||||||
'./staticRootPlugin/plugin',
|
'./staticRootPlugin/plugin',
|
||||||
'./notebook/plugin',
|
'./notebook/plugin',
|
||||||
@ -66,6 +67,7 @@ define([
|
|||||||
URLIndicatorPlugin,
|
URLIndicatorPlugin,
|
||||||
TelemetryMean,
|
TelemetryMean,
|
||||||
PlotPlugin,
|
PlotPlugin,
|
||||||
|
PlotlyPlotPlugin,
|
||||||
TelemetryTablePlugin,
|
TelemetryTablePlugin,
|
||||||
StaticRootPlugin,
|
StaticRootPlugin,
|
||||||
Notebook,
|
Notebook,
|
||||||
@ -171,8 +173,8 @@ define([
|
|||||||
plugins.ExampleImagery = ExampleImagery;
|
plugins.ExampleImagery = ExampleImagery;
|
||||||
plugins.ImageryPlugin = ImageryPlugin;
|
plugins.ImageryPlugin = ImageryPlugin;
|
||||||
plugins.Plot = PlotPlugin;
|
plugins.Plot = PlotPlugin;
|
||||||
|
plugins.PlotlyPlot = PlotlyPlotPlugin.default;
|
||||||
plugins.TelemetryTable = TelemetryTablePlugin;
|
plugins.TelemetryTable = TelemetryTablePlugin;
|
||||||
|
|
||||||
plugins.SummaryWidget = SummaryWidget;
|
plugins.SummaryWidget = SummaryWidget;
|
||||||
plugins.TelemetryMean = TelemetryMean;
|
plugins.TelemetryMean = TelemetryMean;
|
||||||
plugins.URLIndicator = URLIndicatorPlugin;
|
plugins.URLIndicator = URLIndicatorPlugin;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
@import "../plugins/folderView/components/list-item.scss";
|
@import "../plugins/folderView/components/list-item.scss";
|
||||||
@import "../plugins/folderView/components/list-view.scss";
|
@import "../plugins/folderView/components/list-view.scss";
|
||||||
@import "../plugins/imagery/components/imagery-view-layout.scss";
|
@import "../plugins/imagery/components/imagery-view-layout.scss";
|
||||||
|
@import "../plugins/plotlyPlot/components/plotly.scss";
|
||||||
@import "../plugins/telemetryTable/components/table-row.scss";
|
@import "../plugins/telemetryTable/components/table-row.scss";
|
||||||
@import "../plugins/telemetryTable/components/telemetry-filter-indicator.scss";
|
@import "../plugins/telemetryTable/components/telemetry-filter-indicator.scss";
|
||||||
@import "../plugins/tabs/components/tabs.scss";
|
@import "../plugins/tabs/components/tabs.scss";
|
||||||
|
Reference in New Issue
Block a user