KD Chart API Documentation  3.1
Public Slots | Signals | Public Member Functions | Protected Slots | List of all members
KDChart::AbstractAxis Class Referenceabstract

#include <KDChartAbstractAxis.h>

Inheritance diagram for KDChart::AbstractAxis:
KDChart::AbstractArea KDChart::AbstractAreaBase KDChart::AbstractLayoutItem KDChart::CartesianAxis KDChart::TernaryAxis KDChart::LeveyJenningsAxis

Public Slots

void update ()
 

Signals

void coordinateSystemChanged ()
 
- Signals inherited from KDChart::AbstractArea
void positionChanged (AbstractArea *)
 

Public Member Functions

 AbstractAxis (AbstractDiagram *diagram=nullptr)
 
 ~AbstractAxis () override
 
bool compare (const AbstractAxis *other) const
 
virtual void connectSignals ()
 
const AbstractCoordinatePlanecoordinatePlane () const
 Convenience function, returns the coordinate plane, in which this axis is used. More...
 
void createObserver (AbstractDiagram *diagram)
 
virtual const QString customizedLabel (const QString &label) const
 Reimplement this method if you want to adjust axis labels before they are printed. More...
 
void deleteObserver (AbstractDiagram *diagram)
 
const AbstractDiagramdiagram () const
 
QRect geometry () const override=0
 
QStringList labels () const
 
bool observedBy (AbstractDiagram *diagram) const
 
RulerAttributes rulerAttributes () const
 Returns the attributes to be used for painting the rulers. More...
 
void setGeometry (const QRect &rect) override=0
 
void setLabels (const QStringList &list)
 Use this to specify your own set of strings, to be used as axis labels. More...
 
void setRulerAttributes (const RulerAttributes &a)
 Use this to specify the attributes used to paint the axis ruler. More...
 
void setShortLabels (const QStringList &list)
 Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long. More...
 
void setTextAttributes (const TextAttributes &a)
 Use this to specify the text attributes to be used for axis labels. More...
 
QStringList shortLabels () const
 
TextAttributes textAttributes () const
 Returns the text attributes to be used for axis labels. More...
 
- Public Member Functions inherited from KDChart::AbstractArea
 ~AbstractArea () override
 
virtual int bottomOverlap (bool doNotRecalculate=false) const
 
virtual int leftOverlap (bool doNotRecalculate=false) const
 
void paintAll (QPainter &painter) override
 
virtual void paintIntoRect (QPainter &painter, const QRect &rect)
 Draws the background and frame, then calls paint(). More...
 
virtual int rightOverlap (bool doNotRecalculate=false) const
 
virtual int topOverlap (bool doNotRecalculate=false) const
 
- Public Member Functions inherited from KDChart::AbstractAreaBase
void alignToReferencePoint (const RelativePosition &position)
 
BackgroundAttributes backgroundAttributes () const
 
bool compare (const AbstractAreaBase *other) const
 
FrameAttributes frameAttributes () const
 
void getFrameLeadings (int &left, int &top, int &right, int &bottom) const
 
virtual void paintBackground (QPainter &painter, const QRect &rectangle)
 
virtual void paintFrame (QPainter &painter, const QRect &rectangle)
 
void setBackgroundAttributes (const BackgroundAttributes &a)
 
void setFrameAttributes (const FrameAttributes &a)
 
- Public Member Functions inherited from KDChart::AbstractLayoutItem
 AbstractLayoutItem (Qt::Alignment itemAlignment={})
 
virtual void paint (QPainter *)=0
 
virtual void paintCtx (PaintContext *context)
 
QLayout * parentLayout ()
 
void removeFromParentLayout ()
 
void setParentLayout (QLayout *lay)
 
virtual void setParentWidget (QWidget *widget)
 
virtual void sizeHintChanged () const
 

Protected Slots

virtual void delayedInit ()
 

Additional Inherited Members

- Static Public Member Functions inherited from KDChart::AbstractAreaBase
static void paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes)
 
