diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 3821ca989a..564bcde9a3 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -759,6 +759,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent ) updatePlot( trace.second, plotPanel ); plotPanel->UpdateAll(); + plotPanel->ResetScales(); } else { diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index ba5ee67016..dffe31409b 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -452,19 +452,7 @@ bool SIM_PLOT_PANEL::DeleteTrace( const wxString& aName ) DelLayer( cursor, true ); 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(); + ResetScales(); return true; } @@ -517,6 +505,22 @@ void SIM_PLOT_PANEL::EnableCursor( const wxString& aName, bool aEnable ) } +void SIM_PLOT_PANEL::ResetScales() +{ + 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(); +} + + wxColour SIM_PLOT_PANEL::generateColor() { /// @todo have a look at: diff --git a/eeschema/sim/sim_plot_panel.h b/eeschema/sim/sim_plot_panel.h index 59eaabcc69..c88589abcd 100644 --- a/eeschema/sim/sim_plot_panel.h +++ b/eeschema/sim/sim_plot_panel.h @@ -218,6 +218,8 @@ public: void EnableCursor( const wxString& aName, bool aEnable ); + void ResetScales(); + private: wxColour generateColor();