highcharts / highcharts-ios

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

ToolTip formatter using HIFunction #372

Closed SreeramiOS closed 3 years ago

SreeramiOS commented 3 years ago

I need to have a customised tooltip based on expression specified below. this.point.x need to replaced by series1 data and this.point.y with the series 2 data of the selected bar in the below expression. How can we do it ?

` let TooltipValueExpression:String = "function() {let fulfilled, unfullfilled, sum; if('this.point.x'){ sum = this.point.x+this.point.y; fulfilled = Math.round((this.point.y * 100) / sum); } else { fulfilled = 0; unfulfilled = 100; } unfulfilled = 100 - fulfilled; return fulfilled + '% fulfilled' + ', ' + unfulfilled + '% unfulfilled' ; }"

tooltip.formatter = HIFunction.init(jsFunction: "(TooltipValueExpression)")`

Screenshot 2021-08-06 at 3 56 48 PM
ihnatmoisieiev commented 3 years ago

Hello @SreeramiOS,

is your example not working? Do you have any working example in JS?

SreeramiOS commented 3 years ago

@ihnatmoisieiev My Example expression is working.

I am using a stacked bar chart, instead of point.x and point.y in the expression I need to use stacked first and second bar data of the bar selected. If I user point.x I able to get value of first bar only. Can you help me resolve this issue.

ihnatmoisieiev commented 3 years ago

@SreeramiOS please try to use this.point.stackTotal. If it will not help you with your issue, please write in more detail which exact data you want to get from the first series and from the second.

ihnatmoisieiev commented 3 years ago

Closing due to inactivity.