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

Vertical line on QChartView



  • I have a QChartView containing several series and I would like to add two vertical lines.

    Here is the sample code.
    I guess that since the x point is the same, it won't display. Is there a workaround ?

    QChart *chart = new QChart();
    
    // Adding some series
    chart->addSeries(Series1);
    chart->addSeries(Series2);
    // Series1 and Series2 display properly
    
    // Trying to add one vertical line
    QLineSeries* VerticalSeries = new QLineSeries();
    VerticalSeries ->append(1.0, -10.0);
    VerticalSeries ->append(1.0, 10.0);
    
    chart->addSeries(VerticalSeries);
    

Log in to reply