)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

What is the difference between tooltip format and tooltip template?

Platform: jQuery |
Control: ejChart |
Published Date: January 19, 2015 |
Last Revised Date: July 1, 2019 |
.NET Framework: 4 |
Product Version: 12.1.0.43

When you move the mouse over a particular point, the tooltip displays the values of that point. By default, its display format looks like x value :  y value. For example:  2000 : 20.

 

Tooltip format:

You can customize the values displayed in the tooltip by using the format property. The online sample for using the ToolTip format is available in the following link: http://js.syncfusion.com/demos/web/#!/azure/chart/chartcustomization/symbols

 

Tooltip template:

The ToolTip template refers to the use of HTML elements like image and tables in the tooltip through the template property of the tooltip. Since HTML elements such as div, image, table, etc., are used, you can style the ToolTip template by using the CSS and it appears more attractive than the default tooltip. The online sample for tooltip template is available in the following link: http://js.syncfusion.com/demos/web/#!/azure/chart/chartcustomization/tooltiptemplate

 

Difference between tooltip format and template:

In general, ToolTip format is used to format the values displayed in the tooltip; whereas, ToolTip template is used to customize the appearance of the tooltip.

In the following code example, the first series is rendered with the ToolTip template, the next with specified ToolTip format, and the last series is rendered with the default tooltip.

 

JS

<div id="container"></div>
<div id="Tooltip" style="display: none">Year : #point.x# <br> Percent : #point.y# %</div>
<script type="text/javascript">
     $(function () {
        $("#container").ejChart(
                  {
                    . . .
                    series: [{
                          points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },
                          { x: 2007, y: 26 }, { x: 2008, y: 27 }, { x: 2009, y: 32 },                        
                          { x: 2010, y: 35 }, { x: 2011, y: 30 }],
                          name: 'India', tooltip: { visible: true, template: 'Tooltip'}
                      },
                          {
                              points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },
                          { x: 2007, y: 30 }, { x: 2008, y: 36 }, { x: 2009, y: 36 }, 
                          { x: 2010, y: 39 }, { x: 2011, y: 37 }],
                           name: 'Germany', tooltip: { visible: true, format: '#point.y# : <br/> #point.x#'}
                          }] 
                     . . .               
             });
       }); 
</script>

 

The output of the above code example is as follows.

 

 

The difference between tooltip format and tooltip template

Figure 1: Chart with Tooltip template

 

JS Playground Link: Tooltip template

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon