Data Visualization of Grid data in Chart.
A live JavaScript/jQuery example of jqxGrid, the jQWidgets Grid component, with its complete source code below. It is one of 139 jqxGrid demos for jQuery.
showtoolbar property – Shows or hides the grid's toolbar.selectionmode property – Sets or gets the selection mode.toolbarheight property – Sets or gets the toolbar's height.autoheight property – Sets or gets the height of the grid to be equal to the summary height of the grid rows.width property – Sets or gets the Grid's width.columns property – Sets the Grid columns.ready property – This function is called when the grid is initialized and the binding is complete.rendertoolbar property – Callback function which allows you to customize the rendering of the Grid's toolbar.sortable property – The sortable property enables or disables the sorting feature.source property – Sets and gets the source.createChart method – Creates a Chart from the Grid data.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxGrid shows the setup step by step.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxdata.js, jqxbuttons.js, jqxscrollbar.js, jqxmenu.js, jqxgrid.js, jqxcalendar.js, jqxdatetimeinput.js, jqxgrid.selection.js, jqxgrid.chart.js, jqxlistbox.js, jqxdropdownlist.js, jqxgrid.pager.js, jqxgrid.edit.js, jqxgrid.filter.js, jqxgrid.sort.js, jqxdraw.js, jqxchart.core.js, jqxchart.api.js, jqxwindow.js, jqxgrid.columnsresize.js.
It also loads helper scripts of this demo site, which are not part of the library: generatedata.js (generatedata(), random sample rows), demos.js (getWidth() and other layout helpers).
window.onload = function() {
var grid = new jqxGrid("#jqxgrid", {
width: '100%',
autoheight: true,
rendertoolbar: function(toolbar){
var template = document.getElementById('toolbarTemplate');
var chartToolbar = document.importNode(template.content, true);
var toolbarElement = toolbar[0];
toolbarElement.appendChild(chartToolbar);
toolbarElement.querySelector('#column').addEventListener('click', function () {
grid.createChart('column');
});
toolbarElement.querySelector('#line').addEventListener('click', function () {
grid.createChart('line');
});
toolbarElement.querySelector('#pie').addEventListener('click', function () {
grid.createChart('pie');
});
toolbarElement.querySelector('#bar').addEventListener('click', function () {
grid.createChart('bar');
});
toolbarElement.querySelector('#area').addEventListener('click', function () {
grid.createChart('area');
});
toolbarElement.querySelector('#scatter').addEventListener('click', function () {
grid.createChart('scatter');
});
},
source: {
localData: [
{ Name: 'Zavier Vargas', Income: 59039, Expenses: 13303, Debt: 15000 },
{ Name: 'Mark Beasley', Income: 22468, Expenses: 7600, Debt: 0 },
{ Name: 'Skyla Khan', Income: 111459, Expenses: 101009, Debt: 7300 },
{ Name: 'Deandre Weber', Income: 28233, Expenses: 31045, Debt: 21000 },
{ Name: 'Isla Doyle', Income: 92030, Expenses: 90581, Debt: 160000 },
{ Name: 'Jaslyn Barron', Income: 112083, Expenses: 100322, Debt: 43500 },
{ Name: 'Monserrat Mccann', Income: 92510, Expenses: 28345, Debt: 17890 },
{ Name: 'Britney Fuller', Income: 55091, Expenses: 55020, Debt: 31000 },
{ Name: 'Bernard Munoz', Income: 10030, Expenses: 43012, Debt: 30000 },
{ Name: 'Sherlyn Vincent', Income: 81209, Expenses: 14390, Debt: 3000 }
],
dataFields: [{
name: 'Name',
type: 'string'
}, {
name: 'Income',
type: 'number'
}, {
name: 'Expenses',
type: 'number'
}, {
name: 'Debt',
type: 'number'
}],
datatype: "array"
},
showtoolbar: true,
toolbarheight: 50,
sortable: true,
ready: function () {
},
selectionmode: 'multiplecellsadvanced',
columns: [
{ text: 'Name', dataField: 'Name', width: '25%'},
{ text: 'Income (2026)', dataField: 'Income', cellsFormat: 'c0', width: '25%' },
{ text: 'Expenses (2026)', dataField: 'Expenses', cellsFormat: 'c0', width: '25%' },
{ text: 'Remaining Debt', dataField: 'Debt', cellsFormat: 'c0' }
]
});
}
<template id="toolbarTemplate">
<div id="toolbar">
<div id="column">Column</div>
<div id="line">Line</div>
<div id="pie">Pie</div>
<div id="bar">Bar</div>
<div id="area">Area</div>
<div id="scatter">Scatter</div>
</div>
</template>
<div id="jqxgrid"></div>