Pre loader

Tag: SCILineAnnotation

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 vote
6k views

Hello!
I tried to draw relative line annotations but can’t get expected behavior.

I have a chart with date x axis and numeric y axis. I want to draw line from (x1, y1) to (x2, y2) where:
x1 = deal.startQuoteDate
y1 = deal.startQuoteRate
x2 = deal.endQuoteDate
y2 = deal.startQuoteRate

func activeDealAnnotations() -> [SCILineAnnotation] {
    return bnd_activeDeals.map { deal in
        let lineAnnotation = SCILineAnnotation()
        lineAnnotation.xAxisId = self.xAxisId
        lineAnnotation.yAxisId = self.yAxisId
        lineAnnotation.coordMode = .Relative
        lineAnnotation.style.linePen = SCIPenSolid(color: UIColor.whiteColor(), width: 0.5)
        lineAnnotation.xStart = SCIGeneric(deal.startQuoteDate)
        lineAnnotation.xEnd = SCIGeneric(deal.endQuoteDate)
        lineAnnotation.yStart = SCIGeneric(deal.startQuoteRate)
        lineAnnotation.yEnd = SCIGeneric(deal.startQuoteRate)
        return lineAnnotation
    }
}

I also tried different configurations of the line annotation to check the validity of x and y values.

lineAnnotation.coordMode = .RelativeX
lineAnnotation.xStart = SCIGeneric(0)
lineAnnotation.xEnd = SCIGeneric(1)
lineAnnotation.yStart = SCIGeneric(deal.startQuoteRate)
lineAnnotation.yEnd = SCIGeneric(deal.startQuoteRate)

lineAnnotation.coordMode = .RelativeY
lineAnnotation.xStart = SCIGeneric(deal.startQuoteDate)
lineAnnotation.xEnd = SCIGeneric(deal.startQuoteDate)
lineAnnotation.yStart = SCIGeneric(0)
lineAnnotation.yEnd = SCIGeneric(1)

lineAnnotation.coordMode = .RelativeY
lineAnnotation.xStart = SCIGeneric(deal.endQuoteDate)
lineAnnotation.xEnd = SCIGeneric(deal.endQuoteDate)
lineAnnotation.yStart = SCIGeneric(0)
lineAnnotation.yEnd = SCIGeneric(1)

The lines draws at expected parts of the chart. Now I’m sure that the values are valid and the problem is in the configuration.

Could you help me to do it right?

Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies