diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp index e358243..60f9dc3 100644 --- a/plugins/declarative/declarativechart.cpp +++ b/plugins/declarative/declarativechart.cpp @@ -262,7 +262,11 @@ void DeclarativeChart::componentComplete() { foreach(QObject *child, children()) { if (qobject_cast(child)) { - m_chart->addSeries(qobject_cast(child)); + // Add series to the chart + QAbstractSeries *series = qobject_cast(child); + m_chart->addSeries(series); + + // Set optional user defined axes and connect axis related signals if (qobject_cast(child)) { DeclarativeLineSeries *s = qobject_cast(child); connect(s, SIGNAL(axisXChanged(QAbstractAxis *)), this, SLOT(handleAxisXSet(QAbstractAxis *))); @@ -324,15 +328,14 @@ void DeclarativeChart::componentComplete() setAxisX(s->axisX(), s); setAxisY(s->axisY(), s); } + + // Create the missing axes for the series that cannot be painted without axes + createDefaultAxes(series); } else if(qobject_cast(child)) { // Do nothing, axes are set for the chart in the context of series } } - // Create the missing axes for the series that cannot be painted without axes - foreach(QAbstractSeries *series, m_chart->series()) - createDefaultAxes(series); - QDeclarativeItem::componentComplete(); }