Sunday, November 17, 2024
Google search engine
HomeLanguagesJavascriptjQWidgets jqxChart getItemCoord() Method

jQWidgets jqxChart getItemCoord() Method

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful and optimized framework, platform-independent, and widely supported. 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 getItemCoord() method is used to get the coordinates for a data point. It takes the groupIndex, serieIndex, and itemIndex type as parameters of the number type, and returns the coordinates as an object type.

Syntax:

var getItemCoord = chartInstance.getItemCoord(0, 1, position);

 

Linked Files: Download jQWidgets from the 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>

Example: The below example illustrates the jqxHeatMap getItemCoord() 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/jqxchart.api.js">
      </script>
    <script type="text/javascript"
            src="jqwidgets/jqxdraw.js">
      </script>
    <script type="text/javascript"
            src="jqwidgets/jqxdata.js">
      </script>
</head>
  
<body>
    <center>
        <h1 style="color: green">
          neveropen
        </h1>
        <h3>jQWidgets jqxChart getItemCoord() method</h3>
        <div class='default'></div>
        <button id='gfg'>Click Here</button>
  
        <div id='gfg1' style="width:600px; height: 400px"/>
    </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",
                source: json,
                toolTipMoveDuration: 1000,
                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);
  
             $('#gfg').click(function () {
                var chartInstance = 
                    $('#gfg1').jqxChart('getInstance');
  
                var xval = chartInstance.getItemCoord(0, 1, 1); 
                console.log(xval);
            });
        });
    </script>
</body>
  
</html>


Output:

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-api.htm

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments