MPAndroidChart
MPAndroidChart copied to clipboard
The size of barchart changed when it invalidate()
I used the barchart to display some data, and i need to update the chart when data changed, so i call the invalidate() method to update the bar chart. Howerver, when this methond called, the width and the height of the barchart changed, it become smaller. I used the AndroidAutoSize for the screen adaptation work, will it be the reason? poor english, sorry.
It's very excited to find the solution after a few hours, my colleague helped me. As for my situation, I used the AndroidAutoSize lib, my colleague remind me the density may be changed by mpandroidchart, so i track the source code and found the density really changed. The barchart calculate the margin by the density, so the size has changed.
the solution of mine is to call the autosize method before i update the chart.
AutoSize.autoConvertDensity(context, sizeIndp, isBaseOnWidth)
so the size of chart won't be changed again.
Can you share some of code here