MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Data reduction issue - data has been down sampling when render with LineChart

Open yangdong opened this issue 8 years ago • 4 comments

I am using LineChart to display time based data collected from somewhere every 5 seconds on a daily basis, which means my chart will be maximum about 17000+ points.

However, I found LineChart won't render the whole points, instead, it will down sample my data to about 2 minutes, and the entry still don't render after I zoom in the chart.

I've go through the MPAndroidChart docs and your examples, but no luck, and I think this may related to #7 .

image

yangdong avatar Jan 30 '18 10:01 yangdong

Perhaps using axis.setGranularityEnabled(true) and axis.setGranularity will help. Also chart.setVisibleXRange to something smaller than the full dataset. Showing less data and allowing it to scroll could also help.

JStav avatar Jan 30 '18 14:01 JStav

@JStav thanks for your reply. I think I might found the issue.

Having Issue If: My data is time series data, value of x is unix timestamp new Date().getTime(), and then I use date valueFormatter to format the xAxis to date.

No Issue if Update the x value to a smaller number Date().getTime() - ${unixtimeOfStartOfThatDate}, all data will be displayed.

yangdong avatar Jan 31 '18 02:01 yangdong

this is not related to this repo, will close it

yangdong avatar Jan 31 '18 06:01 yangdong

If you're using a unix timestamp, the problem is when it gets converted to Float, it loses precision, so lots of timestamps that actually represent different times end up being rounded and represented as the same x value. See #2891

timusus avatar Aug 30 '18 06:08 timusus