7

I want to draw a chart for a function y=x^2 as follows:

enter image description here

but the curve is not smooth as it is a set of connected lines.

how can I make the curve smoother ?

thanks

Reno
  • 33,594
  • 11
  • 89
  • 102
Mina Wissa
  • 10,923
  • 13
  • 90
  • 158

1 Answers1

9

You should use Path.quadTo with only one Path. If you are already doing this then I suggest increasing the number of points on the graph.

Move to the beginning of the Path:

Path.moveTo(x, y)

in the middle:

Path.quadTo(lastX, lastY, (x + lastX)/2, (y + lastY)/2)

and at the end:

Path.lineTo(x, y)
Che Jami
  • 5,151
  • 2
  • 21
  • 18