![]() |
KD Chart API Documentation
3.1
|
#include <KDChartAbstractAxis.h>
Public Slots | |
void | update () |
Signals | |
void | coordinateSystemChanged () |
![]() | |
void | positionChanged (AbstractArea *) |
Public Member Functions | |
AbstractAxis (AbstractDiagram *diagram=nullptr) | |
~AbstractAxis () override | |
bool | compare (const AbstractAxis *other) const |
virtual void | connectSignals () |
const AbstractCoordinatePlane * | coordinatePlane () 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 AbstractDiagram * | diagram () 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... | |
![]() | |
~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 |
![]() | |
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) |
![]() | |
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 void | paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes) |
static void | paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes) |
![]() | |
AbstractArea () | |
QRect | areaGeometry () const override |
void | positionHasChanged () override |
![]() | |
AbstractAreaBase () | |
virtual | ~AbstractAreaBase () |
QRect | innerRect () const |
![]() | |
QWidget * | mParent = nullptr |
QLayout * | mParentLayout = nullptr |
The base class for axes.
For being useful, axes need to be assigned to a diagram, see AbstractCartesianDiagram::addAxis and AbstractCartesianDiagram::takeAxis.
Definition at line 44 of file KDChartAbstractAxis.h.
|
explicit |
Definition at line 100 of file KDChartAbstractAxis.cpp.
References delayedInit().
|
override |
Definition at line 107 of file KDChartAbstractAxis.cpp.
References d.
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().
|
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.
Definition at line 159 of file KDChartAbstractAxis.cpp.
References coordinateSystemChanged(), d, and KDChart::DiagramObserver::diagramDataChanged().
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.
|
signal |
Referenced by connectSignals().
void AbstractAxis::createObserver | ( | AbstractDiagram * | diagram | ) |
Definition at line 149 of file KDChartAbstractAxis.cpp.
Referenced by KDChart::AbstractCartesianDiagram::addAxis().
|
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.
label | The text of the label as KD Chart has calculated it automatically (or as it was taken from a QStringList provided by you, resp.) |
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.label
. Definition at line 144 of file KDChartAbstractAxis.cpp.
Referenced by KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::CartesianAxis::paintCtx().
|
protectedvirtualslot |
called for initializing after the c'tor has completed
Definition at line 124 of file KDChartAbstractAxis.cpp.
References d.
Referenced by AbstractAxis().
void AbstractAxis::deleteObserver | ( | AbstractDiagram * | diagram | ) |
Definition at line 154 of file KDChartAbstractAxis.cpp.
Referenced by KDChart::AbstractCartesianDiagram::takeAxis().
const AbstractDiagram * KDChart::AbstractAxis::diagram | ( | ) | const |
Definition at line 229 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::TernaryAxis::TernaryAxis(), KDChart::CartesianAxis::~CartesianAxis(), KDChart::LeveyJenningsAxis::~LeveyJenningsAxis(), createObserver(), and deleteObserver().
|
overridepure virtual |
Implemented in KDChart::TernaryAxis, and KDChart::CartesianAxis.
QStringList AbstractAxis::labels | ( | ) | const |
Returns a list of strings, that are used as axis labels, as set via setLabels.
Definition at line 203 of file KDChartAbstractAxis.cpp.
References d.
Referenced by compare(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::TernaryAxis::paintCtx().
bool KDChart::AbstractAxis::observedBy | ( | AbstractDiagram * | diagram | ) | const |
Definition at line 234 of file KDChartAbstractAxis.cpp.
References d.
RulerAttributes AbstractAxis::rulerAttributes | ( | ) | const |
Returns the attributes to be used for painting the rulers.
Definition at line 189 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::paintCtx(), and KDChart::CartesianAxis::tickLength().
|
overridepure virtual |
Implemented in KDChart::TernaryAxis, and KDChart::CartesianAxis.
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.
Definition at line 194 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::LeveyJenningsAxis::paintAsAbscissa().
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.
Definition at line 183 of file KDChartAbstractAxis.cpp.
References d.
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.
By passing an empty QStringList you can reset the default behaviour.
Definition at line 208 of file KDChartAbstractAxis.cpp.
References d.
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.
Definition at line 169 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::LeveyJenningsAxis::setType().
QStringList AbstractAxis::shortLabels | ( | ) | const |
Returns a list of strings, that are used as axis labels, as set via setShortLabels.
Definition at line 217 of file KDChartAbstractAxis.cpp.
References d.
Referenced by compare().
TextAttributes AbstractAxis::textAttributes | ( | ) | const |
Returns the text attributes to be used for axis labels.
Definition at line 178 of file KDChartAbstractAxis.cpp.
References d.
Referenced by compare(), KDChart::LeveyJenningsAxis::paintAsAbscissa(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), KDChart::CartesianAxis::paintCtx(), KDChart::LeveyJenningsAxis::setType(), and KDChart::CartesianAxis::titleTextAttributes().
|
slot |
Definition at line 239 of file KDChartAbstractAxis.cpp.
References d.