KPlotting

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

KDE's Doxygen guidelines are available online.