diff --git a/qmlplugin/declarativechart.cpp b/qmlplugin/declarativechart.cpp index bcd42d4..f2ba366 100644 --- a/qmlplugin/declarativechart.cpp +++ b/qmlplugin/declarativechart.cpp @@ -7,8 +7,7 @@ DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) m_chart(new QChart(this)) { setFlag(QGraphicsItem::ItemHasNoContents, false); - m_chart->resize(QSize(height(), width())); - m_chart->setMargin(25); // TODO: should not be needed? +// m_chart->setMargin(50); // TODO: should not be needed? } DeclarativeChart::ChartTheme DeclarativeChart::theme() @@ -19,7 +18,8 @@ DeclarativeChart::ChartTheme DeclarativeChart::theme() void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - m_chart->resize(QSize(newGeometry.width(), newGeometry.height())); + if (newGeometry.isValid()) + m_chart->resize(newGeometry.width(), newGeometry.height()); } #include "moc_declarativechart.cpp" diff --git a/test/qmlchart/qml/qmlchart/main.qml b/test/qmlchart/qml/qmlchart/main.qml index 9d0daa0..4b43b8a 100644 --- a/test/qmlchart/qml/qmlchart/main.qml +++ b/test/qmlchart/qml/qmlchart/main.qml @@ -17,16 +17,16 @@ Rectangle { // labels: ["point1", "point2", "point3", "point4", "point5"] // datax: [2, 1.5, 3, 3, 3] // } - PieSeries { - name: "raspberry pie" - seriesLabels: ["point1", "point2", "point3", "point4", "point5"] - seriesData: [2, 1.5, 3, 3, 3] - } - ScatterSeries { - name: "scatter1" - datax: [2, 1.5, 3, 3, 3] - datay: [2, 1.5, 3, 3, 3] - } +// PieSeries { +// name: "raspberry pie" +// seriesLabels: ["point1", "point2", "point3", "point4", "point5"] +// seriesData: [2, 1.5, 3, 3, 3] +// } +// ScatterSeries { +// name: "scatter1" +// datax: [2, 1.5, 3, 3, 3] +// datay: [2, 1.5, 3, 3, 3] +// } // Series { // labels: ["point1", "point2", "point3", "point4", "point5"] // datax: [2, 1.5, 3, 3, 3]