Pre loader

How can I add a price mark to the chart?

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

1
0

Hello,

I am using a candlestick chart for a financial application and I want to add the sign and price to the highest and lowest price bar that appears on the screen as in the attached image. As the chart is scrolled, the highest price and lowest price data and location should also change. how can I do that?

Best regards.

Version
4.4.0.4739
Images
  • You must to post comments
0
0

Hi Devrim

The best way to do this would be with TextAnnotation and LineAnnotation type.

You would have to calculate the Min/Max in the viewport and position the annotations.

Some ideas how to do this:

Listen to axis visibleRange changes

val axis = NumericAxis(context)
axis.setVisibleRangeChangeListener { axis, oldRange, newRange, isAnimating ->
    // TODO handle range changes here
}

calculate min, max inside that visible range and position an annotation on the chart by setting Annotation.X1, X2, Y1, Y2 properties. You can also adjust the TextAnnotation.Text to display the value at the min & max on the chart.

val textAnnotation = TextAnnotation(context)
textAnnotation.text = "Some text"
// Specify a desired position
textAnnotation.x1 = 20
textAnnotation.y1 = 14
// add to the chart
surface.annotations.add(textAnnotation)

Finally, be aware of Annotation.HorizontalAnchorPoint / VerticalAnchorPoint which allows you to align a TextAnnotation left or right top or bottom

Does that help?

Sorry not a full solution but should point you in the right direction!

Best regards
Andrew

  • You must to post comments
Showing 1 result
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