static void paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes)
 
- Protected Member Functions inherited from KDChart::AbstractArea
 AbstractArea ()
 
QRect areaGeometry () const override
 
void positionHasChanged () override
 
- Protected Member Functions inherited from KDChart::AbstractAreaBase
 AbstractAreaBase ()
 
virtual ~AbstractAreaBase ()
 
QRect innerRect () const
 
- Protected Attributes inherited from KDChart::AbstractLayoutItem
QWidget * mParent = nullptr
 
QLayout * mParentLayout = nullptr
 

Detailed Description

The base class for axes.

For being useful, axes need to be assigned to a diagram, see AbstractCartesianDiagram::addAxis and AbstractCartesianDiagram::takeAxis.

See also
PolarAxis, AbstractCartesianDiagram

Definition at line 44 of file KDChartAbstractAxis.h.

Constructor & Destructor Documentation

◆ AbstractAxis()

AbstractAxis::AbstractAxis ( AbstractDiagram diagram = nullptr)
explicit

Definition at line 100 of file KDChartAbstractAxis.cpp.

References delayedInit().

◆ ~AbstractAxis()

AbstractAxis::~AbstractAxis ( )
override

Definition at line 107 of file KDChartAbstractAxis.cpp.

References d.

Member Function Documentation

◆ compare()

bool AbstractAxis::compare ( const AbstractAxis other) const

Returns true if both axes have the same settings.

Definition at line 132 of file KDChartAbstractAxis.cpp.

References labels(), shortLabels(), and textAttributes().

Referenced by KDChart::CartesianAxis::compare().

◆ connectSignals()

void AbstractAxis::connectSignals ( )
virtual

Wireing the signal/slot connections.

This method gets called automatically, each time, when you assign the axis to a diagram, either by passing a diagram* to the c'tor, or by calling the diagram's setAxis method, resp.

If overwriting this method in derived classes, make sure to call this base method AbstractAxis::connectSignals(), so your axis gets connected to the diagram's built-in signals.

See also
AbstractCartesianDiagram::addAxis()

Definition at line 159 of file KDChartAbstractAxis.cpp.

References coordinateSystemChanged(), d, and KDChart::DiagramObserver::diagramDataChanged().

◆ coordinatePlane()

const AbstractCoordinatePlane * AbstractAxis::coordinatePlane ( ) const

Convenience function, returns the coordinate plane, in which this axis is used.

If the axis is not used in a coordinate plane, the return value is Zero.

Definition at line 222 of file KDChartAbstractAxis.cpp.

References d.

◆ coordinateSystemChanged

void KDChart::AbstractAxis::coordinateSystemChanged ( )
signal

Referenced by connectSignals().

◆ createObserver()

void AbstractAxis::createObserver ( AbstractDiagram diagram)

Definition at line 149 of file KDChartAbstractAxis.cpp.

References d, and diagram().

Referenced by KDChart::AbstractCartesianDiagram::addAxis().

◆ customizedLabel()

const QString AbstractAxis::customizedLabel ( const QString &  label) const
virtual

Reimplement this method if you want to adjust axis labels before they are printed.

KD Chart is calling this method immediately before drawing the text, this means: What you return here will be drawn without further modifications.

Parameters
labelThe text of the label as KD Chart has calculated it automatically (or as it was taken from a QStringList provided by you, resp.)
Note
If you reimplement this method in a subclass of KDChartCartesianAxis, and your reimplementation's return value depends on data other than label (so KDChart will not know when it changes), you must manually ensure that layouts are adapted to any changed sizes of the axis labels. To do that, call KDChartCartesianAxis::layoutPlanes() from your reimplementation when you know that the external data changed and it will change label sizes - or when you cannot exclude that.
Returns
The text to be drawn. By default this is the same as label.

Definition at line 144 of file KDChartAbstractAxis.cpp.

Referenced by KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::CartesianAxis::paintCtx().

◆ delayedInit

