Current gain is the first Y axis, not the second.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18205

(cherry picked from commit 7b63429fe1)
This commit is contained in:
Jeff Young 2024-06-14 15:11:13 +01:00
parent e2c53df13b
commit 4d0ca33b47
2 changed files with 41 additions and 14 deletions

View File

@ -818,11 +818,18 @@ void SIM_PLOT_TAB::OnLanguageChanged()
void SIM_PLOT_TAB::UpdateTraceStyle( TRACE* trace ) void SIM_PLOT_TAB::UpdateTraceStyle( TRACE* trace )
{ {
int type = trace->GetType(); int type = trace->GetType();
wxPenStyle penStyle = ( ( ( type & SPT_AC_PHASE ) || ( type & SPT_CURRENT ) ) && m_dotted_cp ) wxPenStyle penStyle;
? wxPENSTYLE_DOT
: wxPENSTYLE_SOLID;
trace->SetPen( wxPen( trace->GetTraceColour(), 2, penStyle ) );
if( ( type & SPT_AC_GAIN ) > 0 )
penStyle = wxPENSTYLE_SOLID;
else if( ( type & SPT_AC_PHASE ) > 0 )
penStyle = m_dotted_cp ? wxPENSTYLE_DOT : wxPENSTYLE_SOLID;
else if( ( type & SPT_CURRENT ) > 0 )
penStyle = m_dotted_cp ? wxPENSTYLE_DOT : wxPENSTYLE_SOLID;
else
penStyle = wxPENSTYLE_SOLID;
trace->SetPen( wxPen( trace->GetTraceColour(), 2, penStyle ) );
m_sessionTraceColors[ trace->GetName() ] = trace->GetTraceColour(); m_sessionTraceColors[ trace->GetName() ] = trace->GetTraceColour();
} }

View File

@ -2456,23 +2456,43 @@ void SIMULATOR_FRAME_UI::updatePlotCursors()
auto getUnitsY = auto getUnitsY =
[&]( TRACE* aTrace ) -> wxString [&]( TRACE* aTrace ) -> wxString
{ {
if( ( aTrace->GetType() & SPT_AC_PHASE ) || ( aTrace->GetType() & SPT_CURRENT ) ) if( plotTab->GetSimType() == ST_AC )
return plotTab->GetUnitsY2(); {
else if( aTrace->GetType() & SPT_POWER ) if( aTrace->GetType() & SPT_AC_PHASE )
return plotTab->GetUnitsY3(); return plotTab->GetUnitsY2();
else
return plotTab->GetUnitsY1();
}
else else
return plotTab->GetUnitsY1(); {
if( aTrace->GetType() & SPT_POWER )
return plotTab->GetUnitsY3();
else if( aTrace->GetType() & SPT_CURRENT )
return plotTab->GetUnitsY2();
else
return plotTab->GetUnitsY1();
}
}; };
auto getNameY = auto getNameY =
[&]( TRACE* aTrace ) -> wxString [&]( TRACE* aTrace ) -> wxString
{ {
if( ( aTrace->GetType() & SPT_AC_PHASE ) || ( aTrace->GetType() & SPT_CURRENT ) ) if( plotTab->GetSimType() == ST_AC )
return plotTab->GetLabelY2(); {
else if( aTrace->GetType() & SPT_POWER ) if( aTrace->GetType() & SPT_AC_PHASE )
return plotTab->GetLabelY3(); return plotTab->GetLabelY2();
else
return plotTab->GetLabelY1();
}
else else
return plotTab->GetLabelY1(); {
if( aTrace->GetType() & SPT_POWER )
return plotTab->GetLabelY3();
else if( aTrace->GetType() & SPT_CURRENT )
return plotTab->GetLabelY2();
else
return plotTab->GetLabelY1();
}
}; };
auto formatValue = auto formatValue =