KiCad PCB EDA Suite
sim_plot_panel.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 CERN
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 * @author Maciej Suminski <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * https://www.gnu.org/licenses/gpl-3.0.html
23 * or you may search the http://www.gnu.org website for the version 3 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#include "sim_plot_colors.h"
29#include "sim_plot_panel.h"
30#include "sim_plot_frame.h"
31
32#include <algorithm>
33#include <limits>
34
35
36static wxString formatFloat( double x, int nDigits )
37{
38 wxString rv, fmt;
39
40 if( nDigits )
41 {
42 fmt.Printf( "%%.0%df", nDigits );
43 }
44 else
45 {
46 fmt = wxT( "%.0f" );
47 }
48
49 rv.Printf( fmt, x );
50
51 return rv;
52}
53
54
55static void getSISuffix( double x, const wxString& unit, int& power, wxString& suffix )
56{
57 const int n_powers = 11;
58
59 const struct
60 {
61 double exponent;
62 char suffix;
63 } powers[] =
64 {
65 { -18, 'a' },
66 { -15, 'f' },
67 { -12, 'p' },
68 { -9, 'n' },
69 { -6, 'u' },
70 { -3, 'm' },
71 { 0, 0 },
72 { 3, 'k' },
73 { 6, 'M' },
74 { 9, 'G' },
75 { 12, 'T' },
76 { 14, 'P' }
77 };
78
79 power = 0;
80 suffix = unit;
81
82 if( x == 0.0 )
83 return;
84
85 for( int i = 0; i < n_powers - 1; i++ )
86 {
87 double r_cur = pow( 10, powers[i].exponent );
88
89 if( fabs( x ) >= r_cur && fabs( x ) < r_cur * 1000.0 )
90 {
91 power = powers[i].exponent;
92
93 if( powers[i].suffix )
94 suffix = wxString( powers[i].suffix ) + unit;
95 else
96 suffix = unit;
97
98 return;
99 }
100 }
101}
102
103
104static int countDecimalDigits( double x, int maxDigits )
105{
106 if( std::isnan( x ) )
107 {
108 // avoid trying to count the decimals of NaN
109 return 0;
110 }
111
112 int64_t k = (int)( ( x - floor( x ) ) * pow( 10.0, (double) maxDigits ) );
113 int n = 0;
114
115 while( k && ( ( k % 10LL ) == 0LL || ( k % 10LL ) == 9LL ) )
116 {
117 k /= 10LL;
118 }
119
120 n = 0;
121
122 while( k != 0LL )
123 {
124 n++;
125 k /= 10LL;
126 }
127
128 return n;
129}
130
131
132template <typename parent>
133class LIN_SCALE : public parent
134{
135public:
136 LIN_SCALE( wxString name, wxString unit, int flags ) : parent( name, flags ), m_unit( unit ){};
137
138 void formatLabels() override
139 {
140 double maxVis = parent::AbsVisibleMaxValue();
141
142 wxString suffix;
143 int power, digits = 0;
144 int constexpr DIGITS = 3;
145
146 getSISuffix( maxVis, m_unit, power, suffix );
147
148 double sf = pow( 10.0, power );
149
150 for( auto& l : parent::TickLabels() )
151 {
152 int k = countDecimalDigits( l.pos / sf, DIGITS );
153
154 digits = std::max( digits, k );
155 }
156
157 for( auto& l : parent::TickLabels() )
158 {
159 l.label = formatFloat( l.pos / sf, digits ) + suffix;
160 l.visible = true;
161 }
162 }
163
164private:
165 const wxString m_unit;
166};
167
168
169template <typename parent>
170class LOG_SCALE : public parent
171{
172public:
173 LOG_SCALE( wxString name, wxString unit, int flags ) : parent( name, flags ), m_unit( unit ){};
174
175 void formatLabels() override
176 {
177 wxString suffix;
178 int power;
179
180 for( auto& l : parent::TickLabels() )
181 {
182 getSISuffix( l.pos, m_unit, power, suffix );
183 double sf = pow( 10.0, power );
184 int k = countDecimalDigits( l.pos / sf, 3 );
185
186 l.label = formatFloat( l.pos / sf, k ) + suffix;
187 l.visible = true;
188 }
189 }
190
191private:
192 const wxString m_unit;
193};
194
195
196void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
197{
198 if( !m_window )
199 m_window = &aWindow;
200
201 if( !m_visible )
202 return;
203
204 const auto& dataX = m_trace->GetDataX();
205 const auto& dataY = m_trace->GetDataY();
206
207 if( dataX.size() <= 1 )
208 return;
209
210 if( m_updateRequired )
211 {
212 m_coords.x = m_trace->s2x( aWindow.p2x( m_dim.x ) );
213
214 // Find the closest point coordinates
215 auto maxXIt = std::upper_bound( dataX.begin(), dataX.end(), m_coords.x );
216 int maxIdx = maxXIt - dataX.begin();
217 int minIdx = maxIdx - 1;
218
219 // Out of bounds checks
220 if( minIdx < 0 )
221 {
222 minIdx = 0;
223 maxIdx = 1;
224 m_coords.x = dataX[0];
225 }
226 else if( maxIdx >= (int) dataX.size() )
227 {
228 maxIdx = dataX.size() - 1;
229 minIdx = maxIdx - 1;
230 m_coords.x = dataX[maxIdx];
231 }
232
233 const double leftX = dataX[minIdx];
234 const double rightX = dataX[maxIdx];
235 const double leftY = dataY[minIdx];
236 const double rightY = dataY[maxIdx];
237
238 // Linear interpolation
239 m_coords.y = leftY + ( rightY - leftY ) / ( rightX - leftX ) * ( m_coords.x - leftX );
240 m_updateRequired = false;
241
242 // Notify the parent window about the changes
243 wxQueueEvent( aWindow.GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
244 }
245 else
246 {
247 m_updateRef = true;
248 }
249
250 if( m_updateRef )
251 {
253 m_updateRef = false;
254 }
255
256 // Line length in horizontal and vertical dimensions
257 const wxPoint cursorPos( aWindow.x2p( m_trace->x2s( m_coords.x ) ),
258 aWindow.y2p( m_trace->y2s( m_coords.y ) ) );
259
260 wxCoord leftPx = m_drawOutsideMargins ? 0 : aWindow.GetMarginLeft();
261 wxCoord rightPx = m_drawOutsideMargins ? aWindow.GetScrX() :
262 aWindow.GetScrX() - aWindow.GetMarginRight();
263 wxCoord topPx = m_drawOutsideMargins ? 0 : aWindow.GetMarginTop();
264 wxCoord bottomPx = m_drawOutsideMargins ? aWindow.GetScrY() :
265 aWindow.GetScrY() - aWindow.GetMarginBottom();
266
267 wxPen pen = GetPen();
268 pen.SetStyle( m_continuous ? wxPENSTYLE_SOLID : wxPENSTYLE_LONG_DASH );
269 aDC.SetPen( pen );
270
271 if( topPx < cursorPos.y && cursorPos.y < bottomPx )
272 aDC.DrawLine( leftPx, cursorPos.y, rightPx, cursorPos.y );
273
274 if( leftPx < cursorPos.x && cursorPos.x < rightPx )
275 aDC.DrawLine( cursorPos.x, topPx, cursorPos.x, bottomPx );
276}
277
278
279bool CURSOR::Inside( wxPoint& aPoint )
280{
281 if( !m_window )
282 return false;
283
284 return ( std::abs( (double) aPoint.x -
285 m_window->x2p( m_trace->x2s( m_coords.x ) ) ) <= DRAG_MARGIN )
286 || ( std::abs( (double) aPoint.y -
287 m_window->y2p( m_trace->y2s( m_coords.y ) ) ) <= DRAG_MARGIN );
288}
289
290
292{
293 if( !m_window )
294 return;
295
298}
299
300
301SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aCommand, wxWindow* parent,
302 SIM_PLOT_FRAME* aMainFrame, wxWindowID id, const wxPoint& pos,
303 const wxSize& size, long style, const wxString& name )
304 : SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ),
305 m_axis_x( nullptr ),
306 m_axis_y1( nullptr ),
307 m_axis_y2( nullptr ),
308 m_dotted_cp( false ),
309 m_masterFrame( aMainFrame )
310{
311 m_sizer = new wxBoxSizer( wxVERTICAL );
312 m_plotWin = new mpWindow( this, wxID_ANY, pos, size, style );
313
314 m_plotWin->LimitView( true );
315 m_plotWin->SetMargins( 50, 80, 50, 80 );
316
318
319 updateAxes();
320
321 // a mpInfoLegend displays le name of traces on the left top panel corner:
322 m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
323 m_legend->SetVisible( false );
325
328
329 m_sizer->Add( m_plotWin, 1, wxALL | wxEXPAND, 1 );
330 SetSizer( m_sizer );
331}
332
333
335{
336 // ~mpWindow destroys all the added layers, so there is no need to destroy m_traces contents
337}
338
339
341{
342 if( m_axis_x )
343 return;
344
345 switch( GetType() )
346 {
347 case ST_AC:
348 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
349 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Gain" ), wxT( "dBV" ), mpALIGN_LEFT );
350 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Phase" ), wxT( "\u00B0" ),
351 mpALIGN_RIGHT ); // degree sign
353 break;
354
355 case ST_DC:
357 break;
358
359 case ST_NOISE:
360 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
361 m_axis_y1 = new mpScaleY( _( "noise [(V or A)^2/Hz]" ), mpALIGN_LEFT );
362 break;
363
364 case ST_TRANSIENT:
365 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Time" ), wxT( "s" ), mpALIGN_BOTTOM );
366 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage" ), wxT( "V" ), mpALIGN_LEFT );
367 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
369 break;
370
371 default:
372 // suppress warnings
373 break;
374 }
375
376 if( m_axis_x )
377 {
378 m_axis_x->SetTicks( false );
380
382 }
383
384 if( m_axis_y1 )
385 {
386 m_axis_y1->SetTicks( false );
389 }
390
391 if( m_axis_y2 )
392 {
393 m_axis_y2->SetTicks( false );
396 }
397}
398
400{
401 wxString sim_cmd = getSimCommand().Lower();
402 wxString rem;
403
404 if( sim_cmd.StartsWith( ".dc", &rem ) )
405 {
406 wxChar ch;
407
408 rem.Trim( false );
409
410 try
411 {
412 ch = rem.GetChar( 0 );
413 }
414 catch( ... )
415 {;}
416
417 switch( ch )
418 {
419 // Make sure that we have a reliable default (even if incorrectly labeled)
420 default:
421 case 'v':
422 m_axis_x =
423 new LIN_SCALE<mpScaleX>( _( "Voltage (swept)" ), wxT( "V" ), mpALIGN_BOTTOM );
424 break;
425 case 'i':
426 m_axis_x =
427 new LIN_SCALE<mpScaleX>( _( "Current (swept)" ), wxT( "A" ), mpALIGN_BOTTOM );
428 break;
429 case 'r':
430 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Resistance (swept)" ), wxT( "\u03A9" ),
432 break;
433 case 't':
434 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Temperature (swept)" ), wxT( "\u00B0C" ),
436 break;
437 }
438
439 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage (measured)" ), wxT( "V" ), mpALIGN_LEFT );
440 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
441 }
442}
443
444
446{
447 // Update bg and fg colors:
451
452 // Update color of all traces
453 for( auto& t : m_traces )
454 if( t.second->GetCursor() )
455 t.second->GetCursor()->SetPen(
457
459}
460
461
463{
464 int type = trace->GetType();
465 wxPenStyle penStyle = ( ( ( type & SPT_AC_PHASE ) || ( type & SPT_CURRENT ) ) && m_dotted_cp )
466 ? wxPENSTYLE_DOT
467 : wxPENSTYLE_SOLID;
468 trace->SetPen( wxPen( trace->GetTraceColour(), 2, penStyle ) );
469}
470
471
472bool SIM_PLOT_PANEL::addTrace( const wxString& aTitle, const wxString& aName, int aPoints,
473 const double* aX, const double* aY, SIM_PLOT_TYPE aType )
474{
475 TRACE* trace = nullptr;
476 wxString name = aTitle;
477
478 updateAxes();
479
480 // Find previous entry, if there is one
481 auto prev = m_traces.find( name );
482 bool addedNewEntry = ( prev == m_traces.end() );
483
484 if( addedNewEntry )
485 {
486 if( GetType() == ST_TRANSIENT )
487 {
488 bool hasVoltageTraces = false;
489
490 for( const auto& tr : m_traces )
491 {
492 if( !( tr.second->GetType() & SPT_CURRENT ) )
493 {
494 hasVoltageTraces = true;
495 break;
496 }
497 }
498
499 if( !hasVoltageTraces )
500 m_axis_y2->SetMasterScale( nullptr );
501 else
503 }
504
505 // New entry
506 trace = new TRACE( aName, aType );
508 UpdateTraceStyle( trace );
509 m_traces[name] = trace;
510
511 // It is a trick to keep legend & coords always on the top
512 for( mpLayer* l : m_topLevel )
513 m_plotWin->DelLayer( l );
514
515 m_plotWin->AddLayer( (mpLayer*) trace );
516
517 for( mpLayer* l : m_topLevel )
518 m_plotWin->AddLayer( l );
519 }
520 else
521 {
522 trace = prev->second;
523 }
524
525 std::vector<double> tmp( aY, aY + aPoints );
526
527 if( GetType() == ST_AC )
528 {
529 if( aType & SPT_AC_PHASE )
530 {
531 for( int i = 0; i < aPoints; i++ )
532 tmp[i] = tmp[i] * 180.0 / M_PI; // convert to degrees
533 }
534 else
535 {
536 for( int i = 0; i < aPoints; i++ )
537 {
538 // log( 0 ) is not valid.
539 if( tmp[i] != 0 )
540 tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
541 }
542 }
543 }
544
545 trace->SetData( std::vector<double>( aX, aX + aPoints ), tmp );
546
547 if( ( aType & SPT_AC_PHASE ) || ( aType & SPT_CURRENT ) )
548 trace->SetScale( m_axis_x, m_axis_y2 );
549 else
550 trace->SetScale( m_axis_x, m_axis_y1 );
551
553
554 return addedNewEntry;
555}
556
557
558bool SIM_PLOT_PANEL::deleteTrace( const wxString& aName )
559{
560 auto it = m_traces.find( aName );
561
562 if( it != m_traces.end() )
563 {
564 TRACE* trace = it->second;
565 m_traces.erase( it );
566
567 if( CURSOR* cursor = trace->GetCursor() )
568 m_plotWin->DelLayer( cursor, true );
569
570 m_plotWin->DelLayer( trace, true, true );
571 ResetScales();
572
573 return true;
574 }
575
576 return false;
577}
578
579
581{
582 for( auto& t : m_traces )
583 {
584 deleteTrace( t.first );
585 }
586
587 m_traces.clear();
588}
589
590
591bool SIM_PLOT_PANEL::HasCursorEnabled( const wxString& aName ) const
592{
593 TRACE* t = GetTrace( aName );
594
595 return t ? t->HasCursor() : false;
596}
597
598
599void SIM_PLOT_PANEL::EnableCursor( const wxString& aName, bool aEnable )
600{
601 TRACE* t = GetTrace( aName );
602
603 if( t == nullptr || t->HasCursor() == aEnable )
604 return;
605
606 if( aEnable )
607 {
608 CURSOR* c = new CURSOR( t, this );
609 int plotCenter = GetPlotWin()->GetMarginLeft()
612 / 2;
613 c->SetX( plotCenter );
615 t->SetCursor( c );
616 m_plotWin->AddLayer( c );
617 }
618 else
619 {
620 CURSOR* c = t->GetCursor();
621 t->SetCursor( nullptr );
622 m_plotWin->DelLayer( c, true );
623 }
624
625 // Notify the parent window about the changes
626 wxQueueEvent( GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
627}
628
629
631{
632 if( m_axis_x )
634
635 if( m_axis_y1 )
637
638 if( m_axis_y2 )
640
641 for( auto& t : m_traces )
642 t.second->UpdateScales();
643}
644
645
646wxDEFINE_EVENT( EVT_SIM_CURSOR_UPDATE, wxCommandEvent );
const char * name
Definition: DXF_plotter.cpp:56
Cursor attached to a trace to follow its values:
mpWindow * m_window
void SetX(int aX)
wxRealPoint m_coords
bool m_updateRef
static constexpr int DRAG_MARGIN
void UpdateReference() override
Updates the rectangle reference point.
bool m_updateRequired
bool Inside(wxPoint &aPoint) override
Checks whether a point is inside the info box rectangle.
void Plot(wxDC &aDC, mpWindow &aWindow) override
Plot method.
const TRACE * m_trace
LIN_SCALE(wxString name, wxString unit, int flags)
const wxString m_unit
void formatLabels() override
void formatLabels() override
LOG_SCALE(wxString name, wxString unit, int flags)
const wxString m_unit
const wxString & getSimCommand() const
SIM_TYPE GetType() const
wxColour GenerateColor(std::map< wxString, TRACE * > aTraces)
wxColour GetPlotColor(enum COLOR_SET aColorId)
Implementing SIM_PLOT_FRAME_BASE.
mpScaleY * m_axis_y1
bool addTrace(const wxString &aTitle, const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aType)
void UpdatePlotColors()
‍Update plot colors
wxBoxSizer * m_sizer
SIM_PLOT_COLORS m_colors
TRACE * GetTrace(const wxString &aName) const
void EnableCursor(const wxString &aName, bool aEnable)
Reset scale ranges to fit the current traces.
mpInfoLegend * m_legend
void updateAxes()
‍Create/Ensure axes are available for plotting
void UpdateTraceStyle(TRACE *trace)
void ResetScales()
Update trace line style.
virtual ~SIM_PLOT_PANEL()
set the pointer to the sim plot frame
std::map< wxString, TRACE * > m_traces
mpScaleXBase * m_axis_x
SIM_PLOT_PANEL(const wxString &aCommand, wxWindow *parent, SIM_PLOT_FRAME *aMainFrame, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
bool deleteTrace(const wxString &aName)
mpWindow * m_plotWin
bool HasCursorEnabled(const wxString &aName) const
Toggle cursor for a particular trace.
mpWindow * GetPlotWin() const
mpScaleY * m_axis_y2
std::vector< mpLayer * > m_topLevel
void SetCursor(CURSOR *aCursor)
wxColour GetTraceColour()
void SetTraceColour(wxColour aColour)
bool HasCursor() const
void SetData(const std::vector< double > &aX, const std::vector< double > &aY) override
Assigns new data set for the trace.
SIM_PLOT_TYPE GetType() const
const std::vector< double > & GetDataY() const
const std::vector< double > & GetDataX() const
CURSOR * GetCursor() const
virtual void SetScale(mpScaleBase *scaleX, mpScaleBase *scaleY)
Definition: mathplot.cpp:3523
double y2s(double y) const
Definition: mathplot.cpp:3560
double x2s(double x) const
Definition: mathplot.cpp:3554
double s2x(double plotCoordX) const
Definition: mathplot.cpp:3542
wxPoint m_reference
Definition: mathplot.h:396
wxRect m_dim
Definition: mathplot.h:395
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:438
bool m_drawOutsideMargins
Definition: mathplot.h:320
bool m_continuous
Definition: mathplot.h:318
void SetPen(wxPen pen)
Set layer pen.
Definition: mathplot.h:277
bool m_visible
Definition: mathplot.h:322
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:248
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:302
void SetNameAlign(int align)
Definition: mathplot.h:709
void SetTicks(bool enable)
Set X axis ticks or grid.
Definition: mathplot.h:714
void ResetDataRange()
Definition: mathplot.h:759
void SetTicks(bool ticks)
Set Y axis ticks or grid.
Definition: mathplot.h:969
void SetMasterScale(mpScaleY *masterScale)
Definition: mathplot.h:979
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:1047
void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
Set Color theme.
Definition: mathplot.cpp:2748
int GetMarginLeft() const
Definition: mathplot.h:1377
int GetScrX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:1138
void SetMargins(int top, int right, int bottom, int left)
Set window margins, creating a blank area where some kinds of layers cannot draw.
Definition: mathplot.cpp:2682
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1192
int GetXScreen(void) const
Definition: mathplot.h:1139
void LimitView(bool aEnable)
Limit zooming & panning to the area used by the plots.
Definition: mathplot.h:1429
wxCoord x2p(double x)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition: mathplot.h:1202
int GetMarginTop() const
Definition: mathplot.h:1371
bool DelLayer(mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true)
Remove a plot layer from the canvas.
Definition: mathplot.cpp:2273
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2403
wxCoord y2p(double y)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition: mathplot.h:1207
int GetMarginRight() const
Definition: mathplot.h:1373
int GetMarginBottom() const
Definition: mathplot.h:1375
void EnableDoubleBuffer(bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
Definition: mathplot.h:1212
int GetScrY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:1147
bool AddLayer(mpLayer *layer, bool refreshDisplay=true)
Add a plot layer to the canvas.
Definition: mathplot.cpp:2256
#define _(s)
class WXDLLIMPEXP_MATHPLOT mpWindow
Definition: mathplot.h:108
#define mpALIGN_RIGHT
Aligns label to the right.
Definition: mathplot.h:477
#define mpALIGN_LEFT
Aligns label to the left.
Definition: mathplot.h:481
class WXDLLIMPEXP_MATHPLOT mpScaleY
Definition: mathplot.h:107
#define mpALIGN_BOTTOM
Aligns label to the bottom.
Definition: mathplot.h:485
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
Class is responsible for providing colors for traces on simulation plot.
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
wxDEFINE_EVENT(EVT_SIM_CURSOR_UPDATE, wxCommandEvent)
static void getSISuffix(double x, const wxString &unit, int &power, wxString &suffix)
static int countDecimalDigits(double x, int maxDigits)
static wxString formatFloat(double x, int nDigits)
SIM_PLOT_TYPE
Definition: sim_types.h:47
@ SPT_AC_PHASE
Definition: sim_types.h:51
@ SPT_CURRENT
Definition: sim_types.h:50
@ ST_TRANSIENT
Definition: sim_types.h:42
@ ST_NOISE
Definition: sim_types.h:37
@ ST_AC
Definition: sim_types.h:34
@ ST_DC
Definition: sim_types.h:35