KReport

KReportItemChart.h
1/* This file is part of the KDE project
2 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef KRCHARTDATA_H
19#define KRCHARTDATA_H
20
21#include <KDChartWidget>
22
23#include "KReportItemBase.h"
24#include "KReportData.h"
25
26namespace Scripting
27{
28class Chart;
29}
30
31/**
32*/
33class KReportItemChart : public KReportItemBase
34{
36public:
37 KReportItemChart();
38 explicit KReportItemChart(QDomNode *element);
39 ~KReportItemChart();
40
41 virtual QString typeName() const;
42
43 virtual int renderReportData(OROPage *page, OROSection *section, const QPointF &offset, KReportData *data, KReportScriptHandler *script);
44
45 KDChart::Widget *widget() {
46 return m_chartWidget;
47 }
48
49 /**
50 @brief Perform the query for the chart and set the charts data
51 */
52 void populateData();
53 void setConnection(const KReportData *c);
54
55 /**
56 @brief Set the value of a field from the master (report) data set
57 This data will be used when retrieving the data for the chart
58 as the values in a 'where' clause.
59 */
60 void setLinkData(QString, QVariant);
61
62 /**
63 @brief Return the list of master fields
64 The caller will use this to set the current value for each field
65 at that stage in the report
66 */
67 QStringList masterFields() const;
68
69 /**
70 @brief The chart object is a complex object that uses its own data source
71 @return true
72 */
73 virtual bool supportsSubQuery() const { return true; }
74
75protected:
76 KProperty * m_font;
77 KProperty * m_chartType;
78 KProperty * m_chartSubType;
79 KProperty * m_threeD;
80 KProperty * m_colorScheme;
81 KProperty * m_aa;
82 KProperty * m_xTitle;
83 KProperty * m_yTitle;
84
85 KProperty *m_backgroundColor;
86 KProperty *m_displayLegend;
87 KProperty *m_legendPosition;
88 KProperty *m_legendOrientation;
89
90 KProperty *m_linkMaster;
91 KProperty *m_linkChild;
92
93 KDChart::Widget *m_chartWidget;
94
95 void set3D(bool td);
96 void setAA(bool aa);
97 void setColorScheme(const QString &cs);
98 void setAxis(const QString &xa, const QString &ya);
99 void setBackgroundColor(const QColor&);
100 void setLegend(bool le, const QStringList &legends = QStringList());
101
102private:
103 virtual void createProperties();
104 const KReportData *m_reportData;
105
106 friend class Scripting::Chart;
107
108 QMap<QString, QVariant> m_links; //Map of field->value for child/master links
109
110};
111
112#endif
Base class for items that are drawn syncronously.
Represents a single page in a document and may contain zero or more OROPrimitive objects all of which...
Represents a single a single row in a document and may contain zero or more OROPrimitives.
Field item script interface.
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.