#include <Wt/Chart/WAbstractChart>
Public Member Functions | |
virtual | ~WAbstractChart () |
Destructor. | |
void | setModel (WAbstractItemModel *model) |
Set the model. | |
WAbstractItemModel * | model () const |
Returns the model. | |
void | setBackground (const WBrush &background) |
Sets a background for the chart. | |
const WBrush & | background () const |
Returns the background of the chart. | |
void | setPalette (WChartPalette *palette) |
Set a palette for the chart. | |
WChartPalette * | palette () const |
Returns the palette for the chart. | |
void | setPlotAreaPadding (int padding, int sides=All) |
Set an internal margin for the main plot area. | |
int | plotAreaPadding (Side side) const |
Returns the internal margin for the main plot area. | |
void | setTitle (const WString &title) |
Set a chart title. | |
const WString & | title () const |
Return the chart title. | |
void | setTitleFont (const WFont &titleFont) |
Set the font for the chart title. | |
const WFont & | titleFont () const |
Returns the font for the chart title. | |
virtual void | paint (WPainter &painter, const WRectF &rectangle=WRectF()) const =0 |
Paint the chart in a rectangle of the given painter. | |
Private Member Functions | |
virtual void | modelChanged () |
Method called whenever the entire model was changed. | |
virtual void | modelColumnsInserted (int start, int end)=0 |
Method called when colums have been inserted in the model. | |
virtual void | modelColumnsRemoved (int start, int end)=0 |
Method called when colums have been removed from the model. | |
virtual void | modelRowsInserted (int start, int end)=0 |
Method called when rows have been inserted from the model. | |
virtual void | modelRowsRemoved (int start, int end)=0 |
Method called when rows have been removed from the model. | |
virtual void | modelDataChanged (const WModelIndex &topLeft, const WModelIndex &bottomRight)=0 |
Method called when data has been changed in the model. |
This is an abstract class and should not be used directly.
As an abstract base for MVC-based charts, this class manages the model and provides virtual methods that listen to model changes. In addition, it gives access to generic chart properties such as the title and title font, the chart palette, chart area padding, and the background fill color.
void Wt::Chart::WAbstractChart::setModel | ( | WAbstractItemModel * | model | ) |
Set the model.
The model is used by the chart to get its data. Ownership of the model is not transferred, and if a previous model was set it is not deleted.
The default model is a 0 model.
WAbstractItemModel* Wt::Chart::WAbstractChart::model | ( | ) | const [inline] |
void Wt::Chart::WAbstractChart::setBackground | ( | const WBrush & | background | ) |
Sets a background for the chart.
Set the background color for the main plot area.
The default is a completely transparent background.
const WBrush& Wt::Chart::WAbstractChart::background | ( | ) | const [inline] |
void Wt::Chart::WAbstractChart::setPalette | ( | WChartPalette * | palette | ) |
Set a palette for the chart.
A palette is used to provide the style information to render the chart series. Ownership of the palette is transferred to the chart.
The default palette is dependent on the chart type.
WChartPalette* Wt::Chart::WAbstractChart::palette | ( | ) | const [inline] |
void Wt::Chart::WAbstractChart::setPlotAreaPadding | ( | int | padding, | |
int | sides = All | |||
) |
Set an internal margin for the main plot area.
This configures the area (in pixels) around the plot area that is available for axes, labels, and titles. You need to set this appropriately so that labels fit inside these margins.
The default is dependent on the chart type.
int Wt::Chart::WAbstractChart::plotAreaPadding | ( | Side | side | ) | const |
void Wt::Chart::WAbstractChart::setTitle | ( | const WString & | title | ) |
Set a chart title.
The title is displayed on top of the chart, using the titleFont().
The default title is an empty title ("").
const WString& Wt::Chart::WAbstractChart::title | ( | ) | const [inline] |
void Wt::Chart::WAbstractChart::setTitleFont | ( | const WFont & | titleFont | ) |
Set the font for the chart title.
Changes the font for the chart title.
The default title font is a 15 point Sans Serif font.
const WFont& Wt::Chart::WAbstractChart::titleFont | ( | ) | const [inline] |
virtual void Wt::Chart::WAbstractChart::paint | ( | WPainter & | painter, | |
const WRectF & | rectangle = WRectF() | |||
) | const [pure virtual] |
Paint the chart in a rectangle of the given painter.
Paints the chart inside the painter, in the area indicated by rectangle. When rectangle is a null rectangle, the entire painter window is used.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.
void Wt::Chart::WAbstractChart::modelChanged | ( | ) | [private, virtual] |
Method called whenever the entire model was changed.
Reimplemented in Wt::Chart::WPieChart.
virtual void Wt::Chart::WAbstractChart::modelColumnsInserted | ( | int | start, | |
int | end | |||
) | [private, pure virtual] |
Method called when colums have been inserted in the model.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.
virtual void Wt::Chart::WAbstractChart::modelColumnsRemoved | ( | int | start, | |
int | end | |||
) | [private, pure virtual] |
Method called when colums have been removed from the model.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.
virtual void Wt::Chart::WAbstractChart::modelRowsInserted | ( | int | start, | |
int | end | |||
) | [private, pure virtual] |
Method called when rows have been inserted from the model.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.
virtual void Wt::Chart::WAbstractChart::modelRowsRemoved | ( | int | start, | |
int | end | |||
) | [private, pure virtual] |
Method called when rows have been removed from the model.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.
virtual void Wt::Chart::WAbstractChart::modelDataChanged | ( | const WModelIndex & | topLeft, | |
const WModelIndex & | bottomRight | |||
) | [private, pure virtual] |
Method called when data has been changed in the model.
Implemented in Wt::Chart::WCartesianChart, and Wt::Chart::WPieChart.