I am trying to use the tooltipShowingevent to override the tooltip displayed when the mouse hovers over a chart column. A valid HTML string is returned to tooltip from GetChartTooltip (a function I created), however, the column tooltip is still the default tooltip defined within Infragistics rather than my modified tooltip. How can I get my custom tooltip to be displayed?
tooltipShowing: function (evt, ui) {// Programmatically set the tooltipvar tooltip = GetChartTooltip(ui);if (tooltip != '') {ui.element.tooltip().text(tooltip);}}
Hello Ray,
It depends on how you have set up your data chart.
It needs to be as same as the example I've sent.
You are probably not using the same template but the default one?As you can see from the example, I'm just taking the tooltip template as it is and I'm referencing the child element that needs modification. In our case, this is the '#tooltipValue' span element.
I've made the same example but this time with the data chart.
Please make sure that you've checked and went through the API of the data chart because it is no the same as the pie chart.
More particularly you can see the data chart API for Setting up a tooltipTemplate and how to show the tooltip at first.
If you have further questions, please let us know.
data-chart-tooltip.zip
Your suggestions work perfectly with a Pie Chart. But when I try the same thing with a Data Chart, the tooltip cannot be overwritten this way. It always reverts back to the default tooltip.
Actually, I've found a solution.I've refactored the sample and that's what I did. I just took the tooltip as an element. Then with JQuery, I've managed to take the child I need to modify (change the text), without breaking the structure of the tooltip.
Could you please take a look at the updated example.
0245.pie-chart-tooltip-text.zip
As you say, you can't include any HTML tags to control the look of the tooltip using this technique. Other libraries with tooltip support do permit including HTML tags, so the Infragistics implementation would appear to be very limiting here, although, you can create a script template and include HTML tags there.
Yes, this is the expected behaviour because we are escaping the value that you are passing due to security reasons.I believe that you are aware of XSS attacks.
I have attached a simple example that demonstrates a successful modification of tooltip text.
If you have further questions, please contact us again.
pie-chart-tooltip-text.zip