title: Dynamic chart allocation QML with cpp
body: <p>I have a series of data approx 722 values and I want to plot this data using qml and cpp.
  How do I dynamically change the values of x and y axis for line charts ? and how do I append the data ?</p>
  <p>I went through the oscilloscope example but it uses a viewer and I am writing a code for the already made GUI can some please help me out ?</p>
  <p>QML part:</p>
  <pre><code>    import QtQuick 2.0
      import QtCharts 2.0
      import QtQml 2.2
  
      Item {
          id: valueDisp
          implicitWidth: 640
          implicitHeight: 640
          property int currentIndex: -1
  
          ChartView {
              id: chartView
              title: &quot;Data Output&quot;
              anchors.fill: parent
              legend.visible: false
              antialiasing: true
          }
  
          Timer {
              id: refreshTimer
              interval: 500 // 60 Hz
              running: componentData.dataUpdated();
              repeat: true
              onTriggered: {
                  var lineSeries = chartView.series(&quot;Data Output&quot;)
                  //var x_limit= componentData.dataReadX(currentIndex)
                  var i = 0
                  console.log(&quot;currentIndex;: &quot; + currentIndex)
                  if (currentIndex &lt;= 0) {
                      lineSeries = chartView.createSeries(ChartView.SeriesTypeLine, &quot;Data Output&quot;)
                      chartView.axisY().min = 0;
                      chartView.axisY().max = 100;
                      chartView.axisX().min = 0;
                      chartView.axisX().max = 100;
                      chartView.axisY().tickCount = 6;
                      chartView.axisY().titleText = &quot;value&quot;;
                      chartView.axisX().titleText = &quot;Iteration&quot;;
                      chartView.axisX().labelFormat = &quot;%.0f&quot;;
                      currentIndex++;
                  }
  
                  lineSeries.append(componentData.dataReadX(currentIndex), componentData.dataReadY(currentIndex));
                  currentIndex++;
  
              }
          }
      }
  </code></pre>
  <p>PS- <code>componentData</code> is an object to access my cpp Q_INVOKABLE functions. I figured out how to pass the data but I am stuck with activating the timer does it need OpenGL as well with it if yes, then how can I activate it ?</p>