kchart

KDChartTableDataBase Class Referenceabstract

#include <KDChartTableBase.h>

Public Slots

virtual uint rows () const =0
virtual uint cols () const =0
virtual void setCell (uint _row, uint _col, const TQVariant &_value1, const TQVariant &_value2=TQVariant())=0
virtual void setProp (uint _row, uint _col, int _propSet=0)=0
virtual bool cellCoord (uint _row, uint _col, TQVariant &_value, int coordinate=1) const =0
virtual TQVariant cellVal (uint _row, uint _col, int coordinate=1) const
virtual bool cellProp (uint _row, uint _col, int &_prop) const =0
virtual void expand (uint _rows, uint _cols)=0
virtual bool cellContent (uint _row, uint _col, TQVariant &_value1, TQVariant &_value2, int &_prop) const
virtual bool cellCoords (uint _row, uint _col, TQVariant &_value1, TQVariant &_value2) const
virtual void setUsedRows (uint _rows)
virtual uint usedRows () const
virtual void setUsedCols (uint _cols)
virtual uint usedCols () const
virtual uint colsScrolledBy () const
virtual void setSorted (bool sorted)
virtual bool sorted () const
virtual bool isPosInfinite (double value) const
virtual bool isNegInfinite (double value) const
virtual bool isNormalDouble (double value) const
bool isNormalDouble (TQVariant value, double &dVal) const
virtual void importFromQTable (TQTable *table)
virtual double maxValue (int coordinate=1) const
virtual double minValue (int coordinate=1, bool bOnlyGTZero=false) const
virtual TQDateTime maxDtValue (int coordinate=1) const
virtual TQDateTime minDtValue (int coordinate=1) const
virtual double maxColSum (int coordinate=1) const
virtual double minColSum (int coordinate=1) const
virtual double maxColSum (uint row, uint row2, int coordinate=1) const
virtual double minColSum (uint row, uint row2, int coordinate=1) const
virtual double colSum (uint col, int coordinate=1) const
virtual double colAbsSum (uint col, int coordinate=1) const
virtual double maxRowSum (int coordinate=1) const
virtual double minRowSum (int coordinate=1) const
virtual double rowSum (uint row, int coordinate=1) const
virtual double rowAbsSum (uint row, int coordinate=1) const
virtual double maxInColumn (uint col, int coordinate=1) const
virtual double minInColumn (uint col, int coordinate=1) const
virtual double maxInRow (uint row, int coordinate=1) const
virtual double minInRow (uint row, int coordinate=1) const
virtual double maxInRows (uint row, uint row2, int coordinate=1) const
virtual double minInRows (uint row, uint row2, int coordinate=1, bool bOnlyGTZero=false) const
virtual TQDateTime maxDtInRows (uint row, uint row2, int coordinate=1) const
virtual TQDateTime minDtInRows (uint row, uint row2, int coordinate=1) const
virtual uint lastPositiveCellInColumn (uint col, int coordinate=1) const
virtual bool cellsHaveSeveralCoordinates (TQVariant::Type *type2Ref) const
virtual bool cellsHaveSeveralCoordinates (uint row1=0, uint row2=UINT_MAX, TQVariant::Type *type2Ref=NULL) const
virtual TQVariant::Type cellsValueType (uint row1, uint row2=UINT_MAX, int coordinate=1) const
virtual TQVariant::Type cellsValueType (int coordinate=1) const

Public Member Functions

 KDChartTableDataBase ()
 KDChartTableDataBase (const KDChartTableDataBase &other)
virtual ~KDChartTableDataBase ()

Protected Attributes

bool _useUsedRows
bool _useUsedCols

Detailed Description

KD Chart's build-in table data for an easy way of storing data values.

Encapsulates all data values that are to be used in a chart.

Note
To create your data table you would not use a KDChartTableDataBase but instantiate the class KDChartTableData. The KDChartTableData class is an auxiliary class: depending on your TQt version it will be mapped onto a KDChartVectorTableData or onto a KDChartListTableData both of which are derived from KDChartTableDataBase and implement all of its functions. Thus you would create a table of 3 datasets with 25 cells each like this:
KDChartTableData myData( 3, 25 );

Data values may be specified via setCell(). Cell specific properties may be specified via setCellProp().

You may adjust or modify your table like this:

  • Entering the data can be done either manually using setCell() or by passing a TQTable to the importFromQTable() function.
  • Performance of KD Chart can be increased by specifying the number of rows and or the number of columns actually used: setUsedRows() and/or setUsedCols() prevents KD Chart from iterating over thousands of empty rows/cols that might follow your data cells in case your table is much bigger than needed.
  • In case you want to increase your table's size without using the data stored in it please call the expand() function with the new total number of rows and cells.
  • Accessing one data cell is possible via cellCoord() and via cellProp(), e.g. you might assign a special property set ID to all cells with a future absicssa axis value:
    const TQDateTime currentTime( TQDateTime::currentDateTime() );
    for( int iCell = 0;  iCell < usedValues;  ++iCell ){
    KDChartData& cell = myData.cell( 0, iCell );
    // assign special property set ID if X value is in the future
    if( cell.isDateTime( 2 ) && cell.dateTimeValue( 2 ) > currentTime )
    cell.setPropertySet( idProp_FutureValues );
    }
    
Note
All of the other functions provided by KDChartTableDataBase are either used internally by KD Chart or they are const methods returning some usefull figures like the sum of all values in a row...

Definition at line 87 of file KDChartTableBase.h.

Constructor & Destructor Documentation

◆ KDChartTableDataBase() [1/2]

KDChartTableDataBase::KDChartTableDataBase ( )
inline

Default constructor.

Creates an empty table and sets the sorted flag to false.

Definition at line 97 of file KDChartTableBase.h.

◆ KDChartTableDataBase() [2/2]

KDChartTableDataBase::KDChartTableDataBase ( const KDChartTableDataBase & other)
inline

Default copy constructor.

Just initializes the TQObject part of this class and copies the sorted flag.

Definition at line 107 of file KDChartTableBase.h.

◆ ~KDChartTableDataBase()

virtual KDChartTableDataBase::~KDChartTableDataBase ( )
inlinevirtual

Default destructor.

Does nothing, only defined to have it virtual.

Definition at line 120 of file KDChartTableBase.h.

Member Function Documentation

◆ cellContent

virtual bool KDChartTableDataBase::cellContent ( uint _row,
uint _col,
TQVariant & _value1,
TQVariant & _value2,
int & _prop ) const
inlinevirtualslot
Note
To improve runtime speed this virtual function may be reimplemented by classes derived from KDChartTableDataBase.
See also
cellCoords, cellProp, setCell, setProp

Definition at line 270 of file KDChartTableBase.h.

◆ cellCoord

virtual bool KDChartTableDataBase::cellCoord ( uint _row,
uint _col,
TQVariant & _value,
int coordinate = 1 ) const
pure virtualslot

Returns one of the coordinate data value(s) stored in a cell.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Parameters
_rowthe row number of the cell to be retrieved.
_colthe column number of the cell to be retrieved.
_valuethe coordinate variable to be filled by this method.
coordinatethe number of the coordinate to be retrieved, normally 1 is the Y value and 2 is the X value.
Returns
true if the row and col are addressing a cell in the table.
See also
cellCoords, cellProp, cellContent, cellVal, setCell, setProp

◆ cellCoords

virtual bool KDChartTableDataBase::cellCoords ( uint _row,
uint _col,
TQVariant & _value1,
TQVariant & _value2 ) const
inlinevirtualslot
Note
To improve runtime speed this virtual function may be reimplemented by classes derived from KDChartTableDataBase.
See also
cellCoord, cellProp, cellContent, setCell, setProp

Definition at line 284 of file KDChartTableBase.h.

◆ cellProp

virtual bool KDChartTableDataBase::cellProp ( uint _row,
uint _col,
int & _prop ) const
pure virtualslot

Returns the property set ID stored in a cell.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Parameters
_propthe property set ID of the cell to be retrieved.
Returns
true if the row and col are addressing a cell in the table.
See also
cellCoord, cellCoords, cellContent, setCell, setProp

◆ cellsHaveSeveralCoordinates [1/2]

bool KDChartTableDataBase::cellsHaveSeveralCoordinates ( TQVariant::Type * type2Ref) const
virtualslot

Definition at line 109 of file KDChartTableBase.cpp.

◆ cellsHaveSeveralCoordinates [2/2]

bool KDChartTableDataBase::cellsHaveSeveralCoordinates ( uint row1 = 0,
uint row2 = UINT_MAX,
TQVariant::Type * type2Ref = NULL ) const
virtualslot

Definition at line 116 of file KDChartTableBase.cpp.

◆ cellsValueType [1/2]

TQVariant::Type KDChartTableDataBase::cellsValueType ( int coordinate = 1) const
virtualslot

Definition at line 181 of file KDChartTableBase.cpp.

◆ cellsValueType [2/2]

TQVariant::Type KDChartTableDataBase::cellsValueType ( uint row1,
uint row2 = UINT_MAX,
int coordinate = 1 ) const
virtualslot

Definition at line 161 of file KDChartTableBase.cpp.

◆ cellVal

virtual TQVariant KDChartTableDataBase::cellVal ( uint _row,
uint _col,
int coordinate = 1 ) const
inlinevirtualslot
 Returns one of the coordinate data value(s) stored in a cell.

 This convenience method calls the bool cellCoord() function and returns
 the result if it returned successfully - otherwise it returns an invalid TQVariant.

 \note If you \em know that a cell is containing valid double data
 you may quickly access them like this:
const double yVal = data.cellVal( r, c    ).toDouble();
const double xVal = data.cellVal( r, c, 2 ).toDouble(); 
 \param _row the row number of the cell to be retrieved.
 \param _col the column number of the cell to be retrieved.
 \param coordinate the number of the coordinate to be retrieved, normally
 1 is the Y value and 2 is the X value.

 \returns cell contens if the row and col are addressing a cell in the
 table, otherwise an invalid TQVariant is returned.

 \sa cellCoords, cellProp, cellContent, setCell, setProp

Definition at line 219 of file KDChartTableBase.h.

◆ colAbsSum

double KDChartTableDataBase::colAbsSum ( uint col,
int coordinate = 1 ) const
virtualslot

Definition at line 406 of file KDChartTableBase.cpp.

◆ cols

virtual uint KDChartTableDataBase::cols ( ) const
pure virtualslot

Returns the number of cols in the table.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Returns
the number of cols in the table.
See also
setCols, usedCols, rows

◆ colsScrolledBy

virtual uint KDChartTableDataBase::colsScrolledBy ( ) const
inlinevirtualslot

Returns the number of cols the table has been scrolled by.

Default implementation of this always returns zero, so make sure to return the appropriate value if your class derived from KDChartTableDataBase is supporting internal data scrolling technics.

See the KD Chart Programmers Manual for details described in the Data Scrolling chapter.

Returns
the number of cols the table has been scrolled by.
See also
cols, rows

Definition at line 348 of file KDChartTableBase.h.

◆ colSum

double KDChartTableDataBase::colSum ( uint col,
int coordinate = 1 ) const
virtualslot

Definition at line 388 of file KDChartTableBase.cpp.

◆ expand

virtual void KDChartTableDataBase::expand ( uint _rows,
uint _cols )
pure virtualslot

Increases the number of rows (and/or columns, resp.) stored in this table.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
The old content of the table must be preserved (e.g. by copying the data into the cells of the new table).
Parameters
_rowthe new number of rows.
_colthe new number of columns.
See also
cell

◆ importFromQTable

void KDChartTableDataBase::importFromQTable ( TQTable * table)
virtualslot

Definition at line 743 of file KDChartTableBase.cpp.

◆ isNegInfinite

virtual bool KDChartTableDataBase::isNegInfinite ( double value) const
inlinevirtualslot

Returns true if the given value represents a negative infinite value.

Note
This virtual function may be implemented by classes derived from KDChartTableDataBase. This should be done if your data are not stored as special value KDCHART_NEG_INFINITE to indicate negative infinite values
Returns
true if the value given is a negative infinite value.

Definition at line 394 of file KDChartTableBase.h.

◆ isNormalDouble [1/2]

virtual bool KDChartTableDataBase::isNormalDouble ( double value) const
inlinevirtualslot

Returns true if the given value represents a normal double value.

Normal double values are defined as values that are neither positive infinite nor negative infinite. This method is provided to let derived classed use their own way to determine when a double value is to be threated as normal.

Note
To improve runtime speed this virtual function may be reimplemented by classes derived from KDChartTableDataBase.
Returns
true if the value given is neither positive infinite nor negativr infinite.

Definition at line 411 of file KDChartTableBase.h.

◆ isNormalDouble [2/2]

bool KDChartTableDataBase::isNormalDouble ( TQVariant value,
double & dVal ) const
inlineslot

Returns true if the given TQVariant value represents a normal double value.

This method tests if value has type TQVariant::Double: if no, it returns false; if yes, it sets dVal accordingly and calls the virtual method isNormalDouble( double value ).

Parameters
valueThe TQVariant value to be tested and converted.
dValPoints to the double variable to be filled with the converted value.
Returns
true if the value given is neither positive infinite nor negative infinite, value is set to the converted value if the type of value is TQVariant::Double, otherwise it is not modified.

Definition at line 430 of file KDChartTableBase.h.

◆ isPosInfinite

virtual bool KDChartTableDataBase::isPosInfinite ( double value) const
inlinevirtualslot

Returns true if the given value represents a positive infinite value.

Note
This virtual function may be implemented by classes derived from KDChartTableDataBase. This should be done if your data are not stored as special value KDCHART_POS_INFINITE to indicate positive infinite values
Returns
true if the value given is a positive infinite value.

Definition at line 378 of file KDChartTableBase.h.

◆ lastPositiveCellInColumn

uint KDChartTableDataBase::lastPositiveCellInColumn ( uint col,
int coordinate = 1 ) const
virtualslot

Definition at line 726 of file KDChartTableBase.cpp.

◆ maxColSum [1/2]

double KDChartTableDataBase::maxColSum ( int coordinate = 1) const
virtualslot

Definition at line 287 of file KDChartTableBase.cpp.

◆ maxColSum [2/2]

double KDChartTableDataBase::maxColSum ( uint row,
uint row2,
int coordinate = 1 ) const
virtualslot

Definition at line 320 of file KDChartTableBase.cpp.

◆ maxDtInRows

TQDateTime KDChartTableDataBase::maxDtInRows ( uint row,
uint row2,
int coordinate = 1 ) const
virtualslot

Definition at line 662 of file KDChartTableBase.cpp.

◆ maxDtValue

TQDateTime KDChartTableDataBase::maxDtValue ( int coordinate = 1) const
virtualslot

Definition at line 240 of file KDChartTableBase.cpp.

◆ maxInColumn

double KDChartTableDataBase::maxInColumn ( uint col,
int coordinate = 1 ) const
virtualslot

Definition at line 491 of file KDChartTableBase.cpp.

◆ maxInRow

double KDChartTableDataBase::maxInRow ( uint row,
int coordinate = 1 ) const
virtualslot

Definition at line 539 of file KDChartTableBase.cpp.

◆ maxInRows

double KDChartTableDataBase::maxInRows ( uint row,
uint row2,
int coordinate = 1 ) const
virtualslot

Definition at line 589 of file KDChartTableBase.cpp.

◆ maxRowSum

double KDChartTableDataBase::maxRowSum ( int coordinate = 1) const
virtualslot

Definition at line 424 of file KDChartTableBase.cpp.

◆ maxValue

double KDChartTableDataBase::maxValue ( int coordinate = 1) const
virtualslot

Definition at line 188 of file KDChartTableBase.cpp.

◆ minColSum [1/2]

double KDChartTableDataBase::minColSum ( int coordinate = 1) const
virtualslot

Definition at line 303 of file KDChartTableBase.cpp.

◆ minColSum [2/2]

double KDChartTableDataBase::minColSum ( uint row,
uint row2,
int coordinate = 1 ) const
virtualslot

Definition at line 354 of file KDChartTableBase.cpp.

◆ minDtInRows

TQDateTime KDChartTableDataBase::minDtInRows ( uint row,
uint row2,
int coordinate = 1 ) const
virtualslot

Definition at line 694 of file KDChartTableBase.cpp.

◆ minDtValue

TQDateTime KDChartTableDataBase::minDtValue ( int coordinate = 1) const
virtualslot

Definition at line 264 of file KDChartTableBase.cpp.

◆ minInColumn

double KDChartTableDataBase::minInColumn ( uint col,
int coordinate = 1 ) const
virtualslot

Definition at line 515 of file KDChartTableBase.cpp.

◆ minInRow

double KDChartTableDataBase::minInRow ( uint row,
int coordinate = 1 ) const
virtualslot

Definition at line 564 of file KDChartTableBase.cpp.

◆ minInRows

