From 12a2900c59b3aea1ccbb3562cd8b0f193187852d 2012-07-05 07:50:56 From: Marek Rosa Date: 2012-07-05 07:50:56 Subject: [PATCH] F1 qml example fixed --- diff --git a/demos/dynamicspline/chart.cpp b/demos/dynamicspline/chart.cpp index d3e52f4..de7bdf7 100644 --- a/demos/dynamicspline/chart.cpp +++ b/demos/dynamicspline/chart.cpp @@ -25,10 +25,11 @@ #include #include -Chart::Chart(QGraphicsItem *parent, Qt::WindowFlags wFlags) - :QChart(parent, wFlags), - m_step(0), +Chart::Chart(QGraphicsItem *parent, Qt::WindowFlags wFlags): + QChart(parent, wFlags), + m_series(0), m_axis(new QValuesAxis), + m_step(0), m_x(5), m_y(1) { diff --git a/demos/qmlf1legends/qml/qmlf1legends/main.qml b/demos/qmlf1legends/qml/qmlf1legends/main.qml index 5984e00..49d0742 100644 --- a/demos/qmlf1legends/qml/qmlf1legends/main.qml +++ b/demos/qmlf1legends/qml/qmlf1legends/main.qml @@ -64,26 +64,27 @@ Rectangle { if (!lineSeries) lineSeries = chartView.createSeries(ChartView.SeriesTypeLine, speedsXml.get(currentIndex).driver); - // after the series has been created set the axes ranges. if (currentIndex < 3) { - chartView.axisY.min = 0; - chartView.axisY.max = 250 + chartView.createDefaultAxes(); + chartView.axisY(lineSeries).min = 0; + chartView.axisY(lineSeries).max = 250 } lineSeries.append(currentIndex, speedsXml.get(currentIndex).speed); // Make the x-axis range dynamic if (currentIndex > 9) - chartView.axisX.min = currentIndex - 10; + chartView.axisX(lineSeries).min = currentIndex - 10; else - chartView.axisX.min = 0; - chartView.axisX.max = currentIndex + 1; + chartView.axisX(lineSeries).min = 0; + + chartView.axisX(lineSeries).max = currentIndex + 1; } else { // No more data, change x-axis range to show all the data timer.stop(); chartView.animationOptions = ChartView.AllAnimations; - chartView.axisX.min = 0; - chartView.axisX.max = currentIndex + 1; + chartView.axisX(lineSeries).min = 0; + chartView.axisX(lineSeries).max = currentIndex + 1; } } } diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp index 1de2a76..441f379 100644 --- a/plugins/declarative/declarativechart.cpp +++ b/plugins/declarative/declarativechart.cpp @@ -492,7 +492,6 @@ QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType typ } series->setName(name); m_chart->addSeries(series); - m_chart->createDefaultAxes(); return series; }