Read legend position from workbook.

This commit is contained in:
Jeff Young 2023-07-17 22:28:05 +01:00
parent 6a09cf3551
commit 764913207c
2 changed files with 19 additions and 10 deletions

View File

@ -654,9 +654,9 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
else else
{ {
int count = 0; int count = 0;
int x0=0; // X position of merged current vertical line int x0 = 0; // X position of merged current vertical line
int ymin0=0; // y min coord of merged current vertical line int ymin0 = 0; // y min coord of merged current vertical line
int ymax0=0; // y max coord of merged current vertical line int ymax0 = 0; // y max coord of merged current vertical line
int dupx0 = 0; // count of currently merged vertical lines int dupx0 = 0; // count of currently merged vertical lines
wxPoint line_start; // starting point of the current line to draw wxPoint line_start; // starting point of the current line to draw
@ -694,6 +694,8 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
// the main trace show this point // the main trace show this point
dc.DrawLine( x0, ymin0, x0, ymax0 ); dc.DrawLine( x0, ymin0, x0, ymax0 );
} }
#else
if( x0 ) { }; // Quiet CLang
#endif #endif
x0 = x1; x0 = x1;

View File

@ -1859,6 +1859,13 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath )
plotTab->SetDottedSecondary( tab_js[ "dottedSecondary" ] ); plotTab->SetDottedSecondary( tab_js[ "dottedSecondary" ] );
plotTab->ShowGrid( tab_js[ "showGrid" ] ); plotTab->ShowGrid( tab_js[ "showGrid" ] );
if( tab_js.contains( "legend" ) )
{
const nlohmann::json& legend_js = tab_js[ "legend" ];
plotTab->SetLegendPosition( wxPoint( legend_js[ "x" ], legend_js[ "y" ] ) );
plotTab->ShowLegend( true );
}
} }
} }