A 2-D plotting widget that draws plots. It provides zooming
and auto-scaling capabilites, and can also automatically calculate
appropriate grid line and tick mark spacings. It also provides
two X-Y cursors. They can be locked
to a specified plot.
Note:
Modifying a plot's rendering properties, or other graphing widget properties
may require calling the redraw() method to realize the changes on the
screen.
CursorMoved | An event indicating the movement of a cursor. |
RangeChanged | An event generated when the domain or codomain of the graph change. |
Method Summary: | ||
Graph::Graph | (); | |
PlotId | Graph::plotData | (PlotId id, PointF* points, int count); |
PlotId | Graph::plotData | (PlotId id, double* xvals, double* yvals, int count); |
PlotId | Graph::plotData | (PlotId id, const Vector |
PlotId | Graph::plotData | (PlotId id, const Vector |
Color | Graph::disable | (PlotId id); |
Color | Graph::getPlotColor | (PlotId id); |
void | Graph::setPlotColor | (PlotId id, const Color& pColor); |
int | Graph::getThickness | (PlotId id); |
void | Graph::setThickness | (PlotId id, int pPixels); |
void | Graph::setStyle | (PlotId id, PlotStyle pStyle); |
PlotStyle | Graph::getStyle | (PlotId id); |
bool | Graph::isVisible | (PlotId id); |
void | Graph::setVisible | (PlotId id, bool pShow); |
String | Graph::getFileName | (PlotId id); |
bool | Graph::save | (PlotId id); |
bool | Graph::saveAs | (PlotId id, const String& fn); |
bool | Graph::load | (PlotId id, const String& fn); |
void | Graph::setX | (PlotId id, int i, double x); |
void | Graph::setY | (PlotId id, int i, double y); |
PointF | Graph::get | (PlotId id, int i); |
void | Graph::set | (PlotId id, int i, double x, double y); |
void | Graph::set | (PlotId id, int i, const PointF& p); |
int | Graph::getCount | (PlotId id); |
void | Graph::autoScale | (); |
void | Graph::autoScaleToPlot | (PlotId id, ScalingType (=BOTH) scaling); |
void | Graph::zoomIn | (); |
void | Graph::zoomOut | (); |
bool | Graph::setXRange | (double min, double max); |
bool | Graph::setYRange | (double min, double max); |
void | Graph::setCursorVisible | (CursorId cid, bool v); |
bool | Graph::isCursorVisible | (int c); |
PointF | Graph::getCursorPos | (int c); |
void | Graph::lockCursor | (CursorId id, PlotId id, bool interpolate); |
void | Graph::unlockCursor | (CursorId id); |
double | Graph::getXMin | (); |
double | Graph::getXMax | (); |
double | Graph::getYMin | (); |
double | Graph::getXMax | (); |
void | Graph::setXLabel | (const String& s); |
void | Graph::setYLabel | (const String& s); |
void | Graph::drawTicksAsDottedLines | (bool b); |
void | Graph::setAutoCalculateGrid | (bool b); |
void | Graph::setTicksPerDivX | (int i); |
void | Graph::setTicksPerDivY | (int i); |
void | Graph::setGridSpacingX | (double i); |
void | Graph::setGridSpacingY | (double i); |
Graph::Graph |
Graph::Graph(); Constructs a new graphing widget. |
PlotId Graph::plotData | ||||||||||||
PlotId Graph::plotData(PlotId id, PointF* points, int count); Plots the given data points using the specified styling, and returns the plot identifier. | ||||||||||||
|
PlotId Graph::plotData | |||||||||||||||
PlotId Graph::plotData(PlotId id, double* xvals, double* yvals, int count); Plots the given data points using the specified styling, and returns the plot identifier. | |||||||||||||||
|
PlotId Graph::plotData | |||||||||||||||
PlotId Graph::plotData(PlotId id, const Vector Plots the given data points using the specified styling, and returns the plot identifier. | |||||||||||||||
|
PlotId Graph::plotData | ||||||||||||
PlotId Graph::plotData(PlotId id, const Vector Plots the given data points using the specified styling, and returns the plot identifier. | ||||||||||||
|
Color Graph::disable | ||||||
Color Graph::disable(PlotId id); Disables the specified plot. | ||||||
|
Color Graph::getPlotColor | ||||||
Color Graph::getPlotColor(PlotId id); Returns the rendering color of the plot. | ||||||
|
void Graph::setPlotColor | |||||||||
void Graph::setPlotColor(PlotId id, const Color& pColor); Sets the rendering color of the plot. | |||||||||
|
int Graph::getThickness | ||||||
int Graph::getThickness(PlotId id); Returns the current thickness with which the plot is rendered. | ||||||
|
void Graph::setThickness | |||||||||
void Graph::setThickness(PlotId id, int pPixels); Sets the line thickness of the plot. | |||||||||
|
void Graph::setStyle | |||||||||
void Graph::setStyle(PlotId id, PlotStyle pStyle); Changes the way the plot is rendered. | |||||||||
|
PlotStyle Graph::getStyle | ||||||
PlotStyle Graph::getStyle(PlotId id); Returns the current plot rendering style. | ||||||
|
bool Graph::isVisible | ||||||
bool Graph::isVisible(PlotId id); Returns whether the plot is visible or not. | ||||||
|
void Graph::setVisible | |||||||||
void Graph::setVisible(PlotId id, bool pShow); Changes whether the specified plot is drawn on the graph or not. | |||||||||
|
String Graph::getFileName | ||||||
String Graph::getFileName(PlotId id); Returns the file name of the plot. Returns an empty string if the plot has not been saved. | ||||||
|
bool Graph::save | ||||||
bool Graph::save(PlotId id); Saves the specified plot to the current file name. If the plot has not been saved yet, the saveAs() method must be called first to set the file name. | ||||||
|
bool Graph::saveAs | |||||||||
bool Graph::saveAs(PlotId id, const String& fn); Saves the specified plot to the specified file name, and updates the plot's file name. | |||||||||
|
bool Graph::load | |||||||||
bool Graph::load(PlotId id, const String& fn); Loads plot data from the given file into the specified plot. Upon success it updates the file name. | |||||||||
|
void Graph::setX | ||||||||||||
void Graph::setX(PlotId id, int i, double x); Set the X-coordinate of the i-th point in the specified plot. | ||||||||||||
|
void Graph::setY | ||||||||||||
void Graph::setY(PlotId id, int i, double y); Set the Y-coordinate of the i-th point in the specified plot. | ||||||||||||
|
PointF Graph::get | |||||||||
PointF Graph::get(PlotId id, int i); Returns the i-th point of the specified plot. | |||||||||
|
void Graph::set | |||||||||||||||
void Graph::set(PlotId id, int i, double x, double y); Sets the X and Y coordinates of the i-th point on the specified plot. | |||||||||||||||
|
void Graph::set | ||||||||||||
void Graph::set(PlotId id, int i, const PointF& p); Sets the X and Y coordinates of the i-th point on the specified plot. | ||||||||||||
|
int Graph::getCount | ||||||
int Graph::getCount(PlotId id); Returns the number of points in the specified plot. | ||||||
|
void Graph::autoScale |
void Graph::autoScale(); Automatically computes the X and Y ranges so that all the graphs are visible simultaneously. It may be necessary to call the redraw() method to ensure that the changes are reflected on the screen. |
void Graph::autoScaleToPlot | |||||||||
void Graph::autoScaleToPlot(PlotId id, ScalingType (=BOTH) scaling); Automatically scales the graph to the given plot. The scaling may be along only one axis or both, specified by XAXIS, YAXIS, or BOTH. | |||||||||
|
void Graph::zoomIn |
void Graph::zoomIn(); Zooms in on the graph. |
void Graph::zoomOut |
void Graph::zoomOut(); Zooms out on the graph. |
bool Graph::setXRange | |||||||||
bool Graph::setXRange(double min, double max); Changes the X-axis range to the specifed minimal and maximal values. This method returns false if the range was invalid, but otherwise generates a RangeChanged event and returns true. | |||||||||
|
bool Graph::setYRange | |||||||||
bool Graph::setYRange(double min, double max); Changes the Y-axis range to the specifed minimal and maximal values. This method returns false if the range was invalid, but otherwise generates a RangeChanged event and returns true. | |||||||||
|
void Graph::setCursorVisible | |||||||||
void Graph::setCursorVisible(CursorId cid, bool v); Changes the visiblity of the specified cursor. If the visibility of the cursor changes, a CursorVisibility is generated with the cursor id available from the Event::getId() method. There are four possible cursor ids: X1, Y1, X2, Y2. | |||||||||
|
bool Graph::isCursorVisible | ||||||
bool Graph::isCursorVisible(int c); Returns the visibility state of a cursor. | ||||||
|
PointF Graph::getCursorPos | ||||||
PointF Graph::getCursorPos(int c); Returns the current position of a cursor. | ||||||
|
void Graph::lockCursor | ||||||||||||
void Graph::lockCursor(CursorId id, PlotId id, bool interpolate); Locks the specified cursor to the given plot. | ||||||||||||
|
void Graph::unlockCursor | ||||||
void Graph::unlockCursor(CursorId id); Unlocks the specified cursor from any plot that it may be locked to. | ||||||
|
double Graph::getXMin |
double Graph::getXMin(); Returns the minimum X-value of the x-axis range. |
double Graph::getXMax |
double Graph::getXMax(); Returns the maximum X-value of the x-axis range. |
double Graph::getYMin |
double Graph::getYMin(); Returns the minimum Y-value of the y-axis range. |
double Graph::getXMax |
double Graph::getXMax(); Returns the maximum Y-value of the y-axis range. |
void Graph::setXLabel | ||||||
void Graph::setXLabel(const String& s); Changes the X-axis text label. | ||||||
|
void Graph::setYLabel | ||||||
void Graph::setYLabel(const String& s); Changes the Y-axis text label. | ||||||
|
void Graph::drawTicksAsDottedLines | ||||||
void Graph::drawTicksAsDottedLines(bool b); Changes whether tick marks are draw as full dotted lines or simply ticks along the axes. | ||||||
|
void Graph::setAutoCalculateGrid | ||||||
void Graph::setAutoCalculateGrid(bool b); Sets whether the grid and tick spacing is calculated automatically. | ||||||
|
void Graph::setTicksPerDivX | ||||||
void Graph::setTicksPerDivX(int i); Sets how many tick marks there are between each grid line in the X direction. | ||||||
|
void Graph::setTicksPerDivY | ||||||
void Graph::setTicksPerDivY(int i); Sets how many tick marks there are between each grid line in the Y direction. | ||||||
|
void Graph::setGridSpacingX | ||||||
void Graph::setGridSpacingX(double i); Sets the interval at which grid lines are drawn in the X direction. | ||||||
|
void Graph::setGridSpacingY | ||||||
void Graph::setGridSpacingY(double i); Sets the interval at which grid lines are drawn in the Y direction. | ||||||
|