DevExtreme v23.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JSON Data

If your server stores data in JSON format, you do not need to make AJAX requests to get the data. Instead, assign the URL of your data storage to the Chart's dataSource property. To configure how the component displays data, specify the series type and its nested options: argumentField and valueField, so the component can determine the object fields that indicate Chart arguments and values in JSON.

Note that you can also use a JSONP callback parameter supported by jQuery.ajax() in the dataSource.

Backend API
$(() => { $('#chart').dxChart({ rotated: true, dataSource: '../../../../data/simpleJSON.json', series: { label: { visible: true, backgroundColor: '#c18e92', }, color: '#79cac4', type: 'bar', argumentField: 'day', valueField: 'sales', }, title: 'Daily Sales', argumentAxis: { label: { customizeText() { return `Day ${this.valueText}`; }, }, }, valueAxis: { tick: { visible: false, }, label: { visible: false, }, }, export: { enabled: true, }, legend: { visible: false, }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/23.2.5/css/dx.light.css" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="chart"></div> </div> </body> </html>
#chart { height: 440px; }
[ { "day": "1", "sales": 4 }, { "day": "2", "sales": 2 }, { "day": "3", "sales": 10 }, { "day": "4", "sales": 7 }, { "day": "5", "sales": 7 }, { "day": "6", "sales": 6 }, { "day": "7", "sales": 2 }, { "day": "8", "sales": 2 }, { "day": "9", "sales": 4 }, { "day": "10", "sales": 9 } ]