MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Chart.setHardwareAccelerationEnabled(true) fails in painting caches with a FILLED Region.

Open Jasper009-So opened this issue 10 years ago • 2 comments

For example, I customized below code in in YAxisRenderer::renderAxisLabels(Canvas c) // for ( int i = 0 ; i < limitLines.size(); i+=2) { float[] position1 = new float[2]; float[] position2 = new float[2]; position1[1] = limitLines.get(i).getLimit(); position2[1] = limitLines.get(i+1).getLimit(); mTrans.pointValuesToPixel(position1); mTrans.pointValuesToPixel(position2); limitLinePath.setFillType(Path.FillType.EVEN_ODD); limitLinePath.moveTo(mViewPortHandler.offsetLeft(), position1[1]); limitLinePath.lineTo(mViewPortHandler.contentRight(), position1[1]); limitLinePath.lineTo(mViewPortHandler.contentRight(), position2[1]); limitLinePath.lineTo(mViewPortHandler.offsetLeft(), position2[1]); limitLinePath.lineTo(mViewPortHandler.offsetLeft(), position1[1]); mLimitLinePaint.setColor(0x7FCACACA);//light gray mLimitLinePaint.setStyle(Paint.Style.FILL_AND_STROKE); // c.drawPath(limitLinePath, mLimitLinePaint); limitLinePath.reset(); } //
And Chart.setHardwareAccelerationEnabled(true) works fine in most mobile device, but some device, eg. ASUS_T00G (Android 4.4.2) I met the result in very short seconds when I touch the charts and some invalidate() post...

in case of sethardwareacceleration true

Jasper009-So avatar Mar 15 '16 08:03 Jasper009-So

Currrently I just can avoid it by Chart.setHardwareAccelerationEnabled(false);

Jasper009-So avatar Mar 15 '16 08:03 Jasper009-So

Yes, this is an issue related to some Android devices and some Android versions. Unfortunately, this issue originates from the Android OS and there is not much I can do about it.

PhilJay avatar Mar 15 '16 22:03 PhilJay