I am successfully displaying pie chart using achart engine.I want to customize my labels text size according to the screen size.Thanks in advance.
This problem comes down to resolution. achartengine seems to have been designed with raw pixels in mind while display quality and pixel density has increased dramatically over the last couple years. The labels from the achartengine sample are tiny on my HTC One!
Android has introduced scale-independent pixels. The key to using them with achartengine is the TypedValue
class. Here's what I did:
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
float val = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, metrics);
I got 18 from "text size medium" in the link above.
You can then use val
anywhere you want to use medium sized text. For example:
renderer.setLabelsTextSize(val);