Compare commits

..

5 Commits

Author SHA1 Message Date
Joshi
06cddb6e16 Log values 2022-02-02 15:00:03 -08:00
Joshi
ca53852014 Unevenly spaced log ticks 2022-02-02 14:44:40 -08:00
Joshi
d7d8bedf2a Use d3 ticks for yAxis 2022-01-28 10:56:04 -08:00
Joshi
c24c652f4b Add d3 ticks 2022-01-27 08:53:31 -08:00
Joshi
1cb4f5b013 Change bar graphs to log plots for prototyping. 2022-01-27 05:57:52 -08:00
28 changed files with 143 additions and 132 deletions

View File

@@ -2,7 +2,7 @@ version: 2.1
executors:
pw-focal-development:
docker:
- image: mcr.microsoft.com/playwright:v1.18.1-focal
- image: mcr.microsoft.com/playwright:v1.18.0-focal
environment:
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
parameters:

View File

@@ -15,8 +15,8 @@ jobs:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: "nasa",
repo: "openmct",
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Started e2e Run. Follow along: https://github.com/nasa/openmct/actions/runs/' + context.runId
})
- uses: actions/checkout@v2
@@ -37,8 +37,8 @@ jobs:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: "nasa",
repo: "openmct",
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
})
- name: Test failure
@@ -48,7 +48,7 @@ jobs:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: "nasa",
repo: "openmct",
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Failure ❌ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
})

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -6,7 +6,7 @@
"@braintree/sanitize-url": "^5.0.2",
"@percy/cli": "^1.0.0-beta.73",
"@percy/playwright": "^1.0.1",
"@playwright/test": "^1.18.1",
"@playwright/test": "^1.18.0",
"allure-playwright": "^2.0.0-beta.14",
"angular": ">=1.8.0",
"angular-route": "1.4.14",
@@ -36,7 +36,7 @@
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^4.0.0",
"jsdoc": "^3.3.2",
"karma": "6.3.13",
"karma": "6.3.11",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-coverage": "2.1.0",
@@ -58,7 +58,7 @@
"moment-timezone": "0.5.28",
"node-bourbon": "^4.2.3",
"painterro": "^1.2.56",
"playwright": "^1.18.1",
"playwright": "^1.18.0",
"plotly.js-basic-dist": "^2.5.0",
"plotly.js-gl2d-dist": "^2.5.0",
"printj": "^1.2.1",
@@ -84,8 +84,8 @@
"zepto": "^1.2.0"
},
"scripts": {
"clean": "rm -rf ./dist ./node_modules; rm package-lock.json",
"clean-test-lint": "npm run clean; npm install; npm run test; npm run lint",
"clean": "rm -rf ./dist /node_modules; rm package-lock.json",
"clean-test-lint": "npm run clean; npm install ; npm run test; npm run lint",
"start": "node app.js",
"lint": "eslint platform example src --ext .js,.vue openmct.js",
"lint:fix": "eslint platform example src --ext .js,.vue openmct.js --fix",

View File

@@ -65,7 +65,6 @@ export default {
data() {
return {
hideOptions: true,
showFilteredOptions: false,
optionIndex: 0,
field: this.model.value
};
@@ -73,24 +72,16 @@ export default {
computed: {
filteredOptions() {
const options = this.optionNames || [];
if (this.showFilteredOptions) {
return options
.filter(option => {
return option.toLowerCase().indexOf(this.field.toLowerCase()) >= 0;
}).map((option, index) => {
return {
optionId: index,
name: option
};
});
}
return options.map((option, index) => {
return {
optionId: index,
name: option
};
});
return options
.filter(option => {
return option.toLowerCase().indexOf(this.field.toLowerCase()) >= 0;
}).map((option, index) => {
return {
optionId: index,
name: option
};
});
}
},
watch: {
@@ -140,12 +131,11 @@ export default {
this.hideOptions = true;
this.field = string;
},
showOptions() {
showOptions(string) {
this.hideOptions = false;
this.optionIndex = 0;
},
keyDown($event) {
this.showFilteredOptions = true;
if (this.filteredOptions) {
let keyCode = $event.keyCode;
switch (keyCode) {
@@ -165,14 +155,11 @@ export default {
},
inputClicked() {
this.autocompleteInputElement.select();
this.showOptions();
this.showOptions(this.autocompleteInputElement.value);
},
arrowClicked() {
// if the user clicked the arrow, we want
// to show them all the options
this.showFilteredOptions = false;
this.autocompleteInputElement.select();
this.showOptions();
this.showOptions('');
},
optionMouseover(optionId) {
this.optionIndex = optionId;

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -123,7 +123,10 @@ export default {
automargin: true,
fixedrange: true
},
yaxis: primaryYaxis,
yaxis: {
...primaryYaxis,
type: 'log'
},
margin: {
l: 5,
r: 5,

View File

@@ -62,6 +62,8 @@ export default {
}
},
mounted() {
this.xValues = [];
this.yValues = [];
this.refreshData = this.refreshData.bind(this);
this.setTimeContext();
@@ -156,7 +158,7 @@ export default {
const yAxisMetadata = metadata.valuesForHints(['range'])[0];
//Exclude 'name' and 'time' based metadata specifically, from the x-Axis values by using range hints only
const xAxisMetadata = metadata.valuesForHints(['range']);
const xAxisMetadata = metadata.valuesForHints(['domain'])[0];
return {
xAxisMetadata,
@@ -236,29 +238,29 @@ export default {
let yValues = [];
//populate X and Y values for plotly
axisMetadata.xAxisMetadata.forEach((metadata) => {
xValues.push(metadata.name);
if (data[metadata.key]) {
const formattedValue = this.format(key, metadata.key, data);
yValues.push(formattedValue);
} else {
yValues.push(null);
}
});
xValues.push(this.format(key, axisMetadata.xAxisMetadata.key, data));
if (data[axisMetadata.yAxisMetadata.key]) {
const formattedValue = this.format(key, axisMetadata.yAxisMetadata.key, data);
yValues.push(formattedValue);
} else {
yValues.push(null);
}
this.xValues = this.xValues.concat(xValues);
this.yValues = this.yValues.concat(yValues);
const trace = {
key,
name: telemetryObject.name,
x: xValues,
y: yValues,
x: this.xValues,
y: this.yValues,
text: yValues.map(String),
xAxisMetadata: axisMetadata.xAxisMetadata,
yAxisMetadata: axisMetadata.yAxisMetadata,
type: 'bar',
type: 'scatter',
marker: {
color: this.domainObject.configuration.barStyles.series[key].color
},
hoverinfo: 'skip'
}
};
this.addTrace(trace, key);

View File

@@ -97,14 +97,7 @@ export default {
},
mounted() {
if (this.frame.domainObjectIdentifier) {
let domainObjectPromise;
if (this.openmct.objects.supportsMutation(this.frame.domainObjectIdentifier)) {
domainObjectPromise = this.openmct.objects.getMutable(this.frame.domainObjectIdentifier);
} else {
domainObjectPromise = this.openmct.objects.get(this.frame.domainObjectIdentifier);
}
domainObjectPromise.then((object) => {
this.openmct.objects.get(this.frame.domainObjectIdentifier).then((object) => {
this.setDomainObject(object);
});
}
@@ -112,10 +105,6 @@ export default {
this.dragGhost = document.getElementById('js-fl-drag-ghost');
},
beforeDestroy() {
if (this.domainObject.isMutable) {
this.openmct.objects.destroyMutable(this.domainObject);
}
if (this.unsubscribeSelection) {
this.unsubscribeSelection();
}

View File

@@ -702,15 +702,12 @@ export default {
focusedIndex = matchIndex > -1 ? matchIndex : this.imageHistory.length - 1;
}
const isLastImageFocused = focusedIndex === this.imageHistory.length - 1;
if (!(this.isPaused || thumbnailClick) && isLastImageFocused) {
if (!(this.isPaused || thumbnailClick)
|| focusedIndex === this.imageHistory.length - 1) {
delete this.previousFocusedImage;
}
}
console.log('old index', this.focusedImageIndex);
console.log('new index', focusedIndex);
this.focusedImageIndex = focusedIndex;
//TODO: do we even need this anymore?
@@ -718,9 +715,6 @@ export default {
this.nextImageIndex = focusedIndex;
//this could happen if bounds changes
if (this.focusedImageIndex > this.imageHistory.length - 1) {
console.log('why this?');
console.log('old index', this.focusedImageIndex);
console.log('new index', focusedIndex);
this.focusedImageIndex = focusedIndex;
}

View File

@@ -632,8 +632,7 @@ export default {
updateDefaultNotebook(updatedNotebookStorageObject) {
if (!this.isDefaultNotebook()) {
const persistedNotebookStorageObject = getDefaultNotebook();
if (persistedNotebookStorageObject
&& persistedNotebookStorageObject.identifier !== undefined) {
if (persistedNotebookStorageObject.identifier !== undefined) {
this.removeDefaultClass(persistedNotebookStorageObject.identifier);
}

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -44,7 +44,7 @@
<div v-for="tick in ticks"
:key="tick.value"
class="gl-plot-tick gl-plot-y-tick-label"
:style="{ top: (100 * (max - tick.value) / interval) + '%' }"
:style="{ top: tick.top }"
:title="tick.fullText || tick.text"
style="margin-top: -0.50em; direction: ltr;"
>
@@ -76,7 +76,7 @@
<script>
import eventHelpers from "./lib/eventHelpers";
import { ticks, getFormattedTicks } from "./tickUtils";
import {d3Ticks, ticks, getFormattedTicks, d3TicksLog} from "./tickUtils";
import configStore from "./configuration/ConfigStore";
export default {
@@ -172,7 +172,7 @@ export default {
}, this);
}
return ticks(range.min, range.max, number);
return d3Ticks(range.min, range.max, number);
},
updateTicksForceRegeneration() {
@@ -210,6 +210,27 @@ export default {
newTicks = getFormattedTicks(newTicks, format);
if (this.axisType !== 'xAxis') {
let min = this.min;
let max = this.max;
newTicks = newTicks.map((tick) => {
let value;
if (tick.value !== 0) {
value = (Math.log10(max) - Math.log10(tick.value)) / (Math.log10(max) - Math.log10(min)) * (100);
}
if (value < 0) {
value = -value;
}
tick.top = value + '%';
return tick;
});
console.log(this.min, this.max, newTicks.map(tick => `${tick.value} + ${tick.top}`));
}
this.ticks = newTicks;
this.shouldCheckWidth = true;
}

View File

@@ -278,7 +278,7 @@ export default {
// Have to throw away the old canvas elements and replace with new
// canvas elements in order to get new drawing contexts.
const div = document.createElement('div');
div.innerHTML = this.canvasTemplate + this.canvasTemplate;
div.innerHTML = this.TEMPLATE;
const mainCanvas = div.querySelectorAll("canvas")[1];
const overlayCanvas = div.querySelectorAll("canvas")[0];
this.canvas.parentNode.replaceChild(mainCanvas, this.canvas);

View File

@@ -233,7 +233,9 @@ export default class PlotSeries extends Model {
return this.limitEvaluator.evaluate(datum, valueMetadata);
}.bind(this);
const format = this.formats[newKey];
this.getYVal = format.parse.bind(format);
this.getYVal = (point) => {
return Math.log(format.parse(point));
};
}
formatX(point) {

View File

@@ -1,3 +1,6 @@
import * as d3Scale from 'd3-scale';
import * as d3Axis from 'd3-axis';
const e10 = Math.sqrt(50);
const e5 = Math.sqrt(10);
const e2 = Math.sqrt(2);
@@ -40,6 +43,33 @@ function getPrecision(step) {
return precision;
}
export function d3Ticks(start, stop, count) {
let scale = d3Scale.scaleLinear();
scale.domain([start, stop]);
const axis = d3Axis.axisLeft(scale);
return axis.scale().ticks(count);
}
export function d3TicksLog(start, stop, count) {
if (start < 0) {
start = 0.1;
}
let scale = d3Scale.scaleLog().domain([start, stop]);
const axis = d3Axis.axisBottom(scale);
const generatedTicks = axis.scale().ticks(count);
if (generatedTicks.length < 1) {
// if the difference between start, stop is small, the ticks might not be generated for log
return d3Ticks(start, stop, count);
}
return generatedTicks;
}
/**
* Linear tick generation from d3-array.
*/

View File

@@ -95,11 +95,6 @@ export default {
isUTCBased: timeSystem.isUTCBased
};
},
watch: {
keyString() {
this.setTimeContext();
}
},
mounted() {
this.handleNewBounds = _.throttle(this.handleNewBounds, 300);
this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.timeSystem())));

View File

@@ -115,11 +115,6 @@ export default {
isUTCBased: timeSystem.isUTCBased
};
},
watch: {
keyString() {
this.setTimeContext();
}
},
mounted() {
this.handleNewBounds = _.throttle(this.handleNewBounds, 300);
this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.timeSystem())));

View File

@@ -105,49 +105,42 @@ export default {
watch: {
domainObject: {
handler(domainObject) {
const key = this.openmct.objects.makeKeyString(domainObject.identifier);
if (key !== this.keyString) {
//domain object has changed
this.independentTCEnabled = domainObject.configuration.useIndependentTime === true;
if (!domainObject.configuration.timeOptions || !this.independentTCEnabled) {
this.destroyIndependentTime();
this.independentTCEnabled = domainObject.configuration.useIndependentTime === true;
this.timeOptions = domainObject.configuration.timeOptions || {
clockOffsets: this.openmct.time.clockOffsets(),
fixedOffsets: this.openmct.time.bounds()
};
return;
}
this.initialize();
if (this.timeOptions.start !== domainObject.configuration.timeOptions.start
|| this.timeOptions.end !== domainObject.configuration.timeOptions.end) {
this.timeOptions = domainObject.configuration.timeOptions;
this.destroyIndependentTime();
this.registerIndependentTimeOffsets();
}
},
deep: true
}
},
mounted() {
this.initialize();
this.setTimeContext();
if (this.timeOptions.mode) {
this.mode = this.timeOptions.mode;
} else {
this.timeOptions.mode = this.mode = this.timeContext.clock() === undefined ? { key: 'fixed' } : { key: Object.create(this.timeContext.clock()).key};
}
if (this.independentTCEnabled) {
this.registerIndependentTimeOffsets();
}
},
beforeDestroy() {
this.stopFollowingTimeContext();
this.destroyIndependentTime();
},
methods: {
initialize() {
this.keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
this.setTimeContext();
if (this.timeOptions.mode) {
this.mode = this.timeOptions.mode;
} else {
if (this.timeContext.clock() === undefined) {
this.timeOptions.mode = this.mode = { key: 'fixed' };
} else {
this.timeOptions.mode = this.mode = { key: Object.create(this.timeContext.clock()).key};
}
}
if (this.independentTCEnabled) {
this.registerIndependentTimeOffsets();
}
},
toggleIndependentTC() {
this.independentTCEnabled = !this.independentTCEnabled;
if (this.independentTCEnabled) {
@@ -220,9 +213,10 @@ export default {
offsets = this.timeOptions.clockOffsets;
}
const timeContext = this.openmct.time.getIndependentContext(this.keyString);
const key = this.openmct.objects.makeKeyString(this.domainObject.identifier);
const timeContext = this.openmct.time.getIndependentContext(key);
if (!timeContext.hasOwnContext()) {
this.unregisterIndependentTime = this.openmct.time.addIndependentContext(this.keyString, offsets, this.isFixed ? undefined : this.mode.key);
this.unregisterIndependentTime = this.openmct.time.addIndependentContext(key, offsets, this.isFixed ? undefined : this.mode.key);
} else {
if (this.isFixed) {
timeContext.stopClock();

View File

@@ -1,5 +1,5 @@
<!--
Open MCT, Copyright (c) 2014-2022, United States Government
Open MCT, Copyright (c) 2014-2021, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*