@@ -1,27 +1,27 | |||
|
1 | 1 | #include "declarativechart.h" |
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | 5 | DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) |
|
6 | 6 | : QDeclarativeItem(parent), |
|
7 | 7 | m_chart(new QChart(this)) |
|
8 | 8 | { |
|
9 | 9 | setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
10 | m_chart->resize(QSize(height(), width())); | |
|
11 | m_chart->setMargin(25); // TODO: should not be needed? | |
|
10 | // m_chart->setMargin(50); // TODO: should not be needed? | |
|
12 | 11 | } |
|
13 | 12 | |
|
14 | 13 | DeclarativeChart::ChartTheme DeclarativeChart::theme() |
|
15 | 14 | { |
|
16 | 15 | if (m_chart) |
|
17 | 16 | return (ChartTheme) m_chart->chartTheme(); |
|
18 | 17 | } |
|
19 | 18 | |
|
20 | 19 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
21 | 20 | { |
|
22 | m_chart->resize(QSize(newGeometry.width(), newGeometry.height())); | |
|
21 | if (newGeometry.isValid()) | |
|
22 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
|
23 | 23 | } |
|
24 | 24 | |
|
25 | 25 | #include "moc_declarativechart.cpp" |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,46 +1,46 | |||
|
1 | 1 | import QtQuick 1.0 |
|
2 | 2 | import QtCommercial.Chart 1.0 |
|
3 | 3 | |
|
4 | 4 | Rectangle { |
|
5 | 5 | width: 360 |
|
6 | 6 | height: 360 |
|
7 | 7 | Text { |
|
8 | 8 | text: qsTr("Hello World") |
|
9 | 9 | anchors.centerIn: parent |
|
10 | 10 | } |
|
11 | 11 | |
|
12 | 12 | Chart { |
|
13 | 13 | anchors.fill: parent |
|
14 | 14 | theme: Chart.ThemeIcy |
|
15 | 15 | |
|
16 | 16 | // PieSeries { |
|
17 | 17 | // labels: ["point1", "point2", "point3", "point4", "point5"] |
|
18 | 18 | // datax: [2, 1.5, 3, 3, 3] |
|
19 | 19 | // } |
|
20 | PieSeries { | |
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
20 | // PieSeries { | |
|
21 | // name: "raspberry pie" | |
|
22 | // seriesLabels: ["point1", "point2", "point3", "point4", "point5"] | |
|
23 | // seriesData: [2, 1.5, 3, 3, 3] | |
|
24 | // } | |
|
25 | // ScatterSeries { | |
|
26 | // name: "scatter1" | |
|
27 | // datax: [2, 1.5, 3, 3, 3] | |
|
28 | // datay: [2, 1.5, 3, 3, 3] | |
|
29 | // } | |
|
30 | 30 |
|
|
31 | 31 | // labels: ["point1", "point2", "point3", "point4", "point5"] |
|
32 | 32 | // datax: [2, 1.5, 3, 3, 3] |
|
33 | 33 | // seriesType: Series.SeriesTypePie |
|
34 | 34 | // } |
|
35 | 35 | Series { |
|
36 | 36 | seriesType: Series.SeriesTypeScatter |
|
37 | 37 | } |
|
38 | 38 | Series { |
|
39 | 39 | seriesType: Series.SeriesTypeLine |
|
40 | 40 | } |
|
41 | 41 | // TODO: |
|
42 | 42 | // Series { |
|
43 | 43 | // seriesType: Series.SeriesTypeBar |
|
44 | 44 | // } |
|
45 | 45 | } |
|
46 | 46 | } |
General Comments 0
You need to be logged in to leave comments.
Login now