KiCad PCB EDA Suite
LOG_SCALE< parent > Class Template Reference
Inheritance diagram for LOG_SCALE< parent >:

Public Member Functions

 LOG_SCALE (wxString name, wxString unit, int flags)
 
void formatLabels () override
 

Private Attributes

const wxString m_unit
 

Detailed Description

template<typename parent>
class LOG_SCALE< parent >

Definition at line 170 of file sim_plot_panel.cpp.

Constructor & Destructor Documentation

◆ LOG_SCALE()

template<typename parent >
LOG_SCALE< parent >::LOG_SCALE ( wxString  name,
wxString  unit,
int  flags 
)
inline

Definition at line 173 of file sim_plot_panel.cpp.

173: parent( name, flags ), m_unit( unit ){};
const char * name
Definition: DXF_plotter.cpp:56
const wxString m_unit

Member Function Documentation

◆ formatLabels()

template<typename parent >
void LOG_SCALE< parent >::formatLabels ( )
inlineoverride

Definition at line 175 of file sim_plot_panel.cpp.

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 }
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)

References countDecimalDigits(), formatFloat(), getSISuffix(), and LOG_SCALE< parent >::m_unit.

Member Data Documentation

◆ m_unit

template<typename parent >
const wxString LOG_SCALE< parent >::m_unit
private

Definition at line 192 of file sim_plot_panel.cpp.

Referenced by LOG_SCALE< parent >::formatLabels().


The documentation for this class was generated from the following file: