Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Help adding callouts to chart lines



  • I've already got a project that automatically builds charts after selecting a folder full of .csv data. Now I want to be able provide X/Y values to the user for the lines on the chart. I've checked out the callout & zoomlineclient examples that ship with Qt but I don't really understand how to tackle this problem.

    My existing code uses a (ui) QMainWindow that contains a (_chart) QChart class that gets rendered via a (_chartView) QChartView in a like so:

        //_chart has already had multiple series added
        // to it and properties set at this point
        chartView = new QChartView(_chart);
        ui->chartLayout->addWidget(chartView,0,0);
        ui->chartLayout->update();
    

    I've been able to subclass the QChartview so that I can pickup MouseEvents but I'm really confused translating that callouts example use of a completely different classes QGraphicsView & QGraphicsScene.

    Any advice in general as how to proceed would be much appreciated.