|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,12 +1,42 | |||
|
1 | 1 | /*! |
|
2 | 2 | \page index.html |
|
3 | 3 | \title About QCharts |
|
4 | 4 | \keyword About |
|
5 | 5 | |
|
6 |
|
|
|
6 | \raw HTML | |
|
7 | 7 | <div class="qchart"> |
|
8 | 8 | <img src="images/qt_commercial_logo.png" alt="qtcommercial"/> |
|
9 | <p>QCharts is a part of Qt Commercial addons package.</p> | |
|
9 | <p>QCharts is a part of Qt Commercial addons package. TODO: Introduction... With QCharts you can easily create impressive graphs of your data in Qt and QtQuick applications...</p> | |
|
10 | 10 | </div> |
|
11 | \endraw | |
|
12 | ||
|
13 | For example, to create a chart with line series using a widget based application (TODO: decent screen shots): | |
|
14 | ||
|
15 | \snippet ../example/chartview/main.cpp 1 | |
|
16 | \image chartview_example.jpg | |
|
17 | ||
|
18 | \raw HTML | |
|
19 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> | |
|
20 | <tr> | |
|
21 | <th class="titleheader" width="33%"> | |
|
22 | List of classes | |
|
23 | </th> | |
|
24 | </tr> | |
|
25 | <tr> | |
|
26 | <td valign="top"> | |
|
27 | <ul> | |
|
28 | <li><a href="qchart.html">QChart</a></li> | |
|
29 | <li><a href="qchartview.html">QChartView</a></li> | |
|
30 | <li><a href="qchartseries.html">QChartSeries</a></li> | |
|
31 | <li><a href="qlinechartseries.html">QLineChartSeries</a></li> | |
|
32 | <li><a href="qpieseries.html">QPieSeries</a></li> | |
|
33 | <li><a href="qbarchartseries.html">QBarChartSeries</a></li> | |
|
34 | <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li> | |
|
35 | <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li> | |
|
36 | <li><a href="qscatterseries.html">QScatterSeries</a></li> | |
|
37 | </ul> | |
|
38 | </td> | |
|
39 | </tr> | |
|
40 | </table> | |
|
11 | 41 | \endraw |
|
12 | 42 | */ |
@@ -1,24 +1,26 | |||
|
1 | 1 | /*! |
|
2 | 2 | \page tutorials.html |
|
3 | 3 | \title Tutorials |
|
4 | 4 | \keyword Tutorials |
|
5 | 5 | |
|
6 | QtCommercial Charts introduction... | |
|
7 | 6 | For example, to create a chart with line series using a widget based application: |
|
8 | 7 | \snippet ../example/chartview/main.cpp 1 |
|
9 | 8 | \image chartview_example.jpg |
|
10 | 9 | |
|
11 | Showing a few more series: | |
|
10 | To replace the line series with a pie series you use the dedicated QPieSeries class: | |
|
12 | 11 | \snippet ../example/chartview/main.cpp 3 |
|
13 | 12 | \image chartview_example_pie.jpg |
|
13 | ||
|
14 | To use a scatter series you use QScatterSeries class: | |
|
14 | 15 | \snippet ../example/chartview/main.cpp 4 |
|
15 | 16 | \image chartview_example_scatter.jpg |
|
17 | ||
|
18 | And to show a bar series you use one of the bar series classes, for example QBarChartSeries: | |
|
16 | 19 | \snippet ../example/chartview/main.cpp 5 |
|
17 | 20 | \image chartview_example_bar.jpg |
|
18 | 21 | |
|
19 |
If you need to give a more professional touch to your chart you can switch |
|
|
20 | pre-defined themes: | |
|
22 | If you need to give a more professional touch to your chart you can switch from the default | |
|
23 | theme to one of the other themes: | |
|
21 | 24 | \snippet ../example/chartview/main.cpp 2 |
|
22 | 25 | \image chartview_example_theme.jpg |
|
23 | ||
|
24 | 26 | */ |
@@ -1,73 +1,77 | |||
|
1 | 1 | #include <QtGui/QApplication> |
|
2 | 2 | #include <QMainWindow> |
|
3 | 3 | #include <qchartglobal.h> |
|
4 | 4 | #include <qchartview.h> |
|
5 | 5 | #include <qlinechartseries.h> |
|
6 | 6 | #include <qscatterseries.h> |
|
7 | 7 | #include <qbarchartseries.h> |
|
8 | 8 | #include <qbarset.h> |
|
9 | 9 | #include <qbarcategory.h> |
|
10 | 10 | #include <qpieseries.h> |
|
11 | 11 | |
|
12 | 12 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
13 | 13 | |
|
14 | 14 | int main(int argc, char *argv[]) |
|
15 | 15 | { |
|
16 | 16 | QApplication a(argc, argv); |
|
17 | 17 | |
|
18 | 18 | //! [1] |
|
19 | 19 | // Create chart view |
|
20 | 20 | QChartView *chartView = new QChartView(); |
|
21 | chartView->setRenderHint(QPainter::Antialiasing); | |
|
21 | 22 | // Add series to the chart |
|
22 | 23 | QLineChartSeries *line = new QLineChartSeries(); |
|
23 | 24 | line->add(0.0, 0.8); |
|
24 | 25 | line->add(1.1, 1.1); |
|
25 | 26 | line->add(2.0, 2.5); |
|
26 | 27 | chartView->addSeries(line); |
|
27 | 28 | //! [1] |
|
28 | 29 | |
|
29 | 30 | //! [2] |
|
30 | 31 | // Change theme |
|
31 | 32 | chartView->setChartTheme(QChart::ChartThemeScientific); |
|
32 | 33 | //! [2] |
|
33 | 34 | |
|
34 | 35 | //! [3] |
|
35 | 36 | // Add pie series |
|
37 | // ... | |
|
36 | 38 | QPieSeries *pie = new QPieSeries(); |
|
37 | 39 | pie->add(3.4, "slice1"); |
|
38 | 40 | pie->add(6.7, "slice2"); |
|
39 | 41 | chartView->addSeries(pie); |
|
40 | 42 | //! [3] |
|
41 | 43 | |
|
42 | 44 | //! [4] |
|
43 | 45 | // Add scatter series |
|
46 | // ... | |
|
44 | 47 | QScatterSeries *scatter = new QScatterSeries(); |
|
45 | 48 | for (qreal x(0); x < 100; x += 0.5) { |
|
46 | 49 | qreal y = rand() % 100; |
|
47 | 50 | *(scatter) << QPointF(x, y); |
|
48 | 51 | } |
|
49 | 52 | chartView->addSeries(scatter); |
|
50 | 53 | //! [4] |
|
51 | 54 | |
|
52 | 55 | //! [5] |
|
56 | // ... | |
|
53 | 57 | // Add bar series |
|
54 | 58 | QBarCategory *barCategory = new QBarCategory(); |
|
55 | 59 | *barCategory << "Jan" |
|
56 | 60 | << "Feb" |
|
57 | 61 | << "Mar"; |
|
58 | 62 | QBarChartSeries *bar = new QBarChartSeries(barCategory); |
|
59 | 63 | QBarSet *barSet = new QBarSet("Sales"); |
|
60 | 64 | *barSet << 123.2 |
|
61 | 65 | << 301.3 |
|
62 | 66 | << 285.8; |
|
63 | 67 | bar->addBarSet(barSet); |
|
64 | 68 | chartView->addSeries(bar); |
|
65 | 69 | //! [5] |
|
66 | 70 | |
|
67 | 71 | QMainWindow w; |
|
68 |
w.resize(3 |
|
|
72 | w.resize(380, 250); | |
|
69 | 73 | w.setCentralWidget(chartView); |
|
70 | 74 | w.show(); |
|
71 | 75 | |
|
72 | 76 | return a.exec(); |
|
73 | 77 | } |
@@ -1,368 +1,351 | |||
|
1 | 1 | #include "qchartview.h" |
|
2 | 2 | #include "qchart.h" |
|
3 | 3 | #include "qchartaxis.h" |
|
4 | 4 | #include <QGraphicsView> |
|
5 | 5 | #include <QGraphicsScene> |
|
6 | 6 | #include <QRubberBand> |
|
7 | 7 | #include <QResizeEvent> |
|
8 | 8 | #include <QDebug> |
|
9 | 9 | |
|
10 | 10 | /*! |
|
11 | 11 | \enum QChartView::RubberBandPolicy |
|
12 | 12 | |
|
13 | 13 | This enum describes the different types of rubber bands that can be used for zoom rect selection |
|
14 | 14 | |
|
15 | 15 | \value NoRubberBand |
|
16 | 16 | \value VerticalRubberBand |
|
17 | 17 | \value HorizonalRubberBand |
|
18 | 18 | \value RectangleRubberBand |
|
19 | 19 | */ |
|
20 | 20 | |
|
21 | 21 | /*! |
|
22 | 22 | \class QChartView |
|
23 | 23 | \brief Standalone charting widget. |
|
24 | 24 | |
|
25 | 25 | QChartView is a standalone widget that can display charts. It does not require separate |
|
26 | 26 | QGraphicsScene to work. It manages the graphical representation of different types of |
|
27 | 27 | QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to |
|
28 | 28 | display a chart in your existing QGraphicsScene, you can use the QChart class instead. |
|
29 | 29 | |
|
30 | For example, to create a chart with line series using a widget based application: | |
|
31 | \snippet ../example/chartview/main.cpp 1 | |
|
32 | \image chartview_example.jpg | |
|
33 | ||
|
34 | Showing a few more series: | |
|
35 | \snippet ../example/chartview/main.cpp 3 | |
|
36 | \image chartview_example_pie.jpg | |
|
37 | \snippet ../example/chartview/main.cpp 4 | |
|
38 | \image chartview_example_scatter.jpg | |
|
39 | \snippet ../example/chartview/main.cpp 5 | |
|
40 | \image chartview_example_bar.jpg | |
|
41 | ||
|
42 | If you need to give a more professional touch to your chart you can switch to one of the | |
|
43 | pre-defined themes: | |
|
44 | \snippet ../example/chartview/main.cpp 2 | |
|
45 | \image chartview_example_theme.jpg | |
|
46 | ||
|
47 | 30 | \sa QChart |
|
48 | 31 | */ |
|
49 | 32 | |
|
50 | 33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
51 | 34 | |
|
52 | 35 | /*! |
|
53 | 36 | Constructs a chartView object which is a child of a\a parent. |
|
54 | 37 | */ |
|
55 | 38 | QChartView::QChartView(QWidget *parent) : |
|
56 | 39 | QGraphicsView(parent), |
|
57 | 40 | m_scene(new QGraphicsScene(this)), |
|
58 | 41 | m_chart(new QChart()), |
|
59 | 42 | m_rubberBand(0), |
|
60 | 43 | m_verticalRubberBand(false), |
|
61 | 44 | m_horizonalRubberBand(false) |
|
62 | 45 | { |
|
63 | 46 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
64 | 47 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
65 | 48 | setScene(m_scene); |
|
66 | 49 | m_chart->setMargin(50); |
|
67 | 50 | m_scene->addItem(m_chart); |
|
68 | 51 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
69 | 52 | } |
|
70 | 53 | |
|
71 | 54 | |
|
72 | 55 | /*! |
|
73 | 56 | Destroys the object and it's children, like QChartSeries and QChartAxis object added to it. |
|
74 | 57 | */ |
|
75 | 58 | QChartView::~QChartView() |
|
76 | 59 | { |
|
77 | 60 | } |
|
78 | 61 | |
|
79 | 62 | /*! |
|
80 | 63 | Resizes and updates the chart area using the \a event data |
|
81 | 64 | */ |
|
82 | 65 | void QChartView::resizeEvent(QResizeEvent *event) |
|
83 | 66 | { |
|
84 | 67 | m_scene->setSceneRect(0,0,size().width(),size().height()); |
|
85 | 68 | m_chart->resize(size()); |
|
86 | 69 | QWidget::resizeEvent(event); |
|
87 | 70 | } |
|
88 | 71 | |
|
89 | 72 | /*! |
|
90 | 73 | Adds the \a series and optional \a axisY onto the chart and takes the ownership of the objects. |
|
91 | 74 | If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and |
|
92 | 75 | the y axis). |
|
93 | 76 | \sa removeSeries(), removeAllSeries() |
|
94 | 77 | */ |
|
95 | 78 | void QChartView::addSeries(QChartSeries* series,QChartAxis *axisY) |
|
96 | 79 | { |
|
97 | 80 | m_chart->addSeries(series,axisY); |
|
98 | 81 | } |
|
99 | 82 | |
|
100 | 83 | /*! |
|
101 | 84 | Removes the \a series specified in a perameter from the QChartView. |
|
102 | 85 | It releses its ownership of the specified QChartSeries object. |
|
103 | 86 | It does not delete the pointed QChartSeries data object |
|
104 | 87 | \sa addSeries(), removeAllSeries() |
|
105 | 88 | */ |
|
106 | 89 | void QChartView::removeSeries(QChartSeries* series) |
|
107 | 90 | { |
|
108 | 91 | m_chart->removeSeries(series); |
|
109 | 92 | } |
|
110 | 93 | |
|
111 | 94 | /*! |
|
112 | 95 | Removes all the QChartSeries that have been added to the QChartView |
|
113 | 96 | It also deletes the pointed QChartSeries data objects |
|
114 | 97 | \sa addSeries(), removeSeries() |
|
115 | 98 | */ |
|
116 | 99 | void QChartView::removeAllSeries() |
|
117 | 100 | { |
|
118 | 101 | m_chart->removeAllSeries(); |
|
119 | 102 | } |
|
120 | 103 | |
|
121 | 104 | /*! |
|
122 | 105 | Zooms in the view by a factor of 2 |
|
123 | 106 | */ |
|
124 | 107 | void QChartView::zoomIn() |
|
125 | 108 | { |
|
126 | 109 | m_chart->zoomIn(); |
|
127 | 110 | } |
|
128 | 111 | |
|
129 | 112 | /*! |
|
130 | 113 | Zooms in the view to a maximum level at which \a rect is still fully visible. |
|
131 | 114 | */ |
|
132 | 115 | void QChartView::zoomIn(const QRect& rect) |
|
133 | 116 | { |
|
134 | 117 | m_chart->zoomIn(rect); |
|
135 | 118 | } |
|
136 | 119 | |
|
137 | 120 | /*! |
|
138 | 121 | Restores the view zoom level to the previous one. |
|
139 | 122 | */ |
|
140 | 123 | void QChartView::zoomOut() |
|
141 | 124 | { |
|
142 | 125 | m_chart->zoomOut(); |
|
143 | 126 | } |
|
144 | 127 | |
|
145 | 128 | /*! |
|
146 | 129 | Returns the chart margin, which is the distance between the widget edge and the part of the chart where the actual data can be displayed. |
|
147 | 130 | */ |
|
148 | 131 | int QChartView::margin() const |
|
149 | 132 | { |
|
150 | 133 | return m_chart->margin(); |
|
151 | 134 | } |
|
152 | 135 | |
|
153 | 136 | /*! |
|
154 | 137 | Sets the chart \a title. A description text that is rendered above the chart. |
|
155 | 138 | */ |
|
156 | 139 | void QChartView::setChartTitle(const QString& title) |
|
157 | 140 | { |
|
158 | 141 | m_chart->setChartTitle(title); |
|
159 | 142 | } |
|
160 | 143 | |
|
161 | 144 | /*! |
|
162 | 145 | Sets the \a font that is used for rendering the description text that is rendered above the chart. |
|
163 | 146 | */ |
|
164 | 147 | void QChartView::setChartTitleFont(const QFont& font) |
|
165 | 148 | { |
|
166 | 149 | m_chart->setChartTitleFont(font); |
|
167 | 150 | } |
|
168 | 151 | |
|
169 | 152 | /*! |
|
170 | 153 | Sets the \a brush that is used for painting the background of the chart area of the QChartView widget. |
|
171 | 154 | */ |
|
172 | 155 | void QChartView::setChartBackgroundBrush(const QBrush& brush) |
|
173 | 156 | { |
|
174 | 157 | m_chart->setChartBackgroundBrush(brush); |
|
175 | 158 | } |
|
176 | 159 | |
|
177 | 160 | /*! |
|
178 | 161 | Sets the \a pen that is used for painting the background of the chart area of the QChartView widget. |
|
179 | 162 | */ |
|
180 | 163 | void QChartView::setChartBackgroundPen(const QPen& pen) |
|
181 | 164 | { |
|
182 | 165 | m_chart->setChartBackgroundPen(pen); |
|
183 | 166 | } |
|
184 | 167 | |
|
185 | 168 | /*! |
|
186 | 169 | Sets the RubberBandPlicy to \a policy. Selected policy determines the way zooming is performed. |
|
187 | 170 | */ |
|
188 | 171 | void QChartView::setRubberBandPolicy(const RubberBandPolicy policy) |
|
189 | 172 | { |
|
190 | 173 | switch(policy) { |
|
191 | 174 | case VerticalRubberBand: |
|
192 | 175 | m_verticalRubberBand = true; |
|
193 | 176 | m_horizonalRubberBand = false; |
|
194 | 177 | break; |
|
195 | 178 | case HorizonalRubberBand: |
|
196 | 179 | m_verticalRubberBand = false; |
|
197 | 180 | m_horizonalRubberBand = true; |
|
198 | 181 | break; |
|
199 | 182 | case RectangleRubberBand: |
|
200 | 183 | m_verticalRubberBand = true; |
|
201 | 184 | m_horizonalRubberBand = true; |
|
202 | 185 | break; |
|
203 | 186 | case NoRubberBand: |
|
204 | 187 | default: |
|
205 | 188 | delete m_rubberBand; |
|
206 | 189 | m_rubberBand=0; |
|
207 | 190 | m_horizonalRubberBand = false; |
|
208 | 191 | m_verticalRubberBand = false; |
|
209 | 192 | return; |
|
210 | 193 | } |
|
211 | 194 | if(!m_rubberBand) { |
|
212 | 195 | m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this); |
|
213 | 196 | m_rubberBand->setEnabled(true); |
|
214 | 197 | } |
|
215 | 198 | } |
|
216 | 199 | |
|
217 | 200 | /*! |
|
218 | 201 | Returns the RubberBandPolicy that is currently being used by the widget. |
|
219 | 202 | */ |
|
220 | 203 | QChartView::RubberBandPolicy QChartView::rubberBandPolicy() const |
|
221 | 204 | { |
|
222 | 205 | if(m_horizonalRubberBand && m_verticalRubberBand) return RectangleRubberBand; |
|
223 | 206 | if(m_horizonalRubberBand) return HorizonalRubberBand; |
|
224 | 207 | if(m_verticalRubberBand) return VerticalRubberBand; |
|
225 | 208 | return NoRubberBand; |
|
226 | 209 | } |
|
227 | 210 | |
|
228 | 211 | /*! |
|
229 | 212 | If Left mouse button is pressed and the RubberBandPolicy is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area. |
|
230 | 213 | If different mouse button is pressed and/or the RubberBandPolicy is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation is called. |
|
231 | 214 | */ |
|
232 | 215 | void QChartView::mousePressEvent(QMouseEvent *event) |
|
233 | 216 | { |
|
234 | 217 | if(m_rubberBand && m_rubberBand->isEnabled() && event->button() == Qt::LeftButton) { |
|
235 | 218 | |
|
236 | 219 | int margin = m_chart->margin(); |
|
237 | 220 | QRect rect(margin, margin, width() - 2 * margin, height() - 2 * margin); |
|
238 | 221 | |
|
239 | 222 | if (rect.contains(event->pos())) { |
|
240 | 223 | m_rubberBandOrigin = event->pos(); |
|
241 | 224 | m_rubberBand->setGeometry(QRect(m_rubberBandOrigin, QSize())); |
|
242 | 225 | m_rubberBand->show(); |
|
243 | 226 | event->accept(); |
|
244 | 227 | } |
|
245 | 228 | } |
|
246 | 229 | else { |
|
247 | 230 | QGraphicsView::mousePressEvent(event); |
|
248 | 231 | } |
|
249 | 232 | } |
|
250 | 233 | |
|
251 | 234 | /*! |
|
252 | 235 | If RubberBand rectange specification has been initiated in pressEvent then \a event data is used to update RubberBand geometry. |
|
253 | 236 | In other case the defualt QGraphicsView::mouseMoveEvent implementation is called. |
|
254 | 237 | */ |
|
255 | 238 | void QChartView::mouseMoveEvent(QMouseEvent *event) |
|
256 | 239 | { |
|
257 | 240 | if(m_rubberBand && m_rubberBand->isVisible()) { |
|
258 | 241 | int margin = m_chart->margin(); |
|
259 | 242 | QRect rect(margin, margin, width() - 2 * margin, height() - 2 * margin); |
|
260 | 243 | int width = event->pos().x() - m_rubberBandOrigin.x(); |
|
261 | 244 | int height = event->pos().y() - m_rubberBandOrigin.y(); |
|
262 | 245 | if(!m_verticalRubberBand) { |
|
263 | 246 | m_rubberBandOrigin.setY(rect.top()); |
|
264 | 247 | height = rect.height(); |
|
265 | 248 | } |
|
266 | 249 | if(!m_horizonalRubberBand) { |
|
267 | 250 | m_rubberBandOrigin.setX(rect.left()); |
|
268 | 251 | width= rect.width(); |
|
269 | 252 | } |
|
270 | 253 | m_rubberBand->setGeometry(QRect(m_rubberBandOrigin.x(),m_rubberBandOrigin.y(), width,height).normalized()); |
|
271 | 254 | } |
|
272 | 255 | else { |
|
273 | 256 | QGraphicsView::mouseMoveEvent(event); |
|
274 | 257 | } |
|
275 | 258 | } |
|
276 | 259 | |
|
277 | 260 | /*! |
|
278 | 261 | If left mouse button is release and RubberBand is enabled then \a event is accepted and the view is zoomed in to rect specified by RubberBand |
|
279 | 262 | If it is the right mouse button \a event then RubberBand is dissmissed and zoom is canceled. |
|
280 | 263 | */ |
|
281 | 264 | void QChartView::mouseReleaseEvent(QMouseEvent *event) |
|
282 | 265 | { |
|
283 | 266 | if(m_rubberBand) { |
|
284 | 267 | if (event->button() == Qt::LeftButton && m_rubberBand->isVisible()) { |
|
285 | 268 | m_rubberBand->hide(); |
|
286 | 269 | QRect rect = m_rubberBand->geometry(); |
|
287 | 270 | m_chart->zoomIn(rect); |
|
288 | 271 | event->accept(); |
|
289 | 272 | } |
|
290 | 273 | |
|
291 | 274 | if(event->button()==Qt::RightButton) |
|
292 | 275 | m_chart->zoomReset(); |
|
293 | 276 | } |
|
294 | 277 | else { |
|
295 | 278 | QGraphicsView::mouseReleaseEvent(event); |
|
296 | 279 | } |
|
297 | 280 | } |
|
298 | 281 | |
|
299 | 282 | /*! |
|
300 | 283 | Pressing + and - keys performs zoomIn() and zoomOut() respectivly. |
|
301 | 284 | In other \a event is passed to the QGraphicsView::keyPressEvent() implementation |
|
302 | 285 | */ |
|
303 | 286 | void QChartView::keyPressEvent(QKeyEvent *event) |
|
304 | 287 | { |
|
305 | 288 | switch (event->key()) { |
|
306 | 289 | case Qt::Key_Plus: |
|
307 | 290 | zoomIn(); |
|
308 | 291 | break; |
|
309 | 292 | case Qt::Key_Minus: |
|
310 | 293 | zoomOut(); |
|
311 | 294 | break; |
|
312 | 295 | default: |
|
313 | 296 | QGraphicsView::keyPressEvent(event); |
|
314 | 297 | break; |
|
315 | 298 | } |
|
316 | 299 | } |
|
317 | 300 | |
|
318 | 301 | /*! |
|
319 | 302 | Sets the \a theme used by the chart for rendering the graphical representation of the data |
|
320 | 303 | \sa QChart::ChartTheme, chartTheme() |
|
321 | 304 | */ |
|
322 | 305 | void QChartView::setChartTheme(QChart::ChartTheme theme) |
|
323 | 306 | { |
|
324 | 307 | m_chart->setChartTheme(theme); |
|
325 | 308 | } |
|
326 | 309 | |
|
327 | 310 | /*! |
|
328 | 311 | Returns the theme enum used by the chart. |
|
329 | 312 | \sa setChartTheme() |
|
330 | 313 | */ |
|
331 | 314 | QChart::ChartTheme QChartView::chartTheme() const |
|
332 | 315 | { |
|
333 | 316 | return m_chart->chartTheme(); |
|
334 | 317 | } |
|
335 | 318 | |
|
336 | 319 | /*! |
|
337 | 320 | Returns the pointer to the x axis object of the chart |
|
338 | 321 | */ |
|
339 | 322 | QChartAxis* QChartView::axisX() const |
|
340 | 323 | { |
|
341 | 324 | return m_chart->axisX(); |
|
342 | 325 | } |
|
343 | 326 | |
|
344 | 327 | /*! |
|
345 | 328 | Returns the pointer to the y axis object of the chart |
|
346 | 329 | */ |
|
347 | 330 | QChartAxis* QChartView::axisY() const |
|
348 | 331 | { |
|
349 | 332 | return m_chart->axisY(); |
|
350 | 333 | } |
|
351 | 334 | |
|
352 | 335 | /*! |
|
353 | 336 | Sets animation \a options for the chart |
|
354 | 337 | */ |
|
355 | 338 | void QChartView::setAnimationOptions(QChart::AnimationOptions options) |
|
356 | 339 | { |
|
357 | 340 | m_chart->setAnimationOptions(options); |
|
358 | 341 | } |
|
359 | 342 | |
|
360 | 343 | /*! |
|
361 | 344 | Returns animation options for the chart |
|
362 | 345 | */ |
|
363 | 346 | QChart::AnimationOptions QChartView::animationOptions() const |
|
364 | 347 | { |
|
365 | 348 | return m_chart->animationOptions(); |
|
366 | 349 | } |
|
367 | 350 | |
|
368 | 351 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now