double KDChartTableDataBase::minInRows ( uint row,
uint row2,
int coordinate = 1,
bool bOnlyGTZero = false ) const
virtualslot

Definition at line 624 of file KDChartTableBase.cpp.

◆ minRowSum

double KDChartTableDataBase::minRowSum ( int coordinate = 1) const
virtualslot

Definition at line 440 of file KDChartTableBase.cpp.

◆ minValue

double KDChartTableDataBase::minValue ( int coordinate = 1,
bool bOnlyGTZero = false ) const
virtualslot

Definition at line 214 of file KDChartTableBase.cpp.

◆ rowAbsSum

double KDChartTableDataBase::rowAbsSum ( uint row,
int coordinate = 1 ) const
virtualslot

Definition at line 474 of file KDChartTableBase.cpp.

◆ rows

virtual uint KDChartTableDataBase::rows ( ) const
pure virtualslot

Returns the number of rows in the table.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Returns
the number of rows in the table.
See also
setRows, usedRows, cols

◆ rowSum

double KDChartTableDataBase::rowSum ( uint row,
int coordinate = 1 ) const
virtualslot

Definition at line 457 of file KDChartTableBase.cpp.

◆ setCell

virtual void KDChartTableDataBase::setCell ( uint _row,
uint _col,
const TQVariant & _value1,
const TQVariant & _value2 = TQVariant() )
pure virtualslot

Stores data in a cell.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Parameters
_rowthe row number of the cell to store the data object into.
_colthe column number of the cell to store the data object into.
_value1the first value to be stored, normally the Y value, possible types: int, double, TQString TQString might be used in case you want to use this cell's content for axis label
_value2the second value to be stored, normally the X value (if any), possible types: int, double, TQDateTime
See also
cellCoords, cellContent, setProp

◆ setProp

virtual void KDChartTableDataBase::setProp ( uint _row,
uint _col,
int _propSet = 0 )
pure virtualslot

Specifies the property set ID for a cell.

Note
This pure-virtual function has to be implemented by each class derived from KDChartTableDataBase.
Parameters
_rowthe row number of the cell.
_colthe column number of the cell.
_propSetthe property set ID to be stored for this data cell, defaults to zero for normal data.
See also
cellProp, cellContent, setCell

◆ setSorted

void KDChartTableDataBase::setSorted ( bool sorted)
virtualslot

Specified whether the table is sorted.

See also
sorted

Definition at line 770 of file KDChartTableBase.cpp.

◆ setUsedCols

void KDChartTableDataBase::setUsedCols ( uint _cols)
virtualslot

Sets the number of cols in the table that actually contain data.

Note
You might want to re-implement this function in derived classes, the default implementation just stores the new number of used cols.
Parameters
_colsthe number of cols in the table that actually contain data.
See also
usedCols, rows, cols

Definition at line 100 of file KDChartTableBase.cpp.

◆ setUsedRows

void KDChartTableDataBase::setUsedRows ( uint _rows)
virtualslot

Sets the number of rows in the table that actually contain data.

Note
You might want to re-implement this function in derived classes, the default implementation just stores the new number of used rows.
Parameters
_rowsthe number of rows in the table that actually contain data.
See also
usedRows, rows, cols

Definition at line 93 of file KDChartTableBase.cpp.

◆ sorted

bool KDChartTableDataBase::sorted ( ) const
virtualslot

Returns whether the table is sorted.

See also
setSorted

Definition at line 774 of file KDChartTableBase.cpp.

◆ usedCols

uint KDChartTableDataBase::usedCols ( ) const
virtualslot

Returns the number of cols in the table that actually contain data.

Returns
the number of cols in the table that actually contain data.
See also
setUsedCols, rows, cols

Definition at line 104 of file KDChartTableBase.cpp.

◆ usedRows

uint KDChartTableDataBase::usedRows ( ) const
virtualslot

Returns the number of rows in the table that actually contain data.

Returns
the number of rows in the table that actually contain data.
See also
setUsedRows, rows, cols

Definition at line 97 of file KDChartTableBase.cpp.

Member Data Documentation

◆ _useUsedCols

bool KDChartTableDataBase::_useUsedCols
protected

Definition at line 474 of file KDChartTableBase.h.

◆ _useUsedRows

bool KDChartTableDataBase::_useUsedRows
protected

Definition at line 474 of file KDChartTableBase.h.


The documentation for this class was generated from the following files: