highcharts / highcharts-ios

iOS wrapper for Highcharts.
Other
127 stars 39 forks source link

Iphone's Stocks app similar #401

Closed baagii-tmcn closed 2 years ago

baagii-tmcn commented 2 years ago

Hello,

I am trying to make one feature of a graph that is similar to the iPhone's stock application.

Track mode by long press gesture.

let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(longPressed)) longPressRecognizer.allowableMovement = 50 chartViewTemperature.addGestureRecognizer(longPressRecognizer)

`@objc func longPressedTest(sender: UILongPressGestureRecognizer) {

    let longPressView = sender.view as! HIChartView

    switch (sender.state) {
    case UILongPressGestureRecognizer.State.began:
        longPressView.options.tooltip.followTouchMove = true
        //longPressView.update(longPressView.options)
        let scrollTrackFunction = HIFunction(jsFunction: "function() {chart.update({ tooltip: { followTouchMove: !chart.options.tooltip.followTouchMove } }) }") as HIFunction
        longPressView.updateOptions()
        print(longPressView.options.tooltip.followTouchMove)

        print("longpress began")
    case .ended:
        longPressView.options.tooltip.followTouchMove = true
        print(longPressView.options.tooltip.followTouchMove)
        print("longpress ended")
    case .cancelled:
        longPressView.options.tooltip.followTouchMove = false
        print("longpress cancelled")
    case .failed:
        longPressView.options.tooltip.followTouchMove = false
        print("longpress ended")
    case .possible:
        longPressView.options.tooltip.followTouchMove = true
        print("longpress possible")
    case .changed:
        longPressView.options.tooltip.followTouchMove = true
        longPressView.update(longPressView.options)
        print(longPressView.options.tooltip.followTouchMove)
        print("longpress changed")
    @unknown default:
        longPressView.options.tooltip.followTouchMove = false
        print("longpress default")
    }

}`

As you can see I tried several different ways. The value of the options.tooltip.followTouchMove changes but no result as we expected.

By normal clicking switch the below works: chart.events.click = HIFunction(jsFunction: "function() {chart.update({ tooltip: { followTouchMove: !chart.options.tooltip.followTouchMove } }) }")

ihnatmoisieiev commented 2 years ago

Duplicate https://github.com/highcharts/highcharts-ios/issues/402