数据不绑定到jqxcharts? [英] Data not binding to jqxcharts?
本文介绍了数据不绑定到jqxcharts?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hiii
我正在尝试为jqx图表动态绑定数据...
我试过这个但没有得到图表。
这是我的代码...
Hiii
I am trying to bind data dynamically for jqx charts...
I have tried this but not getting the chart.
Here is my code...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="charts.aspx.cs" Inherits="charts" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title id='Description'>jqxChart Line Series Example</title>
<link href="scripts/jqx.base.css" rel="stylesheet" type="text/css" />
<link href="scripts/jqx.classic.css" rel="stylesheet" type="text/css" />
<script src="scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="scripts/jqxcore.js" type="text/javascript"></script>
<script src="scripts/jqxdata.js" type="text/javascript"></script>
<script src="scripts/jqxchart.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var source = {};
$.ajax({
type: 'GET',
dataType: 'json',
async: false,
url: 'http://localhost:30082/restfrchrst.svc/GetChartdetails',
cache: false,
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert(data);
source = $.parseJSON(data.d);
},
error: function (err) {
alert('Error');
}
});
// prepare jqxChart settings
var settings = {
title: "student marks",
description: "Progress of student",
showLegend: true,
padding: { left: 5, top: 5, right: 5, bottom: 5 },
titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
source: source,
categoryAxis:
{
dataField: 'marks',
showGridLines: true
},
colorScheme: 'scheme01',
seriesGroups:
[
{
type: 'line',
columnsGapPercent: 50,
seriesGapPercent: 0,
valueAxis:
{
unitInterval: 50,
minValue: 200,
maxValue: 600,
displayValueAxis: true,
description: 'Marks in tests' ,
axisSize: 'auto',
tickMarksColor: '#888888'
},
series: [
{ dataField: 'marks', displayText: 'marks' },
{ dataField: 'progress', displayText: 'progress' },
]
}
]
};
$('#jqxChart').jqxChart(settings);
});
</script>
</head>
<body>
<div id="jqxChart" style="width: 600px; height: 400px;"></div>
</body>
</html>
帮我解决..
help me out..
推荐答案
( document )。ready( function (){
var source = {};
(document).ready(function () { var source = {};
.ajax({
type:' GET ',
dataType:' json',
async: false ,
url:' http:/ /localhost:30082/restfrchrst.svc/GetChartdetails',
cache: false ,
contentType:' application / json; charset = utf-8',
成功: function (数据){
alert(data);
source =
.ajax({ type: 'GET', dataType: 'json', async: false, url: 'http://localhost:30082/restfrchrst.svc/GetChartdetails', cache: false, contentType: 'application/json; charset=utf-8', success: function (data) { alert(data); source =
.parseJSON(data.d);
},
错误: function (错误){
alert(' 错误');
}
});
// 准备jqxChart设置
var settings = {
title: student marks,
description: 学生进度,
showLegend: true ,
padding:{left: 5 ,top: 5 ,right: 5 ,bottom: 5 },
titlePadding:{left:< span class =code-digit> 90 ,top: 0 ,right: 0 ,bottom: 10 },
source:source,
categoryAxis:
{
dataField:< span class =code-string>' marks',
showGridLines: true
},
colorScheme:' scheme01',
seriesGroups:
[
{
type:' line',
columnsGapPercent: 50 ,
seriesGapPercent: 0 ,
valueAxis:
{
unitInterval: 50 ,
minValue: 200 ,
maxValue: 600 ,
displayValueAxis: true ,
description:' 测试中的标记',
axisSize:' auto',
tickMarksColor:' #888888'
},
系列:[
{dataField:' marks',displayText:' 标记'},
{dataField:' < span class =code-string> progress',displayText:' progress'},
]
}
]
};
.parseJSON(data.d); }, error: function (err) { alert('Error'); } }); // prepare jqxChart settings var settings = { title: "student marks", description: "Progress of student", showLegend: true, padding: { left: 5, top: 5, right: 5, bottom: 5 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: source, categoryAxis: { dataField: 'marks', showGridLines: true }, colorScheme: 'scheme01', seriesGroups: [ { type: 'line', columnsGapPercent: 50, seriesGapPercent: 0, valueAxis: { unitInterval: 50, minValue: 200, maxValue: 600, displayValueAxis: true, description: 'Marks in tests' , axisSize: 'auto', tickMarksColor: '#888888' }, series: [ { dataField: 'marks', displayText: 'marks' }, { dataField: 'progress', displayText: 'progress' }, ] } ] };
这篇关于数据不绑定到jqxcharts?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文