[Plots, Multiple-Y Axis] Fix for rectangle drawn on each axis (#6490)

* Change logic so that the rectangle is only drawn on one axis

* Filter firstDrawableAxis before the rest of the logic

* Update to filter yAxisIds by the canDraw function
This commit is contained in:
Khalid Adil 2023-03-24 15:46:10 -05:00 committed by GitHub
parent 59278e8a06
commit d0ca398e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -603,19 +603,20 @@ export default {
const mainYAxisId = this.config.yAxis.get('id');
//There has to be at least one yAxis
const yAxisIds = [mainYAxisId].concat(this.config.additionalYAxes.map(yAxis => yAxis.get('id')));
// Repeat drawing for all yAxes
yAxisIds.forEach((id) => {
if (this.canDraw(id)) {
this.updateViewport(id);
this.drawSeries(id);
this.drawRectangles(id);
this.drawHighlights(id);
// only draw these in fixed time mode or plot is paused
if (this.annotationViewingAndEditingAllowed) {
this.drawAnnotatedPoints(id);
this.drawAnnotationSelections(id);
}
// Repeat drawing for all yAxes
yAxisIds.filter(this.canDraw).forEach((id, yAxisIndex) => {
this.updateViewport(id);
this.drawSeries(id);
if (yAxisIndex === 0) {
this.drawRectangles(id);
}
this.drawHighlights(id);
// only draw these in fixed time mode or plot is paused
if (this.annotationViewingAndEditingAllowed) {
this.drawAnnotatedPoints(id);
this.drawAnnotationSelections(id);
}
});
},