kchart
KDChart Class Reference
#include <KDChart.h>
Detailed Description
Provides a single entry-point to the charting engine for applications that wish to provide their own QPainter.
It is not useful to instantiate this class as it contains static methods only.
- Note:
- If for some reason you are NOT using the KDChartWidget class but calling the painting methods of KDChart directly, you probably will also use the KDChartDataRegionList class: This class is derived from QPtrList, so all of the Qt documentation for this class is valid for KDChartDataRegionList too, e.g. freeing of the pointers stored can either be done automatically or manually - so PLEASE take the time to read the reference information for this class!
- See also:
- KDChartWidget, KDChartDataRegionList
Definition at line 55 of file KDChart.h.
Static Public Member Functions | |
static bool | setupGeometry (QPainter *painter, KDChartParams *params, KDChartTableDataBase *data, const QRect &drawRect) |
static bool | painterToDrawRect (QPainter *painter, QRect &drawRect) |
static void | paint (QPainter *, KDChartParams *, KDChartTableDataBase *, KDChartDataRegionList *regions=0, const QRect *rect=0, bool mustCalculateGeometry=true) |
static void | print (QPainter *, KDChartParams *, KDChartTableDataBase *, KDChartDataRegionList *regions=0, const QRect *rect=0, bool mustCalculateGeometry=true) |
Friends | |
void | cleanupPainter () |
Member Function Documentation
bool KDChart::setupGeometry | ( | QPainter * | painter, | |
KDChartParams * | params, | |||
KDChartTableDataBase * | data, | |||
const QRect & | drawRect | |||
) | [static] |
Calculates the axis and data area rects of a chart with the specified parameters on the specified painter.
- Note:
- Call this function if you need to know the positions and sizes of the axis areas and/or the data area *before* drawing the chart. After calling this function you may use KDChartParams::axisArea() and/or KDChartParams::dataArea() to retrieve the desired information.
- Parameters:
-
painter the painter that is eventually to be used for drawing params the parameters defining the chart data the data that should be displayed as a chart drawRect the position and size of the drawing area to be used
Definition at line 156 of file KDChart.cpp.
bool KDChart::painterToDrawRect | ( | QPainter * | painter, | |
QRect & | drawRect | |||
) | [static] |
Calculates the drawing area from a given QPainter.
Use this function to get a QRect that you may pass to KDChart::setupGeometry() if you need to know the positions and sizes of the axis areas and/or the data area *before* drawing the chart. After calling KDChart::setupGeometry() you may use KDChartParams::axisArea() and/or KDChartParams::dataArea() to retrieve the desired information.
- Returns:
- True if the painter was valid and the drawing area could be calculated successfully, else false.
Definition at line 122 of file KDChart.cpp.
void KDChart::paint | ( | QPainter * | painter, | |
KDChartParams * | paraParams, | |||
KDChartTableDataBase * | paraData, | |||
KDChartDataRegionList * | regions = 0 , |
|||
const QRect * | rect = 0 , |
|||
bool | mustCalculateGeometry = true | |||
) | [static] |
Paints a chart with the specified parameters on the specified painter.
- Note:
- If you are passing
regions
pointer, KD Chart will call theclear()
method on it, to delete any regions that might still be registered from previous painting. Make sure to copy any regions information into your own, private data structure, in case you need to keep track of region information, that was valid for such previous times.
- Parameters:
-
painter the QPainter onto which the chart should be painted params the parameters defining the chart data the data that should be displayed as a chart regions if not null, this points to a KDChartDataRegionList that will be filled with the regions of the data segments. This information is needed internally for both recognizing the data segment when reporting mouse clicks and for finding the correct position to draw the respective data value texts. rect the position and size of the drawing area to be used, if this parameter is zero the painter's device metrics will be used. mustCalculateGeometry may be set to false if paint() is called immediately after a previous call of setupGeometry() to save some time in case you have specified a lot of data cells.
Definition at line 256 of file KDChart.cpp.
void KDChart::print | ( | QPainter * | painter, | |
KDChartParams * | params, | |||
KDChartTableDataBase * | data, | |||
KDChartDataRegionList * | regions = 0 , |
|||
const QRect * | rect = 0 , |
|||
bool | mustCalculateGeometry = true | |||
) | [static] |
Paints a chart with the specified parameters on the specified painter which should use a QPrinter as it's output device.
This method is provided for your convenience, it behaves like the paint() method described above but additionally it takes care for the output mode flag: Before painting is started the internal optimizeOutputForScreen flag is set to FALSE and after painting is done it is restored to it's previous value.
- See also:
- paint
Definition at line 354 of file KDChart.cpp.
Friends And Related Function Documentation
void cleanupPainter | ( | ) | [friend] |
A global function that cleans up possible KDChartPainter objects at application shutdown.
The documentation for this class was generated from the following files: