Panda3D
Classes | Public Member Functions | List of all members
PStatStripChart Class Reference

This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color. More...

#include "pStatStripChart.h"

Inheritance diagram for PStatStripChart:
PStatGraph GtkStatsStripChart WinStatsStripChart

Public Member Functions

 PStatStripChart (PStatMonitor *monitor, PStatView &view, int thread_index, int collector_index, int xsize, int ysize)
 
bool first_data () const
 Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart. More...
 
bool get_average_mode () const
 Returns the current state of the average_mode flag. More...
 
int get_collector_index () const
 Returns the particular collector whose data this strip chart reflects. More...
 
int get_collector_under_pixel (int xpoint, int ypoint)
 Return the collector index associated with the particular band of color at the indicated pixel location, or -1 if no band of color was at the pixel. More...
 
double get_horizontal_scale () const
 Returns the amount of total time the width of the horizontal axis represents. More...
 
bool get_scroll_mode () const
 Returns the current state of the scroll_mode flag. More...
 
string get_title_text ()
 Returns the text suitable for the title label on the top line. More...
 
double get_vertical_scale () const
 Returns total value the height of the vertical axis represents. More...
 
PStatViewget_view () const
 Returns the View this chart represents. More...
 
int height_to_pixel (double value) const
 Converts a value (i.e. More...
 
bool is_title_unknown () const
 Returns true if get_title_text() has never yet returned an answer, false if it has. More...
 
void new_data (int frame_number)
 Indicates that new data has become available. More...
 
double pixel_to_height (int y) const
 Converts a vertical pixel offset to a value (a "height" in the strip chart). More...
 
double pixel_to_timestamp (int x) const
 Converts a horizontal pixel offset to a timestamp. More...
 
void set_auto_vertical_scale ()
 Sets the vertical scale to make all the data visible. More...
 
void set_average_mode (bool average_mode)
 Changes the average_mode flag. More...
 
void set_collector_index (int collector_index)
 Changes the collector represented by this strip chart. More...
 
void set_default_vertical_scale ()
 Sets the vertical scale according to the suggested scale of the base collector, if any, or to center the target frame rate bar otherwise. More...
 
void set_horizontal_scale (double time_width)
 Changes the amount of time the width of the horizontal axis represents. More...
 
void set_scroll_mode (bool scroll_mode)
 Changes the scroll_mode flag. More...
 
void set_vertical_scale (double value_height)
 Changes the value the height of the vertical axis represents. More...
 
int timestamp_to_pixel (double time) const
 Converts a timestamp to a horizontal pixel offset. More...
 
void update ()
 Updates the chart with the latest data. More...
 
- Public Member Functions inherited from PStatGraph
 PStatGraph (PStatMonitor *monitor, int xsize, int ysize)
 
int add_user_guide_bar (double height)
 Creates a new user guide bar and returns its index number. More...
 
int find_user_guide_bar (double from_height, double to_height) const
 Returns the index number of the first user guide bar found whose height is within the indicated range, or -1 if no user guide bars fall within the range. More...
 
const GuideBarget_guide_bar (int n) const
 Returns the nth horizontal guide bar. More...
 
const string & get_guide_bar_unit_name () const
 Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. More...
 
int get_guide_bar_units () const
 Returns the units that are displayed for the guide bar labels. More...
 
int get_label_collector (int n) const
 Returns the collector index associated with the nth label. More...
 
LRGBColor get_label_color (int n) const
 Returns the color associated with the nth label. More...
 
string get_label_name (int n) const
 Returns the text associated with the nth label. More...
 
PStatMonitorget_monitor () const
 Returns the monitor associated with this chart. More...
 
int get_num_guide_bars () const
 Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. More...
 
int get_num_labels () const
 Returns the number of labels to be drawn for this chart. More...
 
int get_num_user_guide_bars () const
 Returns the current number of user-defined guide bars. More...
 
double get_target_frame_rate () const
 Returns the indicated target frame rate in Hz. More...
 
GuideBar get_user_guide_bar (int n) const
 Returns the nth user-defined guide bar. More...
 
int get_xsize () const
 Returns the width of the chart in pixels. More...
 
int get_ysize () const
 Returns the height of the chart in pixels. More...
 
void move_user_guide_bar (int n, double height)
 Adjusts the height of the nth user-defined guide bar. More...
 
void remove_user_guide_bar (int n)
 Removes the user guide bar with the indicated index number. More...
 
void set_guide_bar_unit_name (const string &unit_name)
 Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. More...
 
void set_guide_bar_units (int unit_mask)
 Sets the units that are displayed for the guide bar labels. More...
 
void set_target_frame_rate (double frame_rate)
 Sets the target frame rate of the application in Hz. More...
 

Additional Inherited Members

- Public Types inherited from PStatGraph
enum  GuideBarStyle { GBS_normal, GBS_target, GBS_user }
 
enum  GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 }
 
