Android graphics: a path with smooth curves?

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

enter image description here

but the curve is not smooth, since it is a collection of connected lines.

How to make the curve smoother?

thank

+5
source share
1 answer

You should use Path.quadTowith only one Path. If you are already doing this, I suggest increasing the number of points on the chart.

Move to the beginning Path:

Path.moveTo(x, y)

in the middle:

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

and in the end:

Path.lineTo(x, y)
+7
source

All Articles