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.
On the Format tab, in the Current Selection group, click Format Selection. tab, expand Fill, and then do one of the following: To vary the colors of data markers in a single-series chart, select the Vary colors by point check box.
Change the color of a line Select the line that you want to change. If you want to change multiple lines, select the first line, and then press and hold CTRL while you select the other lines. On the Format tab, click the arrow next to Shape Outline, and then click the color that you want.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With