- Static Public Member Functions inherited from PStatGraph
static string format_number (double value)
 Returns a string representing the value nicely formatted for its range. More...
 
static string format_number (double value, int guide_bar_units, const string &unit_name=string())
 Returns a string representing the value nicely formatted for its range, including the units as indicated. More...
 

Detailed Description

This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color.

This class just manages all the strip-chart logic; the actual nuts and bolts of drawing pixels is left to a user-derived class.

Definition at line 42 of file pStatStripChart.h.

Member Function Documentation

◆ first_data()

bool PStatStripChart::first_data ( ) const

Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart.

Definition at line 135 of file pStatStripChart.cxx.

References set_collector_index().

Referenced by update().

◆ get_average_mode()

bool PStatStripChart::get_average_mode ( ) const
inline

Returns the current state of the average_mode flag.

When true, the strip chart will average out the color values over pstats_average_time seconds, which hides spikes and makes the overall trends easier to read. When false, the strip chart shows the actual data as it is happening.

Definition at line 151 of file pStatStripChart.I.

References timestamp_to_pixel().

Referenced by set_average_mode().

◆ get_collector_index()

int PStatStripChart::get_collector_index ( ) const
inline

Returns the particular collector whose data this strip chart reflects.

Definition at line 33 of file pStatStripChart.I.

References set_horizontal_scale().

Referenced by get_view().

◆ get_collector_under_pixel()

int PStatStripChart::get_collector_under_pixel ( int  xpoint,
int  ypoint 
)

Return the collector index associated with the particular band of color at the indicated pixel location, or -1 if no band of color was at the pixel.

Definition at line 219 of file pStatStripChart.cxx.

References PStatThreadData::get_frame_number_at_time(), and get_title_text().

Referenced by set_auto_vertical_scale().

◆ get_horizontal_scale()

double PStatStripChart::get_horizontal_scale ( ) const
inline

Returns the amount of total time the width of the horizontal axis represents.

Definition at line 62 of file pStatStripChart.I.

References set_vertical_scale().

Referenced by set_horizontal_scale().

◆ get_scroll_mode()

bool PStatStripChart::get_scroll_mode ( ) const
inline

Returns the current state of the scroll_mode flag.

When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.

Definition at line 118 of file pStatStripChart.I.

References set_average_mode().

Referenced by set_scroll_mode().

◆ get_title_text()

string PStatStripChart::get_title_text ( )

◆ get_vertical_scale()

double PStatStripChart::get_vertical_scale ( ) const
inline

Returns total value the height of the vertical axis represents.

Definition at line 88 of file pStatStripChart.I.

References set_scroll_mode().

Referenced by set_vertical_scale().

◆ get_view()

PStatView & PStatStripChart::get_view ( ) const
inline

Returns the View this chart represents.

Definition at line 22 of file pStatStripChart.I.

References get_collector_index().

◆ height_to_pixel()

int PStatStripChart::height_to_pixel ( double  value) const
inline

