highcharts-ios icon indicating copy to clipboard operation
highcharts-ios copied to clipboard

how to hide the crosshair after x seconds?

Open AAChartModel opened this issue 2 years ago • 4 comments

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

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

  • #97

AAChartModel avatar Mar 22 '23 03:03 AAChartModel

Hello @AAChartModel, did you try this solution?

ihnatmoisieiev avatar Mar 23 '23 05:03 ihnatmoisieiev

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

AAChartModel avatar Mar 23 '23 06:03 AAChartModel

Hello @AAChartModel, did you find a solution?

ihnatmoisieiev avatar Apr 23 '23 20:04 ihnatmoisieiev

I haven't found any solution so far.

AAChartModel avatar Apr 24 '23 02:04 AAChartModel

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 avatar Apr 25 '24 20:04 MikolajMichalczak

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

MikolajMichalczak avatar May 16 '24 13:05 MikolajMichalczak