jQWidgets Forums
jQuery UI Widgets › Forums › Chart › Error in chart data sources
Tagged: charting
This topic contains 2 replies, has 2 voices, and was last updated by ntmhung 10 years, 7 months ago.
-
Author
-
I have copied the first source code from http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-data-source.htm, however it appeared a blank page when I ran the website on localhost. In <script type=”text/javascript” src=”../../scripts/jquery-1.11.0.min.js”></script>, but in the scripts folder there is only file jquery-1.11.1.min.js. I think it cause such error but I’m not sure about that. Could anyone try this and give me answers, please?
Hi ntmhung,
You can use any jQuery 1.7+ version. It is not necessary to be exactly 1.11.0 or 1.11.1. However, the Script’s URL should be correct.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Here is my code :
<!DOCTYPE html>
<html lang=”en”>
<head>
<title id=’Description’>jqxChart Line Series Example</title>
<link rel=”stylesheet” href=”jqwidgets-ver3.6.0/jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”jqwidgets-ver3.6.0/scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.6.0/jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.6.0/jqwidgets/jqxdata.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.6.0/jqwidgets/jqxchart.core.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.6.0/jqwidgets/jqxdraw.js”></script>
<script type=”text/javascript”>
$(document).ready(function () {
// prepare the data
var source = { datafields: [{ name: ‘Date’, type: ‘date’ },{ name: ‘Quantity’ },{ name: ‘Description’ }],
root: “Orders”,
record: “Order”,
datatype: “xml”,
url: ‘xmldata.xml’
}
var dataAdapter = new $.jqx.dataAdapter(source);
// prepare jqxChart settings
var settings = {
title: “Order Details”,
showLegend: true,
source: dataAdapter,
categoryAxis: {
type: ‘date’,
baseUnit: ‘month’,
dataField: ‘Date’,
formatFunction: function (value) {
var months = [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’];
return months[new Date(value).getMonth()];
},
showGridLines: true
},
colorScheme: ‘scheme04’,
seriesGroups:[{
type: ‘line’,
valueAxis:{
displayValueAxis: true,
axisSize: ‘auto’,
tickMarksColor: ‘#888888’
},
series: [{ dataField: ‘quantity’, displayText: ‘Quantity’ }],}]
};
//alert (settings.seriesGroup.series);
// setup the chart
$(‘#jqxChart’).jqxChart(settings);
});</script>
</head>
<body class=’default’>
<div id=’jqxChart’ style=”width: 680px; height: 400px”>
</div>
</body>
</html>But it only shows the xAxis, yAxis, the description, there is no month or quantity or line
-
AuthorPosts
You must be logged in to reply to this topic.