Pre loader

Simple Column Chart with labels

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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?

Version
3.0.0.4253
Images
  • You must to post comments
0
0

Hi Nelson,

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?

Best regards,
Yura

  • You must to post comments
0
0

Hi Yura,

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.

Images
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies