Reference documentation
Public Member Functions | Protected Member Functions | List of all members
PieChart Class Reference

The Thistle::PieChart class provides a default implementation for piecharts. More...

Inheritance diagram for PieChart:
AbstractChart AbstractItemView PieChart3D

Public Member Functions

 PieChart (QWidget *parent=0)
 Constructs a PieChart view with the given parent.
 
virtual void defineRects ()
 This pure virtual function defines the QRect used to to draw the different elements composing the view (series, legend, title, etc.).
 
- Public Member Functions inherited from AbstractChart
 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

virtual QPainterPath itemPath (const QModelIndex &index) const
 Returns the QPainterPath defining the item's shape.
 
virtual void paintChart (QPainter &painter)
 Paints the different parts (legend, axis, values, title, etc.) of the chart. More...
 
void scan ()
 Scans values in the model to find the minimum and the maximum. More...
 
virtual void updateRects ()
 Updates the regions used to paint each part of the chart (legend, axis, values, title, etc.). More...
 
- Protected Member Functions inherited from AbstractChart
void calculateLegendRect (const QRect &source)
 Calculates the rectangle in which the legend should be drawn.
 
virtual void process ()
 Analyzes the model to define the bounds and axis values. More...
 

Additional Inherited Members

- Public Slots inherited from AbstractChart
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...
 

Detailed Description

The Thistle::PieChart class provides a default implementation for piecharts.

The Thistle::PieChart class considers that each cell int he first column from the model is a serie of values. It represents a serie with a slice in a disk. The vertical headers defines the name of data.

Member Function Documentation

void paintChart ( QPainter &  painter)
protectedvirtual

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

This function is called when the viewport is updated.

Implements AbstractChart.

Reimplemented in PieChart3D.

void scan ( )
protectedvirtual

Scans values in the model to find the minimum and the maximum.

Returns the width needed to display the Y scale. If the values are greater than zero, the minimum is equal to 0. If the values are less than 0, the maximum is equal to 0. If a value is not a number (undefined, a string, etc.), she's considered as equal to 0.

Implements AbstractChart.

virtual void updateRects ( )
protectedvirtual

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.

Implements AbstractChart.