Fl_PlotXY V1.0.13
Copyright 2004-2005 Michael Pearce
Document Started: 7 July 2004
Last Updated: 18 April 2005
class Fl_PlotXY
Class Hierarchy
Fl_Widget
|
+----Fl_PlotXY
Include Files
#include <Fl_PlotXY.H>
Description
This widget draws a box and then lets you add up to 10 seperate lines of X,Y plot data.
Features Include:
Multiplule Lines (Max 10 Lines - set by a #define)
Dot or solid line display
Each line scale and colour selectable
Load of CSV format file
Save line as CSV format file
Editing of stored data
Auto scaling
Manual scaling (used to zoom etc)
Methods
The constructor creates the plotting area using the position, size, and label.
The destructor removes the plotting area.
Adds new X,Y data to end of selected line.
The first method reads the current axis value font face.
The second method sets the axis value font face.
FLTK values such as FL_HELVETICA, FL_COURIER can be used.
The first form returns the font size in points.
The second form sets the axis value font size.
The first form reads the height in pixels used for the X axis value text.
The second form sets the height in pixels to use for the X axis value text.
The first form reads the width in pixels used for the Y axis value text.
The second form sets the width in pixels to use for the Y axis value text.
Changes a point's values on the specified line.
Returns 1 on success, 0 on error
Clears the data set in line.
Clears data on ALL lines
returns the current size of data in the selected line
Sets the line drawing mode.
Valid modes are:
FL_PLOTXY_LINE - Draw using solid lines
FL_PLOTXY_DOT - Draw using single pixel points
Returns 1 on sucess, 0 on error.
Gets the current range of data displayed.
If FL_PLOTXY_AUTO mode used then is the values returned by the autoscaler.
If FL_PLOTXY_FIXED mode is used then returns the stored values.
Returns 1 on sucess, 0 in error and range values in X1,Y1,X2,Y2
The first form returns the current colour for the selected line.
The second form sets the line colour to use.
Returns 1 on sucess, 0 on error.
Sets selected line so data is not displayed.
Returns 1 if done , 0 if error.
Sets selected line to display data.
Returns 1 if done , 0 if error.
The first form sets the title for seelcted line. Returns 1 if done , 0 if error.
The second form returns the pointer to the title, or NULL in error.
Checks if line is currently displayed.
Returns 1 if visable, 0 if not, and -1 in error.
Loads CSV formated data from FileName into a new line.
Not very smart at the moment - data needs to have no white spaces!
Any non numerical characters are treated as text and that line will be skipped.
Returns Line Descriptor on success, -1 on error
Loads CSV formated data from FileName to the graph.
First line in the file is comma seperated line titles. first column is not read.
Second line is Axis labels for Data. First column is X axis title, remaining columns are Y axis labels.
First Column is the X Data for all lines, the following columns are lines data.
Removes all lines on graph then reads csv file in form X,Y1,Y2....Yn
First line of csv file is treated as axis labels for the data.
Any non numerical characters are treated as text and that line will be skipped.
Returns 1 on success, 0 on error
The first form creates a new line with default settings range=0,0,0,0 mode=FL_POTXY_AUTO Color=FL_BLACK label="".
The second form creates a new line with custom settings.
X1,Y1,X2,Y2 define the displayed data range.
mode selects Fixed or auto scaling of data using FL_PLOTXY_AUTO or FL_PLOTXY_FIXED.
C selects the colour to use for the data line
label selects the label to use for the line and CSV output (NOT IMPLIMENTED YET)
Both forms return the Line Descriptor to use or -1 if an error occurs.
Reads X,Y from specified point on specified line.
Returns 1 on sucess, 0 on error and values in X and Y
Removes a line - frees it up for use.
Removes all lines - frees all lines for use.
Saves selected line data as CSV format to FileName
Returns 1 on success, 0 on error
Saves all data as CSV format X,Y1,Y2...Yn to FileName
Returns 1 on success, 0 on error
Sets the scaling mode for selected line.
Valid modes are:
FL_PLOTXY_AUTO - Auto scales the data using Min and Max values in data set.
FL_PLOTXY_FIXED - Scales data according to range stored in line settings.
Returns 1 on success, 0 on error.
Set the range of data to display. Can be used to "Zoom" an area of the data.
Returns 1 on success, 0 on error.
Note: Not active unless scalemode(line,FL_PLOTXY_FIXED) is set.
Indicates if line is in use.
Returns 1 if currently used, 0 if not in use
Returns pointer to widget version string in format "Vx.x.x"
The first form enables (1) or disables (0) the vertical line.
The second form returns 0 if disabled and 1 if enabled.
The first form selects the graph line to display data value on.
The second form returns the line that data is being displayed on.
The first form sets the position in the data array to display data.
The second form returns the position that is being displayed.
The first form sets the X Axis Label for line.
The second form returns the X Axis Label.
The first form returns the state of the line markings.
The second form sets the state of the markings using the following mode values:
FL_PLOTXY_MARK_OFF - Turns Graduations etc OFF
FL_PLOTXY_MARK_ON - Show Y Graduations
FL_PLOTXY_MARK_LABEL - Show Axis Label
FL_PLOTXY_MARK_VAL - Show Axis Values
FL_PLOTXY_MARK_NAME - Show Lines NAME
Note: These can be OR'ed together.
Sets the size between indicator marks.
Sets the format of the X axis number values. Equivalent to "%0whole.0pointslf".
'whole' sets the number of whole numbers to display, including leading zeros.
'points' sets the number of decimal places to show, including following zeros.
'whole' and 'points' must be in the range 0 to 9.
The first form sets the type of data to be displayed.
The second form returns the type of data displayed.
Options are:
FL_PLOTXY_VAL_NUMBER - Displays Number using %0.03lf format Number */
FL_PLOTXY_VAL_TIMES - Displays time in format SS
FL_PLOTXY_VAL_TIMEMS - Displays time in format MM:SS
FL_PLOTXY_VAL_TIMEHMS - Displays time in format HH:MM:SS
FL_PLOTXY_VAL_TIMEHM - Displays time in format HH:MM
FL_PLOTXY_VAL_TIMEh - Displays time in format hh
FL_PLOTXY_VAL_TIMESh - Displays time in format SS.hh
FL_PLOTXY_VAL_TIMEMSh - Displays time in format MM:SS.hh
FL_PLOTXY_VAL_TIMEHMSh - Displays time in format HH:MM:SS.hh
Note: Time formats require data to be in Seconds i.e. 1 minute = 60, 1 hour = 3600.
The first form sets the Y Axis Label for line.
The second form returns the Y Axis Label - or NULL.
The first form returns the state of the line markings.
The second form sets the state of the markings using the following mode values:
FL_PLOTXY_MARK_OFF - Turns Graduations etc OFF
FL_PLOTXY_MARK_ON - Show Y Graduations
FL_PLOTXY_MARK_LABEL - Show Axis Label
FL_PLOTXY_MARK_VAL - Show Axis Values
FL_PLOTXY_MARK_NAME - Show Lines NAME
Note: These can be OR'ed together.
Sets the size between indicator marks.
Sets the format of the Y axis number values. Equivalent to "%0whole.0pointslf".
'whole' sets the number of whole numbers to display, including leading zeros.
'points' sets the number of decimal places to show, including following zeros.
'whole' and 'points' must be in the range 0 to 9.
The first form sets the type of data to be displayed.
The second form returns the type of data displayed.
Options are:
FL_PLOTXY_VAL_NUMBER - Displays Number using %0.03lf format Number */
FL_PLOTXY_VAL_TIMES - Displays time in format SS
FL_PLOTXY_VAL_TIMEMS - Displays time in format MM:SS
FL_PLOTXY_VAL_TIMEHMS - Displays time in format HH:MM:SS
FL_PLOTXY_VAL_TIMEHM - Displays time in format HH:MM
FL_PLOTXY_VAL_TIMEh - Displays time in format hh
FL_PLOTXY_VAL_TIMESh - Displays time in format SS.hh
FL_PLOTXY_VAL_TIMEMSh - Displays time in format MM:SS.hh
FL_PLOTXY_VAL_TIMEHMSh - Displays time in format HH:MM:SS.hh
Note: Time formats require data to be in Seconds.
e.g 2 Hours 4 minutes and 24 seconds = 2 x 3600 + 4 x 60 + 24 = 7464 seconds
Future plans
Following are possible future additions - ideas and comments welcome.
Add line labels.
Add axis grids / cross hairs.
Improve loading and saving to handle things such as date, time etc and to be less fussy.
Known Problems
Following are the known problems - please report any others you may find
File loading is very fussy - no white spaces allowed - will be working on this.
Crash can occur if try to display non existant data - need to add some more error traping.
All content Copyright 2004 Michael Pearce All Rights Reserved.
Email: mike AT kiwacan DOT co DOT nz
Web: http://www.kiwacan.co.nz/fltk/fltk.html