SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

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.