WINDEX
Public Types | Public Member Functions | Public Attributes | List of all members
wex::plot::trace Class Reference

Single trace to be plotted. More...

#include <plot2d.h>

Public Types

enum class  eType { plot , realtime , scatter }
 

Public Member Functions

void set (const std::vector< double > &y)
 set plot data More...
 
void setScatterX (const std::vector< double > &x)
 
std::vector< double > get () const
 
void add (double y)
 add new value to real time data More...
 
void add (double x, double y)
 add point to scatter trace More...
 
void clear ()
 clear data from trace
 
void color (int clr)
 set color
 
int color () const
 
void thick (int t)
 set trace thickness in pixels
 
int thick () const
 
int size () const
 get number of points
 
double value (double xfraction)
 y value at fractional position along x-axis More...
 
const std::vector< double > & getY ()
 

Public Attributes

enum wex::plot::trace::eType myType
 

Detailed Description

Single trace to be plotted.

Application code should not attempt to construct a trace Rather call one of plot::AddPointTrace, plot::AddRealTimeTrace or plot::AddStaticTrace which return a reference to the trace which can be configured and be populated with data.

    form fm;

     construct plot to be drawn on form

    plot::plot thePlot( fm );

     construct plot trace

    auto t1 = thePlot.AddStaticTrace();

     provide some data for  trace

    std::vector< double > d1 { 10, 15, 20, 25, 30, 25, 20, 15, 10 };
    t1.set( d1 );

     plot in blue

    t1.color( colors::blue );

     show and run

    fm.show();
    exec();

Member Function Documentation

◆ add() [1/2]

void wex::plot::trace::add ( double  x,
double  y 
)
inline

add point to scatter trace

Parameters
[in]xlocation
[in]ylocation

An exception is thrown when this is called for a trace that is not scatter type

◆ add() [2/2]

void wex::plot::trace::add ( double  y)
inline

add new value to real time data

Parameters
[in]ythe new data point

An exception is thrown when this is called for a trace that is not real time type.

◆ set()

void wex::plot::trace::set ( const std::vector< double > &  y)
inline

set plot data

Parameters
[in]yvector of data points to display

Replaces any existing data. Plot is NOT refreshed. An exception is thrown when this is called for a trace that is not plot or scatter type

◆ value()

double wex::plot::trace::value ( double  xfraction)
inline

y value at fractional position along x-axis

Parameters
[in]xfractionx-axis position 0 to 1
Returns
y value at position, 0 if xfraction outside range 0 to 1

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