Displaying a different field in tooltip than that plotted.

Hello

I have a data series on a column chart added like this:


In my datasource I am trying to plot the dimension on the x-axis. The trouble is that dimension is a long piece of text (suburb name). I have created a new property called dimensionShort which is a short text version of the dimension. This when plotted at 45% look reasonable.  I would, however, like the tool tip to display the long version (dimension) rather than dimensionShort.  Is this possible?

Thanks


1 Reply

SB Swetha Babu Syncfusion Team September 9, 2022 10:11 AM UTC

Hi Ditchford,


Greetings from Syncfusion.


We can achieve your requirement of showing the long value in the tooltip by setting the dataSource property name that has the long dimension value to the tooltipMappingName property of the series. We can access that using the format property in the tooltip. We have created a simple Javascript application to demonstrate the same. Please find the below stackblitz link for your sample reference.


Sample link: https://stackblitz.com/edit/hgmq95?file=index.js


Code Snippet:


series: [

            {

                type: 'Column', xName: 'dimensionShort', width: 2, yName: 'y', name: 'Bronze',

                dataSource: data, tooltipMappingName: "long"

            }

        ]

        tooltip: {

            enable: true,

            format: "${point.tooltip}: ${point.y}"

        },


Screenshot:



Kindly, revert us if you have any concerns.


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Regards,

Swetha


Loader.
Up arrow icon