jQWidgets jqxChart showToolTip() Method
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. jqxChart is a lightweight and powerful chart widget written 100% in javascript. It offers many advanced features and supports three different rendering technologies – SVG, HTML5 Canvas & VML.
The showToolTip() method is used to show a tooltip of the specified data peak. It does not return anything.
Syntax:
var stt = chartInstance.showToolTip(groupIndex, serieIndex, itemIndex, showDelay, hideDelay);
Parameters:
- groupIndex: It is the specified index of the group. It is of type number.
- serieIndex: It is the specified index of the series. It is of type number.
- itemIndex: It is the specified index of the item. It is of type number.
- showDelay: It is the specified delay in showing the tooltip. It is of type number.
- hideDelay: It is the specified delay in hiding the tooltip. It is of type number.
Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxchart.core.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdraw.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdata.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxchart.api.js”></script>
Example 1: The below example illustrates the jQWidgets jqxChart showToolTip() method.
HTML
<!DOCTYPE html> < html lang = "en" > < head > < link rel = "stylesheet" href = "jqwidgets/styles/jqx.base.css" type = "text/css" /> < script type = "text/javascript" src = "scripts/jquery-1.11.1.min.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxcore.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxchart.core.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxdraw.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxdata.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxchart.api.js" > </ script > </ head > < body > < center > < h1 style = "color: green" > GeeksforGeeks </ h1 > < h3 >jQWidgets jqxChart showToolTip() method</ h3 > < div id = 'gfg1' style = "width:400px; height: 200px" /> </ center > < center > < input type = "button" id = "btn" value = "Click Here" style = "padding: 5px 14px; margin-top: 15px;" > < br > < div id = "log" ></ div > </ center > < script type = "text/javascript" > $(document).ready(function () { var json = [ { Day: 'Monday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Tuesday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Wednesday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Thursday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Friday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Saturday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Sunday', A: 3, B: 1, C: 2, D: 1 } ]; var obj = { title: "Coding Score", description: "Coding Questions Solved Daily", showToolTips: true, source: json, categoryAxis: { dataField: 'Day', showGridLines: true }, seriesGroups: [{ type: 'column', columnsGapPercent: 30, seriesGapPercent: 0, valueAxis: { minValue: 0, maxValue: 10, unitInterval: 10, description: 'Questions Solved' }, series: [ { dataField: 'A', displayText: 'A' }, { dataField: 'B', displayText: 'B' }, { dataField: 'C', displayText: 'C' }, { dataField: 'D', displayText: 'D' } ] }] }; $('#gfg1').jqxChart(obj); $('#btn').click(function () { $("#gfg1").jqxChart('showToolTip', 0, 1, 2); $('#log').text("Tool tip visible!"); }); }); </ script > </ body > </ html > |
Output:

Example 2: The following is another example of the jqxChart showToolTip() method in jQWidgets.
HTML
<!DOCTYPE html> < html lang = "en" > < head > < link rel = "stylesheet" href = "jqwidgets/styles/jqx.base.css" type = "text/css" /> < script type = "text/javascript" src = "scripts/jquery-1.11.1.min.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxcore.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxchart.core.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxdraw.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxdata.js" > </ script > < script type = "text/javascript" src = "jqwidgets/jqxchart.api.js" > </ script > </ head > < body > < center > < h1 style = "color: green" > GeeksforGeeks </ h1 > < h3 >jQWidgets jqxChart showToolTip() method</ h3 > < div id = 'gfg1' style = "width:400px; height: 200px" /> </ center > < center > < input type = "button" id = "btn" value = "Click Here" style = "padding: 5px 14px; margin-top: 15px;" > < br > < div id = "log" ></ div > </ center > < script type = "text/javascript" > $(document).ready(function () { var json = [ { Day: 'Monday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Tuesday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Wednesday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Thursday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Friday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Saturday', A: 3, B: 1, C: 2, D: 1 }, { Day: 'Sunday', A: 3, B: 1, C: 2, D: 1 } ]; var obj = { title: "Coding Score", description: "Coding Questions Solved Daily", showToolTips: true, source: json, categoryAxis: { dataField: 'Day', showGridLines: true }, seriesGroups: [{ type: 'column', columnsGapPercent: 30, seriesGapPercent: 0, valueAxis: { minValue: 0, maxValue: 10, unitInterval: 10, description: 'Questions Solved' }, series: [ { dataField: 'A', displayText: 'A' }, { dataField: 'B', displayText: 'B' }, { dataField: 'C', displayText: 'C' }, { dataField: 'D', displayText: 'D' } ] }] }; $('#gfg1').jqxChart(obj); $('#btn').click(function () { var stt = $("#gfg1").jqxChart('showToolTip', 0, 1, 2); if (stt === null) { $('#log').text("Null!"); } else { $('#log').text("Not null!"); } }); }); </ script > </ body > </ html > |
Output:
.gif)
Please Login to comment...