Pre loader

Draw min-max annotations inside chart and ensure they are initially visible

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

Hi,
ich would like to draw annotations for min/max-prices on a chart like the attached image. I got pretty close to the screen but I have two questions:
1. is there a way to automatically such min/-max-annoations (currently I determine min and max values manually and then draw the annotation at the respective x/y coordinates)
2. How can I make sure those annotations are visisble; currently I use growBy(0.1, 0.1) on each axis to have some room for the labels, but that seems pretty unreliable.

Regards
Benjamin

Version
4.4.0.4739
Images
  • You must to post comments
0
0

Hello Maulik Senghani,
thank you for your response and the hint towards Min, max, that solve the data question.
With regards to your second answer: I do not fully understand your proposed solution: visible range is in the y-Data-Type i.e. currency (10-20€) but the annotation height is in pixel/unit. So I cannot increment the visible range without converting the pixel value to a currency-Value. Do you propose to do some kind of calculation like this:

annotation_height_in_currency =
(visible_range_in_currency / chart_size_in_pixel) * annotation_height_in_pixel

I had hoped for a more conveneint solution.

Regards
Benjamin

  • You must to post comments
0
0

Hi Benjamin Mesing,

Regarding the points you mentioned:

  1. You can obtain the minimum and maximum values from the renderable series using renderableSeries.getYRange(). From this, you can retrieve the minimum and maximum values with getMin() and getMax(). If the chart is scrollable and annotations are placed based on the current visible range, you will need to manually calculate the min and max values based on the visible range. You can listen for changes in the visible range by using setVisibleRangeChangeListener on the axis.

  2. To make the annotations visible, you can set the visible range to:
    2 × (height of annotations) + padding

You can find some useful documentations below.
visibleRangeChangeListener
IRange Class

  • You must to post comments
0
0

Hi Maulik,
thank you for your response, the first answer is already helping.
For the second answer there is one thing I do not understand: as far as I know, “visible range” is e.g. 5€-10€ while “height of annotation” is in pixel. So I would have to calculate the “visible annotation-height” by (range/chart-height-in-pixel)*annotation-height-in-pixel (especially do not like having the chart-height in this formula). Is there an easier way (like adding an axis-padding -in-pixel or having a zoom-fit-to-annotations method)
.
Regards
Benjamin

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.