void AbstractAxis::delayedInit ( )
protectedvirtualslot

called for initializing after the c'tor has completed

Definition at line 124 of file KDChartAbstractAxis.cpp.

References d.

Referenced by AbstractAxis().

◆ deleteObserver()

void AbstractAxis::deleteObserver ( AbstractDiagram diagram)

Definition at line 154 of file KDChartAbstractAxis.cpp.

References d, and diagram().

Referenced by KDChart::AbstractCartesianDiagram::takeAxis().

◆ diagram()

const AbstractDiagram * KDChart::AbstractAxis::diagram ( ) const

◆ geometry()

QRect KDChart::AbstractAxis::geometry ( ) const
overridepure virtual

◆ labels()

QStringList AbstractAxis::labels ( ) const

Returns a list of strings, that are used as axis labels, as set via setLabels.

See also
setLabels

Definition at line 203 of file KDChartAbstractAxis.cpp.

References d.

Referenced by compare(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::TernaryAxis::paintCtx().

◆ observedBy()

bool KDChart::AbstractAxis::observedBy ( AbstractDiagram diagram) const

Definition at line 234 of file KDChartAbstractAxis.cpp.

References d.

◆ rulerAttributes()

RulerAttributes AbstractAxis::rulerAttributes ( ) const

Returns the attributes to be used for painting the rulers.

See also
setRulerAttributes

Definition at line 189 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::CartesianAxis::paintCtx(), and KDChart::CartesianAxis::tickLength().

◆ setGeometry()

void KDChart::AbstractAxis::setGeometry ( const QRect &  rect)
overridepure virtual

◆ setLabels()

void AbstractAxis::setLabels ( const QStringList &  list)

Use this to specify your own set of strings, to be used as axis labels.

Labels specified via setLabels take precedence: If a non-empty list is passed, KD Chart will use these strings as axis labels, instead of calculating them.

If you pass a smaller number of strings than the number of labels drawn at this axis, KD Chart will repeat the strings until all labels are drawn. As an example you could specify the seven days of the week as abscissa labels, which would be repeatedly used then.

By passing an empty QStringList you can reset the default behaviour.

See also
labels, setShortLabels

Definition at line 194 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::LeveyJenningsAxis::paintAsAbscissa().

◆ setRulerAttributes()

void AbstractAxis::setRulerAttributes ( const RulerAttributes a)

Use this to specify the attributes used to paint the axis ruler.

Every axis has a default set of ruler attributes that is exactly the same among them. Use this method to specify your own attributes.

See also
rulerAttributes

Definition at line 183 of file KDChartAbstractAxis.cpp.

References d.

◆ setShortLabels()

void AbstractAxis::setShortLabels ( const QStringList &  list)

Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.

Note
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via setLabels too!

By passing an empty QStringList you can reset the default behaviour.

See also
shortLabels, setLabels

Definition at line 208 of file KDChartAbstractAxis.cpp.

References d.

◆ setTextAttributes()

void AbstractAxis::setTextAttributes ( const TextAttributes a)

Use this to specify the text attributes to be used for axis labels.

By default, the reference area will be set at painting time. It will be the then-valid coordinate plane's parent widget, so normally, it will be the KDChart::Chart. Thus the labels of all of your axes in all of your diagrams within that Chart will be drawn in same font size, by default.

See also
textAttributes, setLabels

Definition at line 169 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::LeveyJenningsAxis::setType().

◆ shortLabels()

QStringList AbstractAxis::shortLabels ( ) const

Returns a list of strings, that are used as axis labels, as set via setShortLabels.

Note
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via setLabels too!
See also
setShortLabels

Definition at line 217 of file KDChartAbstractAxis.cpp.

References d.

Referenced by compare().

◆ textAttributes()

TextAttributes AbstractAxis::textAttributes ( ) const

◆ update

void KDChart::AbstractAxis::update ( )
slot

Definition at line 239 of file KDChartAbstractAxis.cpp.

References d.


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

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated by doxygen 1.9.1