jasmine2121
Posts: 1
Joined: Thu Jan 06, 2022 7:46 am

How to use Highcharts.wrap in Swift?

The reason asking this is because our web devs have rewrite some of the default behavior, like change how tooltip refresh,
move and hide. We would also like to implement the same feature on the iOS side.

Could we do some equivalent stuff on the iOS side with Swift?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: How to use Highcharts.wrap in Swift?

Hi jasmine2121,

Welcome to our forum and thanks for contacting us with your question!

In general it depends on what function do you wrap, and how complex these wraps are, but you can use addEvent method to do something like that.
Demo: https://jsfiddle.net/BlackLabel/gn6kyjbc/

In Swift you can use jsFunction. Example:

Code: Select all

let options = HIOptions()

let chart = HIChart()
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function () { var chart = this; Highcharts.addEvent(this.tooltip, 'refresh', function () { setTimeout(function () { chart.tooltip.hide(0); },500); }); }")
options.chart = chart

let series = HISeries()
series.data = [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
options.series = [series]
Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”