wxFreeChart
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AxisPlot Class Referenceabstract

Base class for plots that supports axes. More...

#include <axisplot.h>

Inheritance diagram for AxisPlot:
Inheritance graph
[legend]
Collaboration diagram for AxisPlot:
Collaboration graph
[legend]

Public Member Functions

void AddAxis (Axis *axis)
 Adds axis to plot. More...
 
void AddDataset (Dataset *dataset)
 Adds dataset to plot. More...
 
void RemoveDataset (Dataset *dataset)
 Removes dataset from plot. More...
 
void RemoveDataset (size_t index)
 Removes dataset from plot. More...
 
void AddObjects (Dataset *dataset, Axis *verticalAxis, Axis *horizontalAxis)
 Adds dataset and vertical and horizontal axes to plot. More...
 
size_t GetDatasetCount ()
 Returns dataset count. More...
 
DatasetGetDataset (size_t index)
 Return dataset with index. More...
 
void LinkDataHorizontalAxis (size_t nData, size_t nAxis)
 Links dataset with horizontal axis. More...
 
void LinkDataVerticalAxis (size_t nData, size_t nAxis)
 Links dataset with vertical axis. More...
 
AxisGetDatasetAxis (Dataset *dataset, size_t index, bool vertical)
 Returns dataset axis. More...
 
AxisGetDatasetAxis (Dataset *dataset, bool vertical)
 Returns main dataset axis. More...
 
AxisGetDatasetVerticalAxis (Dataset *dataset)
 Returns main vertical dataset axis. More...
 
AxisGetDatasetHorizontalAxis (Dataset *dataset)
 Returns main horizontal dataset axis. More...
 
DatasetGetAxisDataset (Axis *axis, size_t index)
 Returns dataset, linked with axis at specified index. More...
 
void SetDrawGrid (bool drawGridVertical, bool drawGridHorizontal)
 Set whether to draw grid lines. More...
 
 wxDEPRECATED_MSG ("SetDataBackground is deprecated, use SetBackground instead") void SetDataBackground(AreaDraw *dataBackground)
 Sets background for data area. More...
 
void SetLegend (Legend *legend)
 Sets legend to plot. More...
 
void SetCrosshair (Crosshair *crosshair)
 Attaches crosshair to this plot. More...
 
bool ToDataCoords (size_t nData, wxDC &dc, wxRect rc, wxCoord gx, wxCoord gy, double *x, double *y)
 Translate coordinate from graphics to data space. More...
 
virtual void NeedRedraw (DrawObject *obj)
 
virtual void DataChanged (wxCommandEvent &event)
 
virtual void DatasetChanged (Dataset *dataset)
 
virtual void AxisChanged (Axis *axis)
 
virtual void BoundsChanged (Axis *axis)
 
virtual void ChartMouseDown (wxPoint &pt, int key)
 
- Public Member Functions inherited from Plot
virtual void Draw (ChartDC &cdc, wxRect rc, PlotDrawMode mode=PLOT_DRAW_ALL)
 Draws plot. More...
 
virtual void DrawNoDataMessage (wxDC &dc, wxRect rc)
 Draws "no data" message. More...
 
void SetChartPanel (wxChartPanel *chartPanel)
 
wxChartPanelGetChartPanel ()
 Returns chart panel (GUI component, at top level) if it.
 
void SetBackground (AreaDraw *background)
 Sets plot background. More...
 
void SetTextNoData (const wxString &textNoData)
 Sets text message drawn, when plot has no data to draw. More...
 

Protected Member Functions

virtual bool AcceptAxis (Axis *axis)=0
 Checks whether axis is acceptable with this plot. More...
 
virtual bool AcceptDataset (Dataset *dataset)=0
 Checks whether dataset is acceptable with this plot. More...
 
virtual void DrawDatasets (wxDC &dc, wxRect rc)=0
 Called to draw all datasets. More...
 
wxCoord GetAxesExtent (wxDC &dc, AxisArray *axes)
 

Protected Attributes

bool m_drawGridVertical
 
bool m_drawGridHorizontal
 
- Protected Attributes inherited from Plot
AreaDrawm_background
 

Detailed Description

Base class for plots that supports axes.

Definition at line 56 of file axisplot.h.

Member Function Documentation

virtual bool AxisPlot::AcceptAxis ( Axis axis)
protectedpure virtual

Checks whether axis is acceptable with this plot.

Parameters
axisaxis to be checked
Returns
true if axis can be accepted, false overwise

Implemented in XYPlot, OHLCPlot, BarPlot, GanttPlot, and BubblePlot.

virtual bool AxisPlot::AcceptDataset ( Dataset dataset)
protectedpure virtual

Checks whether dataset is acceptable with this plot.

Parameters
datasetdataset to be checked
Returns
true if dataset can be accepted, false overwise

Implemented in XYPlot, OHLCPlot, BarPlot, GanttPlot, and BubblePlot.

void AxisPlot::AddAxis ( Axis axis)

