Hello. I'm trying to redraw chart with a new data and delete previous chart.
So here is my code.

Qt Code:
  1. QChart *oldSignalData = signalView->chart();
  2.  
  3. signalData = new QChart();
  4. signalData->legend()->hide();
  5. signalData->addSeries(signalSamples);
  6. signalData->createDefaultAxes();
  7. signalData->setTitle(comboTests->currentText());
  8. signalView->setChart(signalData);
  9.  
  10. if(NULL != oldSignalData){
  11. delete oldSignalData;
  12. }
To copy to clipboard, switch view to plain text mode 

But when i putting a new QChart on a same QChartView - it fails with a message "Can not find axis on the chart."
This code works fine if i comment "delete oldSignalData;" string, but it causes memory leaks. What is the correct
way to delete previous chart and do not crush QChartView? Thanks.
Qt version - 5.8.0.