|
| plot (gui *parent) |
| CTOR. More...
|
|
trace & | AddStaticTrace () |
| Add static trace. More...
|
|
trace & | AddRealTimeTrace (int w) |
| Add real time trace. More...
|
|
trace & | AddScatterTrace () |
| Add scatter trace. More...
|
|
void | grid (bool enable) |
| Enable display of grid markings.
|
|
void | setFixedScale (double minX, double maxX, double minY, double maxY) |
| Set fixed scale. More...
|
|
void | setFitScale () |
|
int | traceCount () const |
|
void | clear () |
| Remove all traces from plot.
|
|
void | dragExtend (sMouse &m) |
| Disable auto-fit scaling and set Y minumum, maximum. More...
|
|
void | XUValues (float start_xu, float scale_xi2xu) |
| Set conversion from index of x value buffer to x user units. More...
|
|
void | XValues (float start_xu, float scale_xi2xu) |
| for backward compatability More...
|
|
bool | CalcScale (int w, int h) |
| calculate scaling factors so plot will fit in window client area More...
|
|
std::vector< trace * > & | traces () |
|
double | pixel2Xuser (int xpixel) const |
| get X user value from x pixel
|
|
int | xuser2pixel (double xu) const |
|
double | pixel2Yuser (int ypixel) const |
| get Y user value from y pixel
|
|
| gui () |
| Construct top level window with no parent. More...
|
|
| gui (gui *parent, const char *window_class="windex", unsigned long style=WS_CHILD, unsigned long exstyle=WS_EX_CONTROLPARENT) |
| Construct child of a parent. More...
|
|
void | child (gui *w) |
| register child on this window
|
|
children_t & | children () |
| get vector of children
|
|
gui * | parent () |
|
gui * | find (int id) |
| find child window with specified id
|
|
void | focus () |
|
void | bgcolor (int color) |
| Change background color. More...
|
|
void | nobgerase () |
|
void | enable (bool f=true) |
| Enable/Disable, default enable.
|
|
bool | isEnabled () const |
|
void | fontHeight (int h) |
| Change font height for this and all child windows.
|
|
void | fontName (const std::string &name) |
|
void | icon (const std::string &iconfilename) |
| Change icon. More...
|
|
void | cursor (char *cursorID) |
|
int | id () |
|
int | bgcolor () const |
|
void | textColor (int c) |
| Set text color. More...
|
|
void | text (const std::string &text) |
|
std::string | text () const |
|
void | scroll (bool fHoriz=true) |
| Add scrollbars. More...
|
|
void | scrollRange (int width, int height) |
| Set the scrolling range. More...
|
|
sMouse | getMouseStatus () |
| Get mouse status. More...
|
|
void | run () |
| Run the windows message loop. More...
|
|
void | tooltip (const std::string &text, int width=0) |
| Add tooltip that pops up helpfully when mouse cursor hovers over widget. More...
|
|
virtual LRESULT | WindowMessageHandler (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
virtual void | show (bool f=true) |
| Show window and all children.
|
|
void | showModal (gui &appWindow) |
| Show this window and suspend all other windows interactions until this is closed. More...
|
|
void | endModal () |
| Stop modal interaction and close window.
|
|
void | update () |
| force widget to redraw completely More...
|
|
void | move (const std::vector< int > &r) |
| Move the window. More...
|
|
void | size (int w, int h) |
| Change size without moving top left corner. More...
|
|
void | move (int x, int y) |
| Change position without changing size. More...
|
|
void | move (int x, int y, int w, int h) |
|
std::vector< int > | size () |
| Size of window client area. More...
|
|
std::vector< int > | lefttop () |
|
eventhandler & | events () |
| Get event handler.
|
|
HWND | handle () |
| get window handle
|
|
void | delete_list (std::vector< HWND > *list) |
| set delete list for when gui is detroyed
|
|
void | setfont (LOGFONT &logfont, HFONT &font) |
| change font for this and all child windows
|
|
void | setAsyncReadCompleteMsgID (int id) |
|
Draw a 2D plot.
The plot contains one or more traces.
Each trace can be of one of three types:
- Plot: succesive y-values with line drawn between them.
- Scatter: succesive x,y-values with box around each point
- Realtime: a specified number of the most recent y-values
Any number of plot and scatter traces can be shown together, only one realtime trace may be present in a plot.
ZOOM
To zoom into a selected area of the plot click on the top left of the area and drag the mouse to the bottom right. The plot will draw a box around the area selected. When the left button is released, the plot will zoom in to show just the selected area. To restore auto-fit, right click on the plot.
If application code is required to use the right click ( e.g. for a context pop-up menu ) the event handler must first call the plot method autofit.
myPlotB.events().clickRight([&]
{
myPlotB.autoFit();
...
});
Sample plot application:
#include "wex.h"
#include "plot2d.h"
int main()
{
wex::gui& fm = wex::maker::make();
fm.move( {50,50,1200,600} );
// construct plot to be drawn on form
wex::plot::plot& thePlot = wex::maker::make<wex::plot::plot>(fm);
thePlot.move( {30,30,1200,600});
//thePlot.Grid( true );
// resize plot when form resizes
fm.events().resize([&](int w, int h )
{
thePlot.move( {30,30,w,h} );
thePlot.update();
});
// construct plot traces
wex::plot::trace& t1 = thePlot.AddStaticTrace();
wex::plot::trace& t2 = thePlot.AddStaticTrace();
// provide some data for first trace
std::vector< double > d1 { 10, 15, 20, 25, 30, 25, 20, 15, 10 };
t1.set( d1 );
// plot in blue
t1.color( 0x0000FF );
// provide data for second trace
std::vector< double > d2 { 20, 30, 40, 50, 60, 50, 40, 30, 20 };
t2.set( d2 );
// plot in red
t2.color( 0xFF0000 );
// show and run
fm.show();
fm.run();
}