Pre loader

Tag: ISCIComparable

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

0 votes
4k views

Dear SCICharts support:
We have a very large project that must be migrated to version 3 because right it uses version 2.
I am stuck in the following issues:

1/ I cannot convert Double or Date to ISCIComparable.

Our x axis contains Date-timestamp values and I am trying to find the index of the dataseries.xValues of a specific Date having as parameter my Date value which is Date type and not ISCIComparable.
How can I do this ?

When I try my attempt 1:

let x: Double = <DoubleValue>
let index = dataSeries.xValues.findIndex(of: x, searchMode: .nearest, isSorted: true) 

I am getting the build error: “Cannot convert value of type ‘Date?’ to expected argument type ‘ISCIComparable?'”

When I try my attempt 2:

If I also try to iterate the xValues and find the ISCIComparable value which has doubleValue equal the x then I get the error “Type ‘ISCIList?’ does not conform to protocol ‘Sequence'”
I mean something like this:

let x: Date = Date()
var comparableValue: ISCIComparable? = nil
for val in dataSeries.xValues {
    if val.toDate() == x {
        comparableValue = val
    }
}

So any solution please ?

2/ I am trying to update the last point of dataSeries using this code:

let lastPoint = dataSeries.count - 1
if let open = dataSeries.openValues.value(at: lastPoint) {
        dataSeries.update( open: open,
                                    high: max(dataSeries.highValues().value(at: lastPoint).toDouble(), mbidPrice),
                                    low: min(dataSeries.lowValues().value(at: lastPoint).toDouble(), mbidPrice),
                                    close: mbidPrice,
                                    at: lastPoint)     }

and I get the error “Cannot convert value of type ‘ISCIComparable’ to expected argument type ‘ISCIValues?’ “
Why ? How should I do this ?

Thanks a lot in advance

  • Dxat asked 4 years ago
  • last active 4 years ago
Showing 1 result

Try SciChart Today

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

Start TrialCase Studies