#include <KDChartPainter.h>
|
| | KDChartPainter (KDChartParams *) |
| virtual void | paintArea (TQPainter *painter, uint area, KDChartDataRegionList *regions=0, uint dataRow=0, uint dataCol=0, uint data3rd=0) |
| virtual void | paintDataRegionAreas (TQPainter *painter, KDChartDataRegionList *regions) |
| virtual void | paintAreaWithGap (TQPainter *painter, TQRect rect, const KDChartParams::KDChartFrameSettings &settings) |
| virtual void | paintCustomBoxes (TQPainter *painter, KDChartDataRegionList *regions) |
| virtual void | paintData (TQPainter *painter, KDChartTableDataBase *data, bool paint2nd, KDChartDataRegionList *regions=0)=0 |
| virtual void | paintDataValues (TQPainter *painter, KDChartTableDataBase *data, KDChartDataRegionList *regions) |
| virtual void | paintAxes (TQPainter *painter, KDChartTableDataBase *data) |
| virtual void | paintLegend (TQPainter *painter, KDChartTableDataBase *data) |
| virtual void | paintHeaderFooter (TQPainter *painter, KDChartTableDataBase *data) |
| virtual bool | axesOverlapping (int axis1, int axis2) |
| virtual void | findChartDatasets (KDChartTableDataBase *data, bool paint2nd, uint chart, uint &chartDatasetStart, uint &chartDatasetEnd) |
| virtual void | calculateAllAxesRects (TQPainter *painter, bool finalPrecision, KDChartTableDataBase *data) |
| virtual TQPoint | calculateAnchor (const KDChartCustomBox &box, KDChartDataRegionList *regions=0) const |
| virtual TQRect | calculateAreaRect (bool &allCustomBoxes, uint area, uint dataRow, uint dataCol, uint data3rd, KDChartDataRegionList *regions) const |
| virtual TQString | fallbackLegendText (uint dataset) const |
| virtual uint | numLegendFallbackTexts (KDChartTableDataBase *data) const |
| const KDChartParams * | params () const |
| virtual bool | calculateAllAxesLabelTextsAndCalcValues (TQPainter *painter, KDChartTableDataBase *data, double areaWidthP1000, double areaHeightP1000, double &delimLen) |
| virtual void | drawExtraLinesAndMarkers (KDChartPropertySet &propSet, const TQPen &defaultPen, const KDChartParams::LineMarkerStyle &defaultMarkerStyle, int myPointX, int myPointY, TQPainter *painter, const KDChartAxisParams *abscissaPara, const KDChartAxisParams *ordinatePara, const double areaWidthP1000, const double areaHeightP1000, bool bDrawInFront=false) |
|
| static TQPoint | pointOnCircle (const TQRect &rect, double angle) |
| static void | makeArc (TQPointArray &points, const TQRect &rect, double startAngle, double angles) |
| static KDChartDataRegion * | drawMarker (TQPainter *painter, const KDChartParams *params, double areaWidthP1000, double areaHeightP1000, int deltaX, int deltaY, int style, const TQColor &color, const TQPoint &p, uint dataset, uint value, uint chart, KDChartDataRegionList *regions=0, int *width=0, int *height=0, uint align=TQt::AlignCenter) |
An abstract base class that defines an interface for classes that implement chart drawing.
Applications don't use this class directly (except for registering/unregistering, see below) new chart implementations, but instead use the method KDChart::paint() which takes care of the correct creation and deletion of the painter implementation used. Or they use KDChartWidget which handles everything automatically.
This class cannot be instantiated directly. Even the concrete subclasses are not instantiated directly, but are instantiated via KDChartPainter::create() which creates a subclass according to the parameters passed.
Application developers can provide their own chart implementations by subclassing from KDChartPainter, instantiating their subclass and registering their implementation with KDChartPainter::registerPainter(). These registrations can be removed with KDChartPainter::unregisterPainter().
Definition at line 87 of file KDChartPainter.h.
◆ ~KDChartPainter()
| KDChartPainter::~KDChartPainter |
( |
| ) |
|
|
virtual |
Destructor.
Cleans up any data structures that might have been allocated in the meantime.
Definition at line 113 of file KDChartPainter.cpp.
◆ KDChartPainter()
Constructor.
Will only be called by subclass constructors since this class can never be instantiated directly.
- Parameters
-
| params | the parameters of the chart to be drawn |
Definition at line 96 of file KDChartPainter.cpp.
◆ axesOverlapping()
| bool KDChartPainter::axesOverlapping |
( |
int | axis1, |
|
|
int | axis2 ) |
|
protectedvirtual |
◆ calculateAllAxesLabelTextsAndCalcValues()
| bool KDChartPainter::calculateAllAxesLabelTextsAndCalcValues |
( |
TQPainter * | painter, |
|
|
KDChartTableDataBase * | data, |
|
|
double | areaWidthP1000, |
|
|
double | areaHeightP1000, |
|
|
double & | delimLen ) |
|
protectedvirtual |
◆ calculateAllAxesRects()
| void KDChartPainter::calculateAllAxesRects |
( |
TQPainter * | painter, |
|
|
bool | finalPrecision, |
|
|
KDChartTableDataBase * | data ) |
|
protectedvirtual |
◆ calculateAnchor()
◆ calculateAreaRect()
| TQRect KDChartPainter::calculateAreaRect |
( |
bool & | allCustomBoxes, |
|
|
uint | area, |
|
|
uint | dataRow, |
|
|
uint | dataCol, |
|
|
uint | data3rd, |
|
|
KDChartDataRegionList * | regions ) const |
|
protectedvirtual |
◆ create()
Creates an object of a concrete subclass of KDChartPainter that KDChart::paint() (and consequently, the application) can use to have charts painted.
The subclass is determined on the base of the params parameter which among other things indicates the type of the chart.
- Parameters
-
| params | the parameter set which is used to determine the painter implementation to be used |
- Returns
- a pointer to an object of a subclass of KDChartPainter that can be used to draw charts as defined by the params parameter. Returns 0 if there is no registered KDChartPainter subclass for the type specified in params. This can only happen with user-defined chart types.
Definition at line 145 of file KDChartPainter.cpp.
◆ drawExtraLinesAndMarkers()
| void KDChartPainter::drawExtraLinesAndMarkers |
( |
KDChartPropertySet & | propSet, |
|
|
const TQPen & | defaultPen, |
|
|
const KDChartParams::LineMarkerStyle & | defaultMarkerStyle, |
|
|
int | myPointX, |
|
|
int | myPointY, |
|
|
TQPainter * | painter, |
|
|
const KDChartAxisParams * | abscissaPara, |
|
|
const KDChartAxisParams * | ordinatePara, |
|
|
const double | areaWidthP1000, |
|
|
const double | areaHeightP1000, |
|
|
bool | bDrawInFront = false ) |
|
protectedvirtual |
◆ drawMarker() [1/2]
| KDChartDataRegion * KDChartPainter::drawMarker |
( |
TQPainter * | painter, |
|
|
const KDChartParams * | params, |
|
|
double | areaWidthP1000, |
|
|
double | areaHeightP1000, |
|
|
int | deltaX, |
|
|
int | deltaY, |
|
|
int | style, |
|
|
const TQColor & | color, |
|
|
const TQPoint & | _p, |
|
|
uint | dataset, |
|
|
uint | value, |
|
|
uint | chart, |
|
|
KDChartDataRegionList * | regions = 0, |
|
|
int * | width = 0, |
|
|
int * | height = 0, |
|
|
uint | align = TQt::AlignCenter ) |
|
staticprotected |
Draws the marker for one data point according to the specified style.
- Parameters
-
| painter | the painter to draw on |
| style | what kind of marker is drawn (square, diamond, circle, ...) |
| color | the color in which to draw the marker |
| p | the center of the marker |
| dataset | the dataset which this marker represents |
| value | the value which this marker represents |
| regions | a list of regions for data points, a new region for the new marker will be appended to this list if it is not 0 |
- Returns
- pointer to the KDChartDataRegion that was appended to the regions list, or zero if if parameter regions was zero
Definition at line 2612 of file KDChartPainter.cpp.
◆ drawMarker() [2/2]
| void KDChartPainter::drawMarker |
( |
TQPainter * | painter, |
|
|
int | style, |
|
|
const TQColor & | color, |
|
|
const TQPoint & | p, |
|
|
const TQSize & | size, |
|
|
uint | align = TQt::AlignCenter ) |
|
static |
Draws the marker for one data point according to the specified style, color, size.
- Parameters
-
| painter | the painter to draw on |
| style | what kind of marker is drawn (square, diamond, circle, ...) |
| color | the color in which to draw the marker |
| p | the center of the marker |
| size | the width and height of the marker: both values must be positive. |
Definition at line 2573 of file KDChartPainter.cpp.
◆ fallbackLegendText()
| TQString KDChartPainter::fallbackLegendText |
( |
uint | dataset | ) |
const |
|
protectedvirtual |
This method provides a fallback legend text for the specified dataset, if there was no other way to determine a legend text, but a legend should be shown nevertheless.
The default is to return "Series" plus a dataset number (with datasets starting at 1 for this purpose; inherited painter implementations can override this.
This method is only used when automatic legends are used, because manual and first-column legends do not need fallback texts.
- Parameters
-
| uint | dataset the dataset number for which to generate a fallback text |
- Returns
- the fallback text to use for describing the specified dataset in the legend
Reimplemented in KDChartBWPainter, KDChartHiLoPainter, KDChartPiePainter, KDChartPolarPainter, and KDChartRingPainter.
Definition at line 2540 of file KDChartPainter.cpp.
◆ findChartDatasets()
| void KDChartPainter::findChartDatasets |
( |
KDChartTableDataBase * | data, |
|
|
bool | paint2nd, |
|
|
uint | chart, |
|
|
uint & | chartDatasetStart, |
|
|
uint & | chartDatasetEnd ) |
|
protectedvirtual |
◆ makeArc()
| void KDChartPainter::makeArc |
( |
TQPointArray & | points, |
|
|
const TQRect & | rect, |
|
|
double | startAngle, |
|
|
double | angles ) |
|
staticprotected |
◆ numLegendFallbackTexts()
This methods returns the number of elements to be shown in the legend in case fallback texts are used.
By default, this will be the number of datasets, but specialized painters can override this (e.g., painters that draw charts that can only display one dataset will return the number of values instead).
This method is only used when automatic legends are used, because manual and first-column legends do not need fallback texts.
- Returns
- the number of fallback texts to use
Reimplemented in KDChartBWPainter, KDChartHiLoPainter, KDChartPiePainter, KDChartPolarPainter, and KDChartRingPainter.
Definition at line 2558 of file KDChartPainter.cpp.
◆ outermostRect()
| virtual TQRect KDChartPainter::outermostRect |
( |
| ) |
const |
|
inlinevirtual |
◆ paint()
| void KDChartPainter::paint |
( |
TQPainter * | painter, |
|
|
KDChartTableDataBase * | data, |
|
|
bool | paintFirst, |
|
|
bool | paintLast, |
|
|
KDChartDataRegionList * | regions = 0, |
|
|
const TQRect * | rect = 0, |
|
|
bool | mustCalculateGeometry = true ) |
|
virtual |
Paints the chart for which this chart painter is configured on a TQPainter.
This is the method that bundles all the painting functions that paint specific parts of the chart like axes or legends. Subclasses can override this method, but should rarely need to do so.
- Parameters
-
| painter | the TQPainter onto which the chart should be drawn |
| data | the data which will be displayed as a chart |
| regions | a pointer to a region list that will be filled with regions representing the data segments if not null |
Definition at line 227 of file KDChartPainter.cpp.
◆ paintArea()
| void KDChartPainter::paintArea |
( |
TQPainter * | painter, |
|
|
uint | area, |
|
|
KDChartDataRegionList * | regions = 0, |
|
|
uint | dataRow = 0, |
|
|
uint | dataCol = 0, |
|
|
uint | data3rd = 0 ) |
|
protectedvirtual |
◆ paintAreaWithGap()
◆ paintAxes()
Paints the axes for the chart.
The implementation in KDChartPainter does nothing; subclasses for chart types that have axes will provide the appropriate drawing code here. This method serves as a fallback for chart types that do not have axes (like pies).
- Parameters
-
| painter | the TQPainter onto which the chart should be drawn |
| data | the data that will be displayed as a chart |
Reimplemented in KDChartAxesPainter.
Definition at line 1228 of file KDChartPainter.cpp.
◆ paintCustomBoxes()
◆ paintData()
◆ paintDataRegionAreas()
◆ paintDataValues()
Paints the data value texts near the data representations.
Definition at line 424 of file KDChartPainter.cpp.
◆ paintHeaderFooter()
Paints the header and footers for the chart.
The implementation in KDChartPainter draws a standard header that should be suitable for most chart types. Subclasses can provide their own implementations.
- Parameters
-
| painter | the TQPainter onto which the chart should be drawn |
| data | the data that will be displayed as a chart |
Definition at line 1636 of file KDChartPainter.cpp.
◆ paintLegend()
Paints the legend for the chart.
The implementation in KDChartPainter draws a standard legend that should be suitable for most chart types. Subclasses can provide their own implementations.
- Parameters
-
| painter | the TQPainter onto which the chart should be drawn |
| data | the data that will be displayed as a chart |
Definition at line 1374 of file KDChartPainter.cpp.
◆ params()
◆ pointOnCircle()
| TQPoint KDChartPainter::pointOnCircle |
( |
const TQRect & | rect, |
|
|
double | angle ) |
|
staticprotected |
◆ registerPainter()
| void KDChartPainter::registerPainter |
( |
const TQString & | painterName, |
|
|
KDChartPainter * | painter ) |
|
static |
Registers a user-defined painter implementation which is identified by a string.
If there is already a painter implementation registered under that name, the old registration will be deleted.
KDChartPainter does not assume ownership of the registered painter, but you should unregister a painter before deleting an implementation object to avoid that that object is called after its deletion.
- Parameters
-
| painterName | the name under which the painter implementation should be registered. This will be matched against the user-defined chart type name in the KDChartParams structure. |
| painter | an implementation object of a user-defined chart implementation |
Definition at line 191 of file KDChartPainter.cpp.
◆ setupGeometry()
| void KDChartPainter::setupGeometry |
( |
TQPainter * | painter, |
|
|
KDChartTableDataBase * | data, |
|
|
const TQRect & | drawRect ) |
|
virtual |
This method will be called whenever any parameters that affect geometry have been changed.
It will compute the appropriate positions for the various parts of the chart (legend, axes, data area etc.). The implementation in KDChartPainter computes a standard geometry that should be suitable for most chart types. Subclasses can provide their own implementations.
- Parameters
-
| data | the data that will be displayed as a chart |
| drawRect | the position and size of the area where the chart is to be displayed in |
Definition at line 2156 of file KDChartPainter.cpp.
◆ unregisterPainter()
| void KDChartPainter::unregisterPainter |
( |
const TQString & | painterName | ) |
|
|
static |
Unregisters a user-defined painter implementation.
Does not delete the implementation object. If no implementation has been registered under this name, an exception is thrown if KDChart is compiled with exceptions, otherwise nothing happens.
- Parameters
-
| the | name under which the painter implementation is registered |
Definition at line 208 of file KDChartPainter.cpp.
◆ _areaHeightP1000
| double KDChartPainter::_areaHeightP1000 |
|
protected |
◆ _areaWidthP1000
| double KDChartPainter::_areaWidthP1000 |
|
protected |
◆ _axesRect
| TQRect KDChartPainter::_axesRect |
|
protected |
◆ _dataRect
| TQRect KDChartPainter::_dataRect |
|
protected |
◆ _innermostRect
| TQRect KDChartPainter::_innermostRect |
|
protected |
◆ _legendEMSpace
| int KDChartPainter::_legendEMSpace |
|
protected |
◆ _legendHeight
| int KDChartPainter::_legendHeight |
|
protected |
◆ _legendLeading
| int KDChartPainter::_legendLeading |
|
protected |
◆ _legendRect
| TQRect KDChartPainter::_legendRect |
|
protected |
◆ _legendSpacing
| int KDChartPainter::_legendSpacing |
|
protected |
◆ _legendTexts
| TQMap< int, TQString > KDChartPainter::_legendTexts |
|
protected |
◆ _legendTitle
| KDChartTextPiece* KDChartPainter::_legendTitle |
|
protected |
◆ _logicalHeight
| int KDChartPainter::_logicalHeight |
|
protected |
◆ _logicalWidth
| int KDChartPainter::_logicalWidth |
|
protected |
◆ _numLegendTexts
| int KDChartPainter::_numLegendTexts |
|
protected |
◆ _outermostRect
| TQRect KDChartPainter::_outermostRect |
|
protected |
◆ calcVal
The documentation for this class was generated from the following files:
|