kchart

#include <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 (TQPainter &painter, const TQRect *rect=0)
void print (TQPainter &painter, const TQRect *rect=0)

Signals

void dataLeftClicked (uint row, uint col)
void dataLeftClicked (const TQPoint &pnt)
void dataMiddleClicked (uint row, uint col)
void dataMiddleClicked (const TQPoint &pnt)
void dataRightClicked (uint row, uint col)
void dataRightClicked (const TQPoint &pnt)
void dataLeftPressed (uint row, uint col)
void dataLeftPressed (const TQPoint &pnt)
void dataMiddlePressed (uint row, uint col)
void dataMiddlePressed (const TQPoint &pnt)
void dataRightPressed (uint row, uint col)
void dataRightPressed (const TQPoint &pnt)
void dataLeftReleased (uint row, uint col)
void dataLeftReleased (const TQPoint &pnt)
void dataMiddleReleased (uint row, uint col)
void dataMiddleReleased (const TQPoint &pnt)
void dataRightReleased (uint row, uint col)
void dataRightReleased (const TQPoint &pnt)
void barsDisplayed (int barsDisplayed, int barsLeft)

Public Member Functions

 KDChartWidget (TQWidget *parent=0, const char *name=0)
 KDChartWidget (KDChartParams *params, KDChartTableDataBase *data, TQWidget *parent=0, const char *name=0)
 ~KDChartWidget ()

Protected Member Functions

virtual void paintEvent (TQPaintEvent *event)
virtual void mousePressEvent (TQMouseEvent *event)
virtual void mouseReleaseEvent (TQMouseEvent *event)
virtual void resizeEvent (TQResizeEvent *event)

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 TQPtrList, so all of the TQt 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.

Constructor & Destructor Documentation

◆ KDChartWidget() [1/2]

KDChartWidget::KDChartWidget ( TQWidget * 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
parentthe widget parent; passed on to TQWidget
namethe widget name; passed on to TQWidget

Definition at line 72 of file KDChartWidget.cpp.

◆ KDChartWidget() [2/2]

KDChartWidget::KDChartWidget ( KDChartParams * params,
KDChartTableDataBase * data,
TQWidget * parent = 0,
const char * name = 0 )

Constructor.

Stores the chart parameters.

Parameters
paramsthe specification of the chart
datathe data to be displayed as a chart
parentthe widget parent; passed on to TQWidget
namethe widget name; passed on to TQWidget

Definition at line 94 of file KDChartWidget.cpp.

◆ ~KDChartWidget()

KDChartWidget::~KDChartWidget ( )

Destructor.

Definition at line 112 of file KDChartWidget.cpp.

Member Function Documentation

◆ barsDisplayed

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.

See also
KDChartParams::numBarsDisplayed, KDChartParams::numBarsLeft

◆ data

KDChartTableDataBase * KDChartWidget::data ( ) const
slot

Returns a pointer to the current data table.

Definition at line 346 of file KDChartWidget.cpp.

◆ dataLeftClicked [1/2]

void KDChartWidget::dataLeftClicked ( const TQPoint & 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
dataRightClicked, dataMiddleClicked

◆ dataLeftClicked [2/2]

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
dataRightClicked, dataMiddleClicked

◆ dataMiddleClicked [1/2]

void KDChartWidget::dataMiddleClicked ( const TQPoint & 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
dataLeftClicked, dataRightClicked

◆ dataMiddleClicked [2/2]

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
dataLeftClicked, dataRightClicked

◆ dataRegions

const KDChartDataRegionList * KDChartWidget::dataRegions ( ) const
inlineslot

Definition at line 69 of file KDChartWidget.h.

◆ dataRightClicked [1/2]

void KDChartWidget::dataRightClicked ( const TQPoint & 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
dataLeftClicked, dataMiddleClicked

◆ dataRightClicked [2/2]

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
dataLeftClicked, dataMiddleClicked

◆ isActiveData

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.

◆ isDoubleBuffered

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.

◆ mousePressEvent()

void KDChartWidget::mousePressEvent ( TQMouseEvent * event)
protectedvirtual

Definition at line 161 of file KDChartWidget.cpp.

◆ mouseReleaseEvent()

void KDChartWidget::mouseReleaseEvent ( TQMouseEvent * event)
protectedvirtual

Definition at line 192 of file KDChartWidget.cpp.

◆ paintEvent()

void KDChartWidget::paintEvent ( TQPaintEvent * event)
protectedvirtual

Definition at line 141 of file KDChartWidget.cpp.

◆ paintTo

void KDChartWidget::paintTo ( TQPainter & painter,
const TQRect * rect = 0 )
slot

Definition at line 119 of file KDChartWidget.cpp.

◆ params

KDChartParams * KDChartWidget::params ( ) const
slot

Returns a pointer to the current parameter set.

Definition at line 338 of file KDChartWidget.cpp.

◆ print

void KDChartWidget::print ( TQPainter & painter,
const TQRect * rect = 0 )
slot

Definition at line 125 of file KDChartWidget.cpp.

◆ resizeEvent()

void KDChartWidget::resizeEvent ( TQResizeEvent * event)
protectedvirtual

Definition at line 232 of file KDChartWidget.cpp.

◆ setActiveData

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
activeif true, the widget reports mouse events
See also
isActiveData()

Definition at line 257 of file KDChartWidget.cpp.

◆ setData

void KDChartWidget::setData ( KDChartTableDataBase * data)
slot

Set an entire new data table.

Definition at line 330 of file KDChartWidget.cpp.

◆ setDoubleBuffered

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
doublebufferedif true, turns double-buffering on, if false, turns double-buffering off
See also
isDoubleBuffered

Definition at line 290 of file KDChartWidget.cpp.

◆ setParams

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: