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
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
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?
- Vo Hoa asked 7 years ago
- last edited 7 years ago
- You must login 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
.newHorizontalLineAnnotation()
.withBackgroundColor(0xFFFCB51E.toInt())
.withYValue(currentValue)
// place label on axis
.withAnnotationLabel(LabelPlacement.Axis)
.build()
Best regards,
Yura
- Yura Khariton answered 7 years ago
- Sorry, There are no any method name withAnnotationLabel and no class LabelPlacement as well. See my screenshot https://i.snag.gy/TXeVrx.jpg. Thank you.
- It looks like that you’re using old version of the library which doesn’t support annotation labels. Can you try to update to the latest available version from our Maven repository( for now the latest version is v2.1.0.2192)? You can find detailed steps how to do this in our documentation – https://www.scichart.com/documentation/android/v2.x/webframe.html#Tutorial%2001%20-%20Adding%20SciChart%20libraries%20as%20dependencies.html
- Thanks a lot. The version v2.1.0.2192 works. But please update the document because it’s still displaying the old version.
- You must login to post comments
Please login first to submit.