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,246
  • 11
  • 86
  • 101
Mina Wissa
  • 10,782
  • 13
  • 91
  • 153

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,121
  • 2
  • 19
  • 18