Reference documentation
Public Slots | Public Member Functions | Protected Member Functions | List of all members
AbstractChart Class Referenceabstract

The AbstractChart class provides an abstract base for every chart view. More...

Inheritance diagram for AbstractChart:
AbstractItemView AxisChart PieChart LinearChart RadialChart PieChart3D RadarChart

Public Slots

void updateValues ()
 Updates the displayed data in the viewport. More...
 
- Public Slots inherited from AbstractItemView
virtual void updateValues ()=0
 Updates the items in the item view. More...
 

Public Member Functions

 AbstractChart (QWidget *parent=0)
 Initializes a chart view with the given parent. More...
 
 ~AbstractChart ()
 Destructs the object and clean the internal components.
 
virtual QModelIndex indexAt (const QPoint &point) const
 Returns the model index of the item at the viewport coordinates point.
 
ChartLegendlegend () const
 Returns the current ChartLegend used to paint the chart legend.
 
void setLegend (ChartLegend *legend)
 Sets the legend used to paint the chart legend. More...
 
void setTitle (const QString &title)
 Sets the title displayed at the bottom.
 
void setTitleFont (const QFont &font)
 Sets the QFont used to write the title. More...
 
const QFont & titleFont () const
 Returns the QFont used to write the title. More...
 
- Public Member Functions inherited from AbstractItemView
 AbstractItemView (QWidget *parent=0)
 Constructs an abstract item view with the given parent.
 
virtual QRectF itemRect (const QModelIndex &index) const
 Defines the outer bounds of the item as a rectangle. More...
 
virtual QRectF itemRect (int row, int column, const QModelIndex &parent=QModelIndex()) const
 This function overloads itemRect(). More...
 

Protected Member Functions

void calculateLegendRect (const QRect &source)
 Calculates the rectangle in which the legend should be drawn.
 
virtual void defineRects ()=0
 This pure virtual function defines the QRect used to to draw the different elements composing the view (series, legend, title, etc.).
 
virtual QPainterPath itemPath (const QModelIndex &index) const
 Returns the QPainterPath defining the item's shape.
 
virtual void paintChart (QPainter &painter)=0
 Paints the different parts (legend, axis, values, title, etc.) of the chart. More...
 
virtual void process ()
 Analyzes the model to define the bounds and axis values. More...
 
virtual void updateRects ()=0
 Updates the regions used to paint each part of the chart (legend, axis, values, title, etc.). More...
 

Detailed Description

The AbstractChart class provides an abstract base for every chart view.

The AbstractChart class provides the basic functionality for every chart view. It is a abstract class and cannot be instancied itself. AbstractChart provides a standard interface based on Thistle::AbstractItemView. It reimplements basic logic for calculating and analizing the model data.

See Also
Thistle::AbstractItemView

Constructor & Destructor Documentation

AbstractChart ( QWidget *  parent = 0)

Initializes a chart view with the given parent.

The AbstractChart is an abstract class and cannot be instancied itself.

Member Function Documentation

void paintChart ( QPainter &  painter)
protectedpure virtual

Paints the different parts (legend, axis, values, title, etc.) of the chart.

This function is called when the viewport is updated.

Implemented in LinearChart, PieChart, PieChart3D, AxisChart, and RadialChart.

void process ( )
protectedvirtual

Analyzes the model to define the bounds and axis values.

Calculates the different areas of the chart (title, legend, etc.).

void setLegend ( ChartLegend legend)

Sets the legend used to paint the chart legend.

The previous ChartLegend will be destroyed.

void setTitleFont ( const QFont &  font)

Sets the QFont used to write the title.

See Also
titleFont()
const QFont & titleFont ( ) const

Returns the QFont used to write the title.

See Also
setTitleFont()
void updateRects ( )
protectedpure virtual

Updates the regions used to paint each part of the chart (legend, axis, values, title, etc.).

This function is called whenever the view has been resized.

Implemented in PieChart, LinearChart, RadarChart, and RadialChart.

void updateValues ( )
slot

Updates the displayed data in the viewport.

This method should be called when the widget has been resized or the model data has changed.