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?
- Alexander Edunov asked 8 years ago
- last active 8 years ago