title: How to add qml ScatterSeries to existing qml defined ChartView?
body: <p>I am trying to add series on demand to an existing ChartView defined in qml using python. I have found an example which shows how to do this in C++ (taken from <a href="https://doc.qt.io/archives/qt-5.11/qml-qtcharts-chartview.html#createSeries-method" rel="nofollow noreferrer">https://doc.qt.io/archives/qt-5.11/qml-qtcharts-chartview.html#createSeries-method</a>):</p>
  
  <pre><code>// lineSeries is a LineSeries object that has already been added to the ChartView; re-use its axes
  var myAxisX = chartView.axisX(lineSeries);
  var myAxisY = chartView.axisY(lineSeries);
  var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series", myAxisX, myAxisY);
  </code></pre>
  
  <p>But I can't find a way to do this in python. Here are some snippets from my attempt so far:</p>
  
  <p>QML snippet (which initially has just 1 scatter series):</p>
  
  <pre><code>        ChartView {
              id: bscan0
              ScatterSeries{
                  id: hits0
                  axisX: ValueAxis {
                      id: bscan0_xAxix
                      min: 0
                      max: 10
                  }
                  axisY: ValueAxis {
                      id: bscan0_yAxis
                      min: -105
                      max: 1
                  }
              }
  </code></pre>
  
  <p>QML js function to pass chartView to python so it can add another series:</p>
  
  <pre><code>dataModel.addChartSeries(bscan0, hits0)
  </code></pre>
  
  <p>Python snippet of addChartSeries:</p>
  
  <pre><code>    @Slot(QObject, QObject)
      def addChartSeries(self, chartView, chart_series):
          myAxisX = chartView.axisX(chart_series) # reuse the axis from existing series
          myAxisY = chartView.axisY(chart_series) # reuse the axis from existing series
  
  #         This function equivalent to the c++ one doesn't exit
  #         myChartSeries = chartView.createSeries(QtCharts.SeriesTypeScatter, "scatter series", myAxisX, myAxisY)
  
  #       So try another way:
          myChartSeries = QtCharts.QScatterSeries()
          myChartSeries.setName("scatter series")
          myChartSeries.attachAxis(myAxisX) 
          myChartSeries.attachAxis(myAxisY)
          myChartSeries.append(5, -10) 
          myChartSeries.append(5, -20) 
          myChartSeries.append(5, -30)
  
  #         Try to get chart from existing series. Doesn't work
  #         Error says that chart_series is not in a chart (it is!)
  #         myChart = chart_series.chart()
  # Series not in the chart. Please addSeries to chart first.
  
  #         Try to get chart from chartview passed across. Doesn't work
  #         Error says that object has no .chart attribute (same for .chart and .chart()):
  #         myChart = chartView.chart
  # Error: 'PySide2.QtQuick.QQuickItem' object has no attribute 'chart'
  
  #         It seems I must add series to chart like this, not to chartView, 
  #         but I can't find a way to get the chart for the chartView.
  #         myChart.addSeries(myChartSeries) 
  </code></pre>
  
  <p>The above python function is in my class "dataModel" which I pass to QML like this (the datamodel class works fine for lots of other things I do with it so no problem there):</p>
  
  <pre><code>    dataModel = DataModel()    
      self.rootContext().setContextProperty("dataModel", dataModel)
  
  </code></pre>