Converts a value (i.e.

a "height" in the strip chart) to a vertical pixel offset.

Definition at line 182 of file pStatStripChart.I.

References PStatGraph::get_ysize(), and pixel_to_height().

Referenced by pixel_to_timestamp().

◆ is_title_unknown()

bool PStatStripChart::is_title_unknown ( ) const

◆ new_data()

void PStatStripChart::new_data ( int  frame_number)

Indicates that new data has become available.

Definition at line 77 of file pStatStripChart.cxx.

References update().

◆ pixel_to_height()

double PStatStripChart::pixel_to_height ( int  y) const
inline

Converts a vertical pixel offset to a value (a "height" in the strip chart).

Definition at line 193 of file pStatStripChart.I.

References PStatGraph::get_ysize().

Referenced by height_to_pixel().

◆ pixel_to_timestamp()

double PStatStripChart::pixel_to_timestamp ( int  x) const
inline

Converts a horizontal pixel offset to a timestamp.

Definition at line 171 of file pStatStripChart.I.

References PStatGraph::get_xsize(), and height_to_pixel().

Referenced by timestamp_to_pixel().

◆ set_auto_vertical_scale()

void PStatStripChart::set_auto_vertical_scale ( )

Sets the vertical scale to make all the data visible.

Definition at line 185 of file pStatStripChart.cxx.

References get_collector_under_pixel(), PStatThreadData::get_frame_number_at_time(), and PStatThreadData::has_frame().

Referenced by set_default_vertical_scale().

◆ set_average_mode()

void PStatStripChart::set_average_mode ( bool  average_mode)
inline

Changes the average_mode flag.

When true, the strip chart will average out the color values over pstats_average_time seconds, which hides spikes and makes the overall trends easier to read. When false, the strip chart shows the actual data as it is happening.

Definition at line 133 of file pStatStripChart.I.

References get_average_mode().

Referenced by get_scroll_mode().

◆ set_collector_index()

void PStatStripChart::set_collector_index ( int  collector_index)

Changes the collector represented by this strip chart.

This may force a redraw.

Definition at line 146 of file pStatStripChart.cxx.

References set_default_vertical_scale().

Referenced by first_data().

◆ set_default_vertical_scale()

void PStatStripChart::set_default_vertical_scale ( )

Sets the vertical scale according to the suggested scale of the base collector, if any, or to center the target frame rate bar otherwise.

Definition at line 165 of file pStatStripChart.cxx.

References PStatClientData::get_collector_def(), PStatClientData::has_collector(), and set_auto_vertical_scale().

Referenced by set_collector_index().

◆ set_horizontal_scale()

void PStatStripChart::set_horizontal_scale ( double  time_width)
inline

Changes the amount of time the width of the horizontal axis represents.

This may force a redraw.

Definition at line 44 of file pStatStripChart.I.

References get_horizontal_scale().

Referenced by get_collector_index().

◆ set_scroll_mode()

void PStatStripChart::set_scroll_mode ( bool  scroll_mode)
inline

Changes the scroll_mode flag.

When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.

Definition at line 101 of file pStatStripChart.I.

References get_scroll_mode().

Referenced by get_vertical_scale().

◆ set_vertical_scale()

void PStatStripChart::set_vertical_scale ( double  value_height)
inline

Changes the value the height of the vertical axis represents.

This may force a redraw.

Definition at line 73 of file pStatStripChart.I.

References get_vertical_scale().

Referenced by get_horizontal_scale(), WinStatsStripChart::set_vertical_scale(), and GtkStatsStripChart::set_vertical_scale().

◆ timestamp_to_pixel()

int PStatStripChart::timestamp_to_pixel ( double  time) const
inline

Converts a timestamp to a horizontal pixel offset.

Definition at line 161 of file pStatStripChart.I.

References PStatGraph::get_xsize(), and pixel_to_timestamp().

Referenced by get_average_mode().

◆ update()

void PStatStripChart::update ( )

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