0

I have a chart with 2 y-axes and I need to add vertical lines at some points those lines should start from y=0 and terminate at the maximum of the area (actually it doesn't matter if the line exceeds the area of the graph). If I use QLineSeries to collect the points where to draw, the points are connected and the result is something like this enter image description here

What can be another solution?

I've tried even to add some gap between points, but nothing.

PhaseSeries->append(curRec.Second, 0);
PhaseSeries->append(curRec.Second, 500);//maxValue for the phase to reach the upper side of the graph
PhaseSeries->append(QPointF(NAN, NAN));

EDIT: I've found a workaround that can be acceptable in my case:

PhaseSeries->append(curRec.Second, -500);
PhaseSeries->append(curRec.Second, 500);//maxValue for the phase to reach the upper side of the graph
PhaseSeries->append(curRec.Second, -500);

I know, it's not a super elegant solution, but it works.

  • It's been ages that I've used QtCharts myself, but if I remember correctly you have to create an individual line series for each vertical line you want to draw, because a line series is always connected. – chris_se Mar 06 '23 at 16:44
  • yeah, I tried to create separeted line series, but then it become more complex to menage when there are different graph to plot on the chart, and the number of lines is not fixed or even present. – Salvatore Villani Mar 08 '23 at 11:02

0 Answers0