diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 9d9d311832..df4d828f9a 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -3600,15 +3600,17 @@ void mpFXY::SetScale ( mpScaleBase *scaleX, mpScaleBase *scaleY ) m_scaleY = scaleY; //printf("SetScales : %p %p\n", scaleX, scaleY); + UpdateScales(); +} + +void mpFXY::UpdateScales() +{ if(m_scaleX) - { m_scaleX->ExtendDataRange(GetMinX(), GetMaxX()); - } + if(m_scaleY) - { m_scaleY->ExtendDataRange(GetMinY(), GetMaxY()); - } } diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index 97c130ad18..ba5ee67016 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -453,6 +453,19 @@ bool SIM_PLOT_PANEL::DeleteTrace( const wxString& aName ) DelLayer( trace, true, true ); + // Reset scales + if( m_axis_x ) + m_axis_x->ResetDataRange(); + + if( m_axis_y1 ) + m_axis_y1->ResetDataRange(); + + if( m_axis_y2 ) + m_axis_y2->ResetDataRange(); + + for( auto t : m_traces ) + t.second->UpdateScales(); + return true; } diff --git a/include/widgets/mathplot.h b/include/widgets/mathplot.h index 6b86083825..668e756fdc 100644 --- a/include/widgets/mathplot.h +++ b/include/widgets/mathplot.h @@ -612,6 +612,8 @@ class WXDLLIMPEXP_MATHPLOT mpFXY : public mpLayer virtual void SetScale(mpScaleBase *scaleX, mpScaleBase *scaleY); + void UpdateScales(); + double s2x(double plotCoordX) const; double s2y(double plotCoordY) const; @@ -740,6 +742,10 @@ public: } } + void ResetDataRange() + { + m_rangeSet = 0; + } double AbsMaxValue() const {