gtcompscientist / KelloCharts

Kotlin Charts/graphs library for Android compatible with API 21+, several chart types with support for scaling, scrolling and animations
Apache License 2.0
50 stars 6 forks source link

Line Graph #4

Closed joshvapeter closed 6 years ago

joshvapeter commented 6 years ago

Hello, Its really a good work. I have a question. I need to pull data from database and refresh the graph dynamically. I don't really need all the graphs only line graph works. The document is not enough here. I need some step by step document that will be helpful. Sample data is like below. My database is mysql or if you made video thats really helpful for lot of folks who is developing kotlin project.

09/01/18---1 09/02/18---2 09/03/18---3

gtcompscientist commented 6 years ago

Can you provide more of a description of what you're trying to accomplish with the dynamic data? How often you are refreshing?

joshvapeter commented 6 years ago

Thanks @gtcompscientist for your response. I am trying to plot the graph in the app. I am planning to refresh the data daily once around 10PM. I am trying to build an app for free to user community. The basic idea is how many people coming to church daily. Please let me know if you have any questions.

joshvapeter commented 6 years ago

image

gtcompscientist commented 6 years ago

This excerpt from the README is what you're looking for. The arrayListOf() line is where you would add/update the data. Convert the date to an Int/Long for the PointValue, and create a value formatter to properly show them as dates.

arrayListOf(PointValue(0, 2), PointValue(1, 4), PointValue(2, 3), PointValue(3, 4))

val line = Line(values, color = Color.BLUE, isCubic = true)
val lines = arrayListOf(line)

val data = LineChartData(lines)

val chart = LineChartView(context)
chart.lineChartData = data