Zéfling

Access colors or data in Tooltip Macros

Recommended Posts

Hi,

I want to custom tooltip. I do not find how to get the color or any other info in the data. 
The only solution I find is to generate one toolText per point.
It's not possible to pass a callback and make the data formatting in a javascript function? Like this :
 

{
   chart : {
      plotToolText: (data) => `<span class="drop" style="background-color:${data.color}"></span><strong>${formatValue(data.value)}</strong>  (<span class="date">${formatDate(data.date, "MM/YYYY")}</span>)`;
   },
   data: [{
     label: "label",
     value: 15,
     color: "#FF0000",
     date: "2019-01-03"
  }]
}
 

Share this post


Link to post
Share on other sites

Hi,

In FusionCharts, you can use various Tooltip macros to configure your custom Tooltip. Using the macros you can easily get the label, value, seriesname, etc. in the Tooltip of your chart.

Demo: http://jsfiddle.net/srishti_fc/p08fcoq5/

 

Or, you can show the custom data in your Tooltip by using the "dataPlotRollOver" event API where you can fetch your data using "getJSONData()" method and the event object and provide it to the Tooltip. 

Custom data demo: http://jsfiddle.net/srishti_fc/o571dpm6/1/

 

Documentation Links:-

https://www.fusioncharts.com/dev/chart-guide/chart-configurations/tool-tips#how-to-use-tooltip-macros

https://www.fusioncharts.com/dev/chart-guide/chart-configurations/tool-tips#list-of-tooltip-macros

 

Hope this will help.

Thanks,

Srishti

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now