Reputation: 25830
I want to Make the Line Graph like Below Image :
I've had a look at some Stackoverflow questions
such as How to Draw Line with Using Canvas, How To Draw Lines With Different Colors and so on. But I haven't been able to figure it how to do it myself.
Question :
I have an idea about what I could make with the AChartEngine Line Chart Graph
. I'm not sure, how possible is it to create a line graph with the AChartEngine
?
What are the alternatives to achieve the same result?
Any help would be highly appreciated.
Upvotes: 7
Views: 1546
Reputation: 21629
That is not difficult, you need to create a radial gradient paint with the center in the middle of the curve. Then in colors[] you add as many colors as you want. For positions you can set to null, then the colors will be evenly distributed.
myPaint.setShader(new RadialGradient(
float x, float y,
float radius,
int[] colors,
float[] positions,
Shader.TileMode tile));
Also you should apply this only when the path is formed; you will need to get path bounds with
RectF bounds = new RectF();
myPath.computeBounds(bounds, true);
Now you can easily find center and radius.
Upvotes: 2
Reputation: 32391
You can add several series of data, each one having a separate color.
Upvotes: 0