Plotting slow over time-Android how to free the memory when a real time data is plotting using MPAndroidChart Line Graph? -
i working on android application plotting heart rate using line graph. receiving packet of data via udp broadcast in every 65 milliseconds need plot. graph rendering smooth first 2-3 minutes , after getting slower. me figure out makes getting slow on time? how free memory while plotting large data?
private void addentrygraph01(int ch0[], linechart chart) { linedata data = chart.getlinedata(); if (data != null) { ilinedataset set = data.getdatasetbyindex(0); if (set == null) { set = createset(); data.adddataset(set); } data.addxvalue(""); (int = 0; < ch0.length; i++) data.addentry(new entry((float) (ch0[i]), set.getentrycount()), 0); chart.notifydatasetchanged(); chart.setvisiblexrange(50, 50); chart.moveviewtox(data.getxvalcount() - 10); return; } } private linedataset createset() { linedataset set = new linedataset(null, ""); set.setdrawcubic(true); set.setdrawvalues(false); set.setcubicintensity(0.1f); set.setaxisdependency(yaxis.axisdependency.left); set.setcolor(colortemplate.getholoblue()); set.setcirclecolor(colortemplate.getholoblue()); set.setlinewidth(1f); set.setdrawcircles(false); set.setfillalpha(65); set.setfillcolor(colortemplate.getholoblue()); set.sethighlightcolor(color.rgb(244, 117, 177)); set.setvaluetextcolor(color.white); set.setvaluetextsize(10f); return set; }
we ran few tests compare performance of various android charting libraries here, , mpandroidchart came out second, scichart android first wide margin.
this new (commercial) charting component tailored real-time use in android apps , embedded systems. it's few days away release not available yet extremely soon!
disclosure: please advised work on scichart android project.
Comments
Post a Comment