jQWidgets Forums
Forum Replies Created
-
Author
-
April 7, 2017 at 10:29 am in reply to: Setting JSON object in JQWIDGET chart Setting JSON object in JQWIDGET chart #92784
I got the solution from JQWidget Chart data source article:
var source =
{
datatype: “json”,
datafields: [
{ name: ‘product’},
{ name: ‘quantity’},
{ name: ‘quantity_sold’}
],
url: ‘json/json.js’
};var dataAdapter = new $.jqx.dataAdapter(source,
{
autoBind: true,
async: false,
downloadComplete: function () { },
loadComplete: function () { },
loadError: function () { }
});// prepare jqxChart settings
var settings = {
title: “Products and their quantities”,
description: “Products sold”,
padding: { left: 5, top: 5, right: 5, bottom: 5 },
titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
source: dataAdapter,
categoryAxis:
{
dataField: ‘product’,
showGridLines: true
},
colorScheme: ‘scheme01’,
seriesGroups:
[
{
type: ‘column’,
columnsGapPercent: 30,
seriesGapPercent: 0,
valueAxis:
{
minValue: 0,
maxValue: 220,
unitInterval: 10,
description: ‘Quantity in KG’
},
series: [
{ dataField: ‘quantity’, displayText: ‘Total’},
{ dataField: ‘quantity_sold’, displayText: ‘Sold’},
]
}
]
};
// setup the chart
$(‘#chartContainer’).jqxChart(settings); -
AuthorPosts