kchart
KDChartWidget Class Reference
#include <KDChartWidget.h>
Detailed Description
The entry point into the charting that most people will want to use.Simply create a KChartWidget in your application and put it where you want in your widget hierarchy and create a KChartParams object that specifies how the chart should be drawn.
- 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:
- KDChart, KDChartDataRegionList
Definition at line 48 of file KDChartWidget.h.
Public Slots | |
bool | isActiveData () const |
bool | isDoubleBuffered () const |
KDChartParams * | params () const |
KDChartTableDataBase * | data () const |
const KDChartDataRegionList * | dataRegions () const |
void | setActiveData (bool active) |
void | setDoubleBuffered (bool doublebuffered) |
void | setParams (KDChartParams *params) |
void | setData (KDChartTableDataBase *data) |
void | paintTo (QPainter &painter, const QRect *rect=0) |
void | print (QPainter &painter, const QRect *rect=0) |
Signals | |
void | dataLeftClicked (uint row, uint col) |
void | dataLeftClicked (const QPoint &pnt) |
void | dataMiddleClicked (uint row, uint col) |
void | dataMiddleClicked (const QPoint &pnt) |
void | dataRightClicked (uint row, uint col) |
void | dataRightClicked (const QPoint &pnt) |
void | dataLeftPressed (uint row, uint col) |
void | dataLeftPressed (const QPoint &pnt) |
void | dataMiddlePressed (uint row, uint col) |
void | dataMiddlePressed (const QPoint &pnt) |
void | dataRightPressed (uint row, uint col) |
void | dataRightPressed (const QPoint &pnt) |
void | dataLeftReleased (uint row, uint col) |
void | dataLeftReleased (const QPoint &pnt) |
void | dataMiddleReleased (uint row, uint col) |
void | dataMiddleReleased (const QPoint &pnt) |
void | dataRightReleased (uint row, uint col) |
void | dataRightReleased (const QPoint &pnt) |
void | barsDisplayed (int barsDisplayed, int barsLeft) |
Public Member Functions | |
KDChartWidget (QWidget *parent=0, const char *name=0) | |
KDChartWidget (KDChartParams *params, KDChartTableDataBase *data, QWidget *parent=0, const char *name=0) | |
~KDChartWidget () | |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | resizeEvent (QResizeEvent *event) |
Properties | |
bool | activeData [] |
bool | doubleBuffered [] |
Constructor & Destructor Documentation
KDChartWidget::KDChartWidget | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 | |||
) |
Default Constructor.
Sets params and data pointers to zero, you should call setParams and setData before using this chart otherwise only a simple default bar chart will be shown.
- Parameters:
-
parent the widget parent; passed on to QWidget name the widget name; passed on to QWidget
Definition at line 72 of file KDChartWidget.cpp.
KDChartWidget::KDChartWidget | ( | KDChartParams * | params, | |
KDChartTableDataBase * | data, | |||
QWidget * | parent = 0 , |
|||
const char * | name = 0 | |||
) |
Constructor.
Stores the chart parameters.
- Parameters:
-
params the specification of the chart data the data to be displayed as a chart parent the widget parent; passed on to QWidget name the widget name; passed on to QWidget
Definition at line 94 of file KDChartWidget.cpp.
KDChartWidget::~KDChartWidget | ( | ) |
Member Function Documentation
void KDChartWidget::barsDisplayed | ( | int | barsDisplayed, | |
int | barsLeft | |||
) | [signal] |
This signal is emitted when drawing of a bar chart is done.
Use it to determine if all bars have been drawn: in case you specified both the bar width and the value block gap width it might be that KD Chart is not able to display all bars since they do not fit into the available horizontal space.
The value of barsLeft indicates how many bars could not be drawn because the data area was not wide enough.
KDChartTableDataBase * KDChartWidget::data | ( | ) | const [slot] |
void KDChartWidget::dataLeftClicked | ( | const QPoint & | pnt | ) | [signal] |
This signal is emitted when a data item was clicked onto with the left mouse button.
The value of pnt indicates the screen coordinates in relation to the origin of the data area.
- Note:
- There is another signal sent simultaneously: reporting which data item was clicked onto.
- See also:
- dataLeftReleased
void KDChartWidget::dataLeftClicked | ( | uint | row, | |
uint | col | |||
) | [signal] |
This signal is emitted when a data item was clicked onto with the left mouse button.
The values of row / col indicate the respective dataset (row) and item (col).
- Note:
- There is another signal sent simultaneously: reporting the screen coordinates clicked onto.
- See also:
- dataLeftReleased
void KDChartWidget::dataMiddleClicked | ( | const QPoint & | pnt | ) | [signal] |
This signal is emitted when a data item was clicked onto with the middle mouse button.
The values of row / col indicate the screen coordinates in relation to the origin of the data area.
- Note:
- There is another signal sent simultaneously: reporting which data item was clicked onto.
- See also:
- dataMiddleReleased
void KDChartWidget::dataMiddleClicked | ( | uint | row, | |
uint | col | |||
) | [signal] |
This signal is emitted when a data item was clicked onto with the middle mouse button.
The values of row / col indicate the respective dataset (row) and item (col).
- Note:
- There is another signal sent simultaneously: reporting the screen coordinates clicked onto.
- See also:
- dataMiddleReleased
void KDChartWidget::dataRightClicked | ( | const QPoint & | pnt | ) | [signal] |
This signal is emitted when a data item was clicked onto with the right mouse button.
The values of row / col indicate the screen coordinates in relation to the origin of the data area.
- Note:
- There is another signal sent simultaneously: reporting which data item was clicked onto.
- See also:
- dataRightReleased
void KDChartWidget::dataRightClicked | ( | uint | row, | |
uint | col | |||
) | [signal] |
This signal is emitted when a data item was clicked onto with the right mouse button.
The values of row / col indicate the respective dataset (row) and item (col).
- Note:
- There is another signal sent simultaneously: reporting the screen coordinates clicked onto.
- See also:
- dataRightReleased
bool KDChartWidget::isActiveData | ( | ) | const [slot] |
Returns true if the widget is configured to report mouse events.
The default is not to report mouse events.
- Returns:
- true if the widget is configured to report mouse events, false otherwise
- See also:
- setActiveData()
Definition at line 271 of file KDChartWidget.cpp.
bool KDChartWidget::isDoubleBuffered | ( | ) | const [slot] |
Returns whether the widget uses double-buffering for drawing.
See setDoubleBuffered() for an explanation of double-buffering.
- Returns:
- true if double-buffering is turned on, false otherwise
Definition at line 311 of file KDChartWidget.cpp.
KDChartParams * KDChartWidget::params | ( | ) | const [slot] |
void KDChartWidget::setActiveData | ( | bool | active | ) | [slot] |
If active is true, this widget reports mouse presses, releases and clicks on the data segments it displays.
This can slow down the display process, so this is turned off by default.
If active data reporting is turned on when the widget is already shown, data will be reported after the next repaint(). Call repaint() explicitly if necessary.
Active data is currently supported for bar, pie, and line charts (the latter only with markers, as trying to hit the line would be too difficult for the user anyway).
- Parameters:
-
active if true, the widget reports mouse events
- See also:
- isActiveData()
Definition at line 257 of file KDChartWidget.cpp.
void KDChartWidget::setData | ( | KDChartTableDataBase * | data | ) | [slot] |
void KDChartWidget::setDoubleBuffered | ( | bool | doublebuffered | ) | [slot] |
If doublebuffered is true, the widget will double-buffer everything while drawing which reduces flicker a lot, but requires more memory as an off-screen buffer of the same size as the widget needs to be kept around.
However, in most cases, it is worth spending the extra memory. Double-buffering is on by default. Turning double-buffering on or off does not trigger a repaint.
- Parameters:
-
doublebuffered if true, turns double-buffering on, if false, turns double-buffering off
- See also:
- isDoubleBuffered
Definition at line 290 of file KDChartWidget.cpp.
void KDChartWidget::setParams | ( | KDChartParams * | params | ) | [slot] |
Set an entire new parameter set.
(Normally you might prefer modifying the existing parameters rather than specifying a new set.)
Definition at line 322 of file KDChartWidget.cpp.
The documentation for this class was generated from the following files: