1
/***************************************************************************
4
--------------------------------------------------------------------
5
Copyright : (C) 2007 by Ion Vasilief
6
Email (use @ for *) : ion_vasilief*yahoo.fr
7
Description : AbstractPlotCurve and DataCurve classes
9
***************************************************************************/
11
/***************************************************************************
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
28
***************************************************************************/
32
#include <qwt_plot_curve.h>
35
//! Abstract 2D plot curve class
36
class PlotCurve: public QwtPlotCurve
40
PlotCurve(const char *name = 0): QwtPlotCurve(name), d_type(0){};
42
int type() const {return d_type;};
43
void setType(int t){d_type = t;};
45
QwtDoubleRect boundingRect() const;
51
class DataCurve: public PlotCurve
55
DataCurve(Table *t, const QString& xColName, const char *name, int startRow = 0, int endRow = -1);
57
QString xColumnName(){return d_x_column;};
58
void setXColumnName(const QString& name){d_x_column = name;};
60
QString yColumnName() { return title().text(); }
61
void setYColumnName(const QString& name) { setTitle(name); }
63
Table* table(){return d_table;};
65
int startRow(){return d_start_row;};
66
int endRow(){return d_end_row;};
67
void setRowRange(int startRow, int endRow);
72
virtual bool updateData(Table *t, const QString& colName);
73
virtual void loadData();
75
//! Returns the row index in the data source table corresponding to the data point index.
76
int tableRow(int point);
81
* \brief A list of data sources for this curve.
83
* Elements must be in either of the following forms:
84
* - <id of X column> "(X)," <id of Y column> "(Y)" [ "," <id of error column> ("(xErr)" | "(yErr)") ]
85
* - <id of Xstart column> "(X)," <id of Ystart column>"(Y)," <id of Xend column> "(X)," <id of Yend column> "(Y)"\n
86
* (denoting start and end coordinates for the #VectXYXY style)
87
* - <id of Xstart column> "(X)," <id of Ystart column> "(Y)," <id of angle column> "(A)," <id of magnitude column> "(M)"\n
88
* (denoting start coordinates, angle in radians and length for the #VectXYAM style)
90
* Column ids are of the form '<name of table> "_" <name of column>'.
92
virtual QString plotAssociation();
93
virtual void updateColumnNames(const QString& oldName, const QString& newName, bool updateTableName);
95
//! The list of attached error bars.
96
QList<DataCurve *> errorBarsList(){return d_error_bars;};
97
//! Adds a single error bars curve to the list of attached error bars.
98
void addErrorBars(DataCurve *c){if (c) d_error_bars << c;};
99
//! Remove a single error bars curve from the list of attached error bars.
100
void removeErrorBars(DataCurve *c);
101
//! Clears the list of attached error bars.
102
void clearErrorBars();
104
void setVisible(bool on);
106
bool hasSelectedLabels();
107
void setLabelsSelected(bool on = true);
110
//! List of the error bar curves associated to this curve.
111
QList <DataCurve *> d_error_bars;
112
//! The data source table.
114
//!\brief The name of the column used for abscissae values.
116
*The column name used for Y values is stored in title().text().
122
bool validCurveType();