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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

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

https://www.scichart.com/documentation/v5.x/webframe.html#The%20HorizontalLineAnnotation%20Type.html

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
            .newNumericAxis()
            .build()
val currentAnnotation = sciChartBuilder
            .newHorizontalLineAnnotation()
            .withBackgroundColor(0xFFFCB51E.toInt())
            .withYValue(currentValue).build()

val rSeries = sciChartBuilder.newCandlestickSeries()
            .withStrokeUp(upColor)
            .withFillUpColor(upColor)
            .withStrokeDown(downColor)
            .withFillDownColor(downColor)
            .withDataSeries(dataSeries)
            .build()

    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?

Version
2.0.0.1654
  • You must to post comments
0
0

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
        .newHorizontalLineAnnotation()
        .withBackgroundColor(0xFFFCB51E.toInt())
        .withYValue(currentValue)
        // place label on axis
        .withAnnotationLabel(LabelPlacement.Axis) 
        .build()

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.