How to draw curve with arc?
-
wrote on 10 Jun 2021, 14:19 last edited by
Hi All,
I'm sharing the code, Using this code drawing half circle(curve ) how to add arrow at the end of this curve ?
Or is there other way to draw curve with direction/arrow. but I'm drawing this curve inside the circle so i think using radius its better way.
CHPlotCurve--derived from QwtPlotCurve class
CHPlotGraph2D-2D Graph derived from QwtPlotfor (int irows = 0, maxI = table1->rowCount(); irows < maxI; ++irows) { double x1 = table1->data(table1->index(irows, 1)).toDouble(&ok1); double y1 = table1->data(table1->index(irows, 2)).toDouble(&ok2); QVector <double> ax,ay; for (double angle = 0; angle <= 3.2; angle += 0.00314) { double ax1 = x1 + (r / 2) * cos(angle); double ay1 = y1 + (r / 2) * sin(angle); ax.append(ax1); ay.append(ay1); CHPlotCurve* arc = (CHPlotCurve*)pGr->insertCurve("arc", CHPlotGraph2D::Line, false); arc->setSamples(ax, ay); arc->setPen(Qt::blue); }
Thankyou. Your answers are welcome
-
wrote on 17 Jun 2021, 14:41 last edited by
@n-2204 https://www.w3schools.com/code/tryit.asp?filename=GRLN84LQBK8O if I understood correctly what you wanted, then rate it
-
wrote on 11 Jun 2021, 09:54 last edited by
-
wrote on 16 Jun 2021, 10:02 last edited by
Can anyone suggest something? refer any examples/link
-
Hi
Since you are using a QwtPlotCurve as base, i think you have to
override
https://qwt.sourceforge.io/class_qwt_plot_curve.html#a2307196a17121dc72c2c88a0c5a46dc7and draw it your self.
I think not QWT offers this out of the box but its not an official Qt Module so I dont know it that well.
-
wrote on 17 Jun 2021, 14:41 last edited by
@n-2204 https://www.w3schools.com/code/tryit.asp?filename=GRLN84LQBK8O if I understood correctly what you wanted, then rate it