Adds axis to plot.

Parameters
axisaxis to be added
void AxisPlot::AddDataset ( Dataset dataset)

Adds dataset to plot.

Parameters
datasetdataset to be added
void AxisPlot::AddObjects ( Dataset dataset,
Axis verticalAxis,
Axis horizontalAxis 
)

Adds dataset and vertical and horizontal axes to plot.

And links it all together.

Parameters
datasetdataset to be added
verticalAxisvertical axis to be added
horizontalAxishorizontal axis to be added
virtual void AxisPlot::DrawDatasets ( wxDC &  dc,
wxRect  rc 
)
protectedpure virtual

Called to draw all datasets.

Parameters
dcdevice context
rcrectangle where to draw

Implemented in XYPlot, OHLCPlot, BarPlot, GanttPlot, and BubblePlot.

Dataset* AxisPlot::GetAxisDataset ( Axis axis,
size_t  index 
)
inline

Returns dataset, linked with axis at specified index.

Parameters
axisaxis
indexdataset index
Returns
dataset at index

Definition at line 172 of file axisplot.h.

References Plot::ChartPanelChanged(), Plot::DrawBackground(), Plot::DrawData(), Axis::GetDataset(), and Plot::HasData().

Dataset* AxisPlot::GetDataset ( size_t  index)

Return dataset with index.

Parameters
indexindex of dataset
Returns
dataset or NULL if index is out of bounds
Axis* AxisPlot::GetDatasetAxis ( Dataset dataset,
size_t  index,
bool  vertical 
)

Returns dataset axis.

Parameters
datasetdataset
indexaxis index, 0 - for main axis
verticaltrue if you want to get vertical axis, false - horizontal
Returns
main axis for dataset or NULL if dataset has no main axis
Axis* AxisPlot::GetDatasetAxis ( Dataset dataset,
bool  vertical 
)

Returns main dataset axis.

NOTE: main axis is the first axis linked with dataset. Main axis is used to scale dataset values.

Parameters
datasetdataset
verticaltrue if you want to get vertical axis, false - horizontal
Returns
main axis for dataset or NULL if dataset has no main axis
size_t AxisPlot::GetDatasetCount ( )

Returns dataset count.

Returns
dataset count
Axis* AxisPlot::GetDatasetHorizontalAxis ( Dataset dataset)
inline

Returns main horizontal dataset axis.

NOTE: main axis is the first axis linked with dataset. Main axis is used to scale dataset values.

Parameters
datasetdataset
Returns
main axis for dataset or NULL if dataset has no main axis

Definition at line 161 of file axisplot.h.

Axis* AxisPlot::GetDatasetVerticalAxis ( Dataset dataset)
inline

Returns main vertical dataset axis.

NOTE: main axis is the first axis linked with dataset. Main axis is used to scale dataset values.

Parameters
datasetdataset
Returns
main axis for dataset or NULL if dataset has no main axis

Definition at line 149 of file axisplot.h.

void AxisPlot::LinkDataHorizontalAxis ( size_t  nData,
size_t  nAxis 
)

Links dataset with horizontal axis.

Parameters
nDataindex of dataset
nAxisindex of horizontal axis
void AxisPlot::LinkDataVerticalAxis ( size_t  nData,
size_t  nAxis 
)

Links dataset with vertical axis.

Parameters
nDataindex of dataset
nAxisindex of vertical axis
void AxisPlot::RemoveDataset ( Dataset dataset)

Removes dataset from plot.

Parameters
datasetdataset to be removed
void AxisPlot::RemoveDataset ( size_t  index)

Removes dataset from plot.

Parameters
datasetdataset index to be removed
void AxisPlot::SetCrosshair ( Crosshair crosshair)

Attaches crosshair to this plot.

Parameters
crosshaircrosshair
void AxisPlot::SetDrawGrid ( bool  drawGridVertical,
bool  drawGridHorizontal 
)

Set whether to draw grid lines.

Parameters
drawGridVerticalif true - plot will draw vertical grid lines
drawGridHorizontalif true - plot will draw horizontal grid lines
void AxisPlot::SetLegend ( Legend legend)

Sets legend to plot.

Plot take ownership of legend.

Parameters
legendnew legend for plot
bool AxisPlot::ToDataCoords ( size_t  nData,
wxDC &  dc,
wxRect  rc,
wxCoord  gx,
wxCoord  gy,
double *  x,
double *  y 
)

Translate coordinate from graphics to data space.

Parameters
nDatanumber of dataset
dcdevice context
rcplot rectangle
gxx coordinate in graphics space
gyy coordinate in graphics space
xoutput for x coordinate in data space
youtput for y coordinate in data space
Returns
true if coordinate was succesfully translated, false - overwise
AxisPlot::wxDEPRECATED_MSG ( "SetDataBackground is  deprecated,
use SetBackground instead"   
)

Sets background for data area.

This function is deprecated, use SetPlotAreaBackground instead.

Parameters
dataBackgroundbackground for data area

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