highcharts / highcharts-ios

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

how to hide the crosshair after x seconds? #414

Closed AAChartModel closed 6 months ago

AAChartModel commented 1 year ago

Can the crosshair be auto-hide after a few seconds?

Just like auto-hide tooltip, refer to the issue:

ihnatmoisieiev commented 1 year ago

Hello @AAChartModel, did you try this solution?

AAChartModel commented 1 year ago

I tried it, it is only useful for tooltip, not the crosshair

ihnatmoisieiev commented 1 year ago

Hello @AAChartModel, did you find a solution?

AAChartModel commented 1 year ago

I haven't found any solution so far.

MikolajMichalczak commented 7 months ago

HI @AAChartModel! Apologies for the delayed response. Here's another option to hide the tooltip with a delay:

let tooltip = HITooltip()
options.tooltip = tooltip

let series = HIColumn()
series.point = HIPoint()
series.point.events = HIEvents()
series.point.events.click = HIFunction(closure: { (context)  in
    guard let context = context else {return}
    DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
        options.tooltip.hide()
    }
})

You can apply a similar approach for the crosshair:

let xAxis = HIXAxis()
xAxis.crosshair = HICrosshair()
options.xAxis = [xAxis]

let series = HIColumn()
series.point = HIPoint()
series.point.events = HIEvents()
series.point.events.click = HIFunction(closure: { (context)  in
    guard let context = context else {return}
    DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
        options.xAxis.first?.hideCrosshair()
    }
})
MikolajMichalczak commented 6 months ago

Closing due to inactivity. Please feel free to reopen the ticket if you have any further questions.