12#include "KDChartBarDiagram_p.h"
16#include "KDChartPainterSaver_p.h"
23#include <KDABLibFakes>
25#include "KDChartNormalBarDiagram_p.h"
26#include "KDChartNormalLyingBarDiagram_p.h"
27#include "KDChartPercentBarDiagram_p.h"
28#include "KDChartPercentLyingBarDiagram_p.h"
29#include "KDChartStackedBarDiagram_p.h"
30#include "KDChartStackedLyingBarDiagram_p.h"
34BarDiagram::Private::Private()
38BarDiagram::Private::~Private()
41 delete stackedDiagram;
42 delete percentDiagram;
43 delete normalLyingDiagram;
44 delete stackedLyingDiagram;
45 delete percentLyingDiagram;
50 if (orientation == o && implementor->type() == type) {
53 auto *barDia = qobject_cast<BarDiagram *>(diagram);
60 implementor = normalDiagram;
63 implementor = stackedDiagram;
66 implementor = percentDiagram;
69 Q_ASSERT_X(
false,
"BarDiagram::setType",
"unknown diagram subtype");
74 implementor = normalLyingDiagram;
77 implementor = stackedLyingDiagram;
80 implementor = percentLyingDiagram;
83 Q_ASSERT_X(
false,
"BarDiagram::setType",
"unknown diagram subtype");
87 Q_ASSERT(implementor->type() == type);
91 barDia->setDataBoundariesDirty();
92 Q_EMIT barDia->layoutChanged(barDia);
93 Q_EMIT barDia->propertiesChanged();
104void BarDiagram::init()
112 d->implementor =
d->normalDiagram;
150 d->setOrientationAndType(
d->orientation,
type);
158 return d->implementor->type();
166 d->setOrientationAndType(
orientation,
d->implementor->type());
174 return d->orientation;
201 d->attributesModel->mapFromSource(index),
231 return d->attributesModel->data(
232 d->attributesModel->mapFromSource(index),
265 d->attributesModel->setData(
266 d->attributesModel->mapFromSource(index),
297 return d->attributesModel->data(
298 d->attributesModel->mapFromSource(index),
330 return d->implementor->calculateDataBoundaries();
369 ctx->setCoordinatePlane(plane);
380#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
389#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
Base class for diagrams based on a cartesian coordianate system.
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
virtual AbstractCoordinatePlane * sharedAxisMasterPlane(QPainter *p=nullptr)
virtual AttributesModel * attributesModel() const
virtual bool checkInvariants(bool justReturnTheStatus=false) const
void layoutChanged(AbstractDiagram *)
QModelIndex attributesModelRootIndex() const
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the dia...
const QPair< QPointF, QPointF > dataBoundaries() const
Return the bottom left and top right data point, that the diagram will display (unless the grid adjus...
AbstractCoordinatePlane * coordinatePlane() const
void setDataBoundariesDirty() const
static bool isBoundariesValid(const QRectF &r)
virtual void paint(QPainter *)=0
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
Set of attributes for changing the appearance of bar charts.
BarDiagram defines a common bar diagram.
void setThreeDBarAttributes(const ThreeDBarAttributes &a)
ThreeDBarAttributes threeDBarAttributes() const
BarDiagram(QWidget *parent=nullptr, CartesianCoordinatePlane *plane=nullptr)
int numberOfAbscissaSegments() const override
BarAttributes barAttributes() const
const QPair< QPointF, QPointF > calculateDataBoundaries() const override
bool compare(const BarDiagram *other) const
void paintEvent(QPaintEvent *) override
void resizeEvent(QResizeEvent *) override
Qt::Orientation orientation() const
virtual BarDiagram * clone() const
void setBarAttributes(const BarAttributes &a)
void paint(PaintContext *paintContext) override
int numberOfOrdinateSegments() const override
void setOrientation(Qt::Orientation orientation)
void resize(const QSizeF &area) override
void setType(const BarType type)
qreal threeDItemDepth(const QModelIndex &index) const override
Cartesian coordinate plane.
Stores information about painting diagrams.
void setPainter(QPainter *painter)
A set of 3D bar attributes.
@ ThreeDBarAttributesRole
QAbstractItemModel * model() const const
QModelIndex rootIndex() const const
T qobject_cast(QObject *object)
QVariant fromValue(const T &value)