KChart

KChartAbstractCartesianDiagram.h
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef KCHARTABSTRACTCARTESIANDIAGRAM_H
10#define KCHARTABSTRACTCARTESIANDIAGRAM_H
11
12#include "KChartCartesianCoordinatePlane.h"
13#include "KChartAbstractDiagram.h"
14#include "KChartCartesianAxis.h"
15
16namespace KChart {
17
18 class GridAttributes;
19
20 /**
21 * @brief Base class for diagrams based on a cartesian coordianate system.
22 *
23 * The AbstractCartesianDiagram interface adds those elements that are
24 * specific to diagrams based on a cartesian coordinate system to the
25 * basic AbstractDiagram interface.
26 */
27 class KCHART_EXPORT AbstractCartesianDiagram : public AbstractDiagram
28 {
29 Q_OBJECT
30 Q_DISABLE_COPY( AbstractCartesianDiagram )
31 KCHART_DECLARE_DERIVED_DIAGRAM( AbstractCartesianDiagram, CartesianCoordinatePlane )
32
33 public:
34 explicit AbstractCartesianDiagram( QWidget* parent = nullptr, CartesianCoordinatePlane* plane = nullptr );
36
37 /**
38 * Returns true if both diagrams have the same settings.
39 */
40 bool compare( const AbstractCartesianDiagram* other ) const;
41
42#if defined(Q_COMPILER_MANGLES_RETURN_TYPE)
43 virtual const int numberOfAbscissaSegments() const = 0;
44 virtual const int numberOfOrdinateSegments() const = 0;
45#else
46 virtual int numberOfAbscissaSegments() const = 0;
47 virtual int numberOfOrdinateSegments() const = 0;
48#endif
49 /**
50 * Add the axis to the diagram. The diagram takes ownership of the axis
51 * and will delete it.
52 *
53 * To gain back ownership (e.g. for assigning the axis to another diagram)
54 * use the takeAxis method, before calling addAxis on the other diagram.
55 *
56 * \sa takeAxis
57 */
58 virtual void addAxis( CartesianAxis * axis );
59 /**
60 * Removes the axis from the diagram, without deleting it.
61 *
62 * The diagram no longer owns the axis, so it is
63 * the caller's responsibility to delete the axis.
64 *
65 * \sa addAxis
66 */
67 virtual void takeAxis( CartesianAxis * axis );
68 /**
69 * @return a list of all axes added to the diagram
70 */
71 virtual KChart::CartesianAxisList axes() const;
72
73 /**
74 * Triggers layouting of all coordinate planes on the current chart.
75 * Normally you don't need to call this method. It's handled automatically for you.
76 */
77 virtual void layoutPlanes();
78 /** \reimpl */
79 void setCoordinatePlane( AbstractCoordinatePlane* plane ) override;
80
81 /**
82 * Makes this diagram use another diagram \a diagram as reference diagram with relative offset
83 * \a offset.
84 * To share cartesian axes between different diagrams there might be cases when you need that.
85 * Normally you don't.
86 * \sa examples/SharedAbscissa
87 */
88 virtual void setReferenceDiagram( AbstractCartesianDiagram* diagram, const QPointF& offset = QPointF() );
89 /**
90 * @return this diagram's reference diagram
91 * \sa setReferenceDiagram
92 */
93 virtual AbstractCartesianDiagram* referenceDiagram() const;
94 /**
95 * @return the relative offset of this diagram's reference diagram
96 * \sa setReferenceDiagram
97 */
98 virtual QPointF referenceDiagramOffset() const;
99
100 /* reimpl */
101 void setModel( QAbstractItemModel* model ) override;
102 /* reimpl */
103 void setRootIndex( const QModelIndex& index ) override;
104 /* reimpl */
105 void setAttributesModel( AttributesModel* model ) override;
106
107 protected Q_SLOTS:
108 void connectAttributesModel( KChart::AttributesModel* );
109
110 protected:
111 /** @return the 3D item depth of the model index \a index */
112 virtual qreal threeDItemDepth( const QModelIndex& index ) const = 0;
113 /** @return the 3D item depth of the data set \a column */
114 virtual qreal threeDItemDepth( int column ) const = 0;
115 };
116}
117
118#endif
Base class for diagrams based on a cartesian coordianate system.
virtual qreal threeDItemDepth(int column) const =0
virtual qreal threeDItemDepth(const QModelIndex &index) const =0
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
AbstractDiagram defines the interface for diagram classes.
A proxy model used for decorating data with attributes.
The class for cartesian axes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.