MPAndroidChart
MPAndroidChart copied to clipboard
Does this library has built-in support to plot graph for days, weeks, months and years break down of input data.
Does this library has built-in support to plot graph for days, weeks, months and years break down of input data. Can we create graphs with daily, weekly, monthly and yearly tabs using this library ? I can't find graph with tabs in the demo app available in play store.
No buildin support. But you can achieve it easily. Stackoverflow is your friend
No buildin support. But you can achieve it easily. Stackoverflow is your friend
Could not find any references in stack overflow
Not that there is answer on stackoverflow, but you can find how to plot by day/week/month/year, etc. For example
private val priceWeeks: ArrayList<String> = ArrayList()
private val weekFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("MM-dd-yyyy")
inner class XFormatter : IAxisValueFormatter {
override fun getFormattedValue(value: Float, axis: AxisBase?): String {
val x = if(value.toInt() > 0) value.toInt() else 0
return priceWeeks[x]
}
}
...
for(n in 0..51){
val wkDate = priceDate.plusDays((-7 * n).toLong())
priceWeeks.add(0, wkDate.format(weekFormatter))
}
...
Would make labels for the past year and display them on the X-Axis in ascending order. You can do similar to format the date by day, year, etc and display whatever number of values you need.
@cmy82, does the data need to be grouped up manually? Let's say I have one week data from sensor, which recorded the data every 1 minute (that is 10080 records). If I want to show hourly data, do I need to manually group up those those values to have a list of 24 values (corresponding to hours from 0 to 23)? Or this can be achieved in a better way using this library? Thanks.