I’m evaluating chart libraries to my next project and I’m trying to do a simple chart like the one in the attached image.
It was actually very easy to do it using MPAndroidChart, however it’s been hard to do a simple task like put a label aligned with the column… I did take a look into the SciChart sample application, but the application just uses numeric labels…
Can someone provide some guidance of how to do this?
To add label on top of column I would suggest to use TextAnnotation for each value that you need to display text for.
final TextAnnotation textAnnotation = sciChartBuilder.newTextAnnotation() .withX1(0.3) .withY1(9.7) .withText("9.7") // use anchor point to center annotation horizontally above specified point .withHorizontalAnchorPoint(HorizontalAnchorPoint.Center) .withVerticalAnchorPoint(VerticalAnchorPoint.Bottom) .build(); Collections.addAll(surface.getAnnotations(), textAnnotation);
Is this suitable for your needs?
I have currently a few problems with I’m struggling to resolve:
1. How can I rotate 45 degrees the texts below the columns?
2. How can I detect the click on each bar?
3. How can I display the value just above the column/bar?
Regarding your answer, how can I know the column position to set the text X,Y position?
I’m attaching an image with my current result.
Please login first to submit.