sim: display labels on current scale when only currents are added to transient plot

This commit is contained in:
Tomasz Wlostowski 2016-08-11 14:42:14 +02:00 committed by Maciej Suminski
parent e452992a6c
commit 1930cd4d66
2 changed files with 33 additions and 1 deletions

View File

@ -455,6 +455,25 @@ bool SIM_PLOT_PANEL::AddTrace( const wxString& aName, int aPoints,
if( addedNewEntry ) if( addedNewEntry )
{ {
if ( m_type == ST_TRANSIENT )
{
bool hasVoltageTraces = false;
for( auto t : m_traces )
{
if ( ! (t.second->GetFlags() & SPT_CURRENT ) )
{
hasVoltageTraces = true;
break;
}
}
if ( !hasVoltageTraces )
m_axis_y2->SetMasterScale( nullptr );
else
m_axis_y2->SetMasterScale( m_axis_y1 );
}
// New entry // New entry
t = new TRACE( aName ); t = new TRACE( aName );
t->SetPen( wxPen( generateColor(), 2, wxSOLID ) ); t->SetPen( wxPen( generateColor(), 2, wxSOLID ) );
@ -497,6 +516,8 @@ bool SIM_PLOT_PANEL::AddTrace( const wxString& aName, int aPoints,
else else
t->SetScale( m_axis_x, m_axis_y1 ); t->SetScale( m_axis_x, m_axis_y1 );
t->SetFlags( aFlags );
UpdateAll(); UpdateAll();
return addedNewEntry; return addedNewEntry;

View File

@ -86,7 +86,7 @@ class TRACE : public mpFXYVector
{ {
public: public:
TRACE( const wxString& aName ) : TRACE( const wxString& aName ) :
mpFXYVector( aName ), m_cursor( nullptr ) mpFXYVector( aName ), m_cursor( nullptr ), m_flags(0)
{ {
SetContinuity( true ); SetContinuity( true );
SetDrawOutsideMargins( false ); SetDrawOutsideMargins( false );
@ -127,8 +127,19 @@ public:
return m_cursor; return m_cursor;
} }
void SetFlags ( int aFlags )
{
m_flags = aFlags;
}
int GetFlags() const
{
return m_flags;
}
protected: protected:
CURSOR* m_cursor; CURSOR* m_cursor;
int m_flags;
}; };