drawing line graph in android
I am in learning stage in android and my application requirement is to draw a line graph using data provided by the user. I am trying it from 2 days but didn't found any perfect solution.The data provided by the user will be
- A list of 开发者_高级运维(x,y) co-ordinates
- Title of the graph
- X-axis label and Y-axis label
- Background color and foreground color
I read many posts on this topic but did not understand how to implement those Chart API in my application. I want only single line chart not a series of line chart. please help me with example...
This library might help: http://android.arnodenhond.com/components/graphview seems like you want the simple line chart (2nd picture).
I dont understand your question fully though. Do you want help to create your own View and drawing it or just find some library that will help you?
Making a class and extending it as a View will get you a canvas to do the drawing on if you want to draw simple lines by yourself. Read more about building custom components here: http://developer.android.com/guide/topics/ui/custom-components.html
I would make my own view, reference it in the activity and pass the data to it and after that calling invalidate on the view so it could draw the new data. Just simple drawLine seems to do the trick for you.
Go through [ This ] hope it will help you
精彩评论