Pre loader

How to add the label (with value) on candlestick chart


Hello everyone,

I am the beginner of SciChart, now I able to create a candlestick chart with a HorizontalLineAnnotation but it doesn’t display well.

I have checked-out this tutorial

I tried to convert the C# code and XML document to Kotlin but it seems there are no class AnnotationLabel found from the library.

Bellow is my screenshot

enter image description here

You can see the issue is the HorizontalLineAnnotation doesn’t contain the label (with value). What I need is it should have a label as bellow

enter image description here

Bellow is my implementation (in Kotlin)

val xAxis = sciChartBuilder.newCategoryDateAxis().build()
    val yAxis = sciChartBuilder
val currentAnnotation = sciChartBuilder

val rSeries = sciChartBuilder.newCandlestickSeries()

    UpdateSuspender.using(surface) {
        Collections.addAll(surface.xAxes, xAxis)
        Collections.addAll(surface.yAxes, yAxis)
        Collections.addAll(surface.annotations, currentAnnotation)
        Collections.addAll(surface.renderableSeries, rSeries)
        Collections.addAll(surface.chartModifiers, sciChartBuilder.newModifierGroupWithDefaultModifiers().build())

Can someone please help me on this?

  • You must to post comments

Hi there,

Well you need to add label when you declare HorizontalLineAnnotation because by default it draws only line without any labels:

val currentAnnotation = sciChartBuilder
        // place label on axis

Best regards,

  • 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