Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toggling markers, alarm markers, marker style + update Vue.extend() usage to Vue 3 #6868

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 13 additions & 16 deletions src/plugins/plot/chart/MctChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
import PlotConfigurationModel from '../configuration/PlotConfigurationModel';
import LimitLine from './LimitLine.vue';
import LimitLabel from './LimitLabel.vue';
import Vue from 'vue';
import mount from 'utils/mount';
import { toRaw } from 'vue';

const MARKER_SIZE = 6.0;
const HIGHLIGHT_SIZE = MARKER_SIZE * 2.0;
Expand Down Expand Up @@ -315,7 +316,7 @@
return;
}

const elements = this.seriesElements.get(series);
const elements = this.seriesElements.get(toRaw(series));
elements.lines.forEach(function (line) {
this.lines.splice(this.lines.indexOf(line), 1);
line.destroy();
Expand All @@ -333,7 +334,7 @@
return;
}

const elements = this.seriesElements.get(series);
const elements = this.seriesElements.get(toRaw(series));
if (elements.alarmSet) {
elements.alarmSet.destroy();
this.alarmSets.splice(this.alarmSets.indexOf(elements.alarmSet), 1);
Expand All @@ -349,7 +350,7 @@
return;
}

const elements = this.seriesElements.get(series);
const elements = this.seriesElements.get(toRaw(series));

Check warning on line 353 in src/plugins/plot/chart/MctChart.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/plot/chart/MctChart.vue#L353

Added line #L353 was not covered by tests
elements.pointSets.forEach(function (pointSet) {
this.pointSets.splice(this.pointSets.indexOf(pointSet), 1);
pointSet.destroy();
Expand Down Expand Up @@ -473,7 +474,7 @@
this.$emit('plotReinitializeCanvas');
},
removeChartElement(series) {
const elements = this.seriesElements.get(series);
const elements = this.seriesElements.get(toRaw(series));

elements.lines.forEach(function (line) {
this.lines.splice(this.lines.indexOf(line), 1);
Expand Down Expand Up @@ -576,7 +577,7 @@
this.seriesLimits.set(series, limitElements);
},
clearLimitLines(series) {
const seriesLimits = this.seriesLimits.get(series);
const seriesLimits = this.seriesLimits.get(toRaw(series));

Check warning on line 580 in src/plugins/plot/chart/MctChart.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/plot/chart/MctChart.vue#L580

Added line #L580 was not covered by tests

if (seriesLimits) {
seriesLimits.limitLines.forEach(function (line) {
Expand Down Expand Up @@ -747,16 +748,14 @@
left: 0,
top: this.drawAPI.y(limit.point.y)
};
let LimitLineClass = Vue.extend(LimitLine);
const component = new LimitLineClass({
propsData: {
const { vNode } = mount(LimitLine, {

Check warning on line 751 in src/plugins/plot/chart/MctChart.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/plot/chart/MctChart.vue#L751

Added line #L751 was not covered by tests
props: {
point,
limit
}
});
component.$mount();

return component.$el;
return vNode.el;

Check warning on line 758 in src/plugins/plot/chart/MctChart.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/plot/chart/MctChart.vue#L758

Added line #L758 was not covered by tests
},
getLimitOverlap(limit, overlapMap) {
//calculate if limit lines are too close to each other
Expand Down Expand Up @@ -792,16 +791,14 @@
left: 0,
top: this.drawAPI.y(limit.point.y)
};
let LimitLabelClass = Vue.extend(LimitLabel);
const component = new LimitLabelClass({
propsData: {
const { vNode } = mount(LimitLabel, {
props: {
limit: Object.assign({}, overlap, limit),
point
}
});
component.$mount();

return component.$el;
return vNode.el;
},
drawAlarmPoints(alarmSet) {
this.drawAPI.drawLimitPoints(
Expand Down