diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index f12b215871..ccef8ec6e2 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -488,7 +488,7 @@ void SIM_PLOT_PANEL::updateAxes( SIM_TRACE_TYPE aNewTraceType ) break; case ST_DC: - prepareDCAxes(); + prepareDCAxes( aNewTraceType ); break; case ST_NOISE: @@ -549,7 +549,7 @@ void SIM_PLOT_PANEL::updateAxes( SIM_TRACE_TYPE aNewTraceType ) } } -void SIM_PLOT_PANEL::prepareDCAxes() +void SIM_PLOT_PANEL::prepareDCAxes( SIM_TRACE_TYPE aNewTraceType ) { wxString sim_cmd = GetSimCommand().Lower(); wxString rem; @@ -634,6 +634,19 @@ void SIM_PLOT_PANEL::prepareDCAxes() m_axis_y1->SetName( _( "Voltage (measured)" ) ); m_axis_y2->SetName( _( "Current" ) ); + + if( ( aNewTraceType & SPT_POWER ) && !m_axis_y3 ) + { + m_plotWin->SetMargins( 35, 140, 35, 70 ); + + m_axis_y3 = new LIN_SCALE( wxEmptyString, wxT( "W" ), mpALIGN_FAR_RIGHT ); + m_axis_y3->SetNameAlign( mpALIGN_FAR_RIGHT ); + m_axis_y3->SetMasterScale( m_axis_y1 ); + m_plotWin->AddLayer( m_axis_y3 ); + } + + if( m_axis_y3 ) + m_axis_y3->SetName( _( "Power" ) ); } } @@ -688,7 +701,7 @@ TRACE* SIM_PLOT_PANEL::AddTrace( const wxString& aTitle, const wxString& aName, updateAxes( aType ); - if( GetType() == ST_TRANSIENT ) + if( GetType() == ST_TRANSIENT || GetType() == ST_DC ) { bool hasVoltageTraces = false; diff --git a/eeschema/sim/sim_plot_panel.h b/eeschema/sim/sim_plot_panel.h index 7283c1c6d3..3edaad932f 100644 --- a/eeschema/sim/sim_plot_panel.h +++ b/eeschema/sim/sim_plot_panel.h @@ -309,7 +309,7 @@ public: private: ///< @brief Construct the plot axes for DC simulation plot. - void prepareDCAxes(); + void prepareDCAxes( SIM_TRACE_TYPE aNewTraceType ); ///> Create/Ensure axes are available for plotting void updateAxes( SIM_TRACE_TYPE aNewTraceType = SIM_TRACE_TYPE::SPT_UNKNOWN );