KPlotting

kplotpoint.h
1 /* -*- C++ -*-
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2003 Jason Harris <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KPLOTPOINT_H
9 #define KPLOTPOINT_H
10 
11 #include <kplotting_export.h>
12 
13 #include <QString>
14 
15 class QPointF;
16 
17 /**
18  * @class KPlotPoint
19  * @short Encapsulates a point in the plot.
20  * A KPlotPoint consists of X and Y coordinates (in Data units),
21  * an optional label string, and an optional bar-width,
22  * The bar-width is only used for plots of type KPlotObject::Bars,
23  * and it allows the width of each bar to be set manually. If
24  * bar-widths are omitted, then the widths will be set automatically,
25  * based on the halfway-mark between adjacent points.
26  */
27 class KPLOTTING_EXPORT KPlotPoint
28 {
29 public:
30  /**
31  * Default constructor.
32  */
33  explicit KPlotPoint();
34 
35  /**
36  * Constructor. Sets the KPlotPoint according to the given arguments
37  * @param x the X-position for the point, in Data units
38  * @param y the Y-position for the point, in Data units
39  * @param label the label string for the point. If the string
40  * is defined, the point will be labeled in the plot.
41  * @param width the bar width to use for this point (only used for
42  * plots of type KPlotObject::Bars)
43  */
44  KPlotPoint(double x, double y, const QString &label = QString(), double width = 0.0);
45 
46  /**
47  * Constructor. Sets the KPlotPoint according to the given arguments
48  * @param p the position for the point, in Data units
49  * @param label the label string for the point. If the string
50  * is defined, the point will be labeled in the plot.
51  * @param width the bar width to use for this point (only used for
52  * plots of type KPlotObject::Bars)
53  */
54  explicit KPlotPoint(const QPointF &p, const QString &label = QString(), double width = 0.0);
55 
56  /**
57  * Destructor
58  */
59  ~KPlotPoint();
60 
61  /**
62  * @return the position of the point, in data units
63  */
64  QPointF position() const;
65 
66  /**
67  * Set the position of the point, in data units
68  * @param pos the new position for the point.
69  */
70  void setPosition(const QPointF &pos);
71 
72  /**
73  * @return the X-position of the point, in data units
74  */
75  double x() const;
76 
77  /**
78  * Set the X-position of the point, in Data units
79  */
80  void setX(double x);
81 
82  /**
83  * @return the Y-position of the point, in data units
84  */
85  double y() const;
86 
87  /**
88  * Set the Y-position of the point, in Data units
89  */
90  void setY(double y);
91 
92  /**
93  * @return the label for the point
94  */
95  QString label() const;
96 
97  /**
98  * Set the label for the point
99  */
100  void setLabel(const QString &label);
101 
102  /**
103  * @return the bar-width for the point
104  */
105  double barWidth() const;
106 
107  /**
108  * Set the bar-width for the point
109  */
110  void setBarWidth(double w);
111 
112 private:
113  class Private;
114  Private *const d;
115 
116  Q_DISABLE_COPY(KPlotPoint)
117 };
118 
119 #endif
Encapsulates a point in the plot. A KPlotPoint consists of X and Y coordinates (in Data units),...
Definition: kplotpoint.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 03:52:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.