如何通过wcf rest服务将数据发送到jquery折线图? [英] How to send data through wcf rest service to jquery line charts?

查看:43
本文介绍了如何通过wcf rest服务将数据发送到jquery折线图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiii

我正在做jquery折线图。我通过提供静态数据来做到这一点,但是如何通过wcf restful服务提供动态数据呢?

如何将wcf restful服务数据用于数组...

please帮我...



我试过这个..

Hiii
I am doing jquery line charts. I did that by giving static data but how to do by giving dynamic data through wcf restful service?
how to consume wcf restful service data into an array...
please help me...

I tried this..

<!DOCTYPE html>
<html lang="en">
<head>
    <title id='Description'>jqxChart Line Series Data Points</title>
    <link rel="stylesheet" href="scripts/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="scripts/jqxcore.js"></script>
    <script type="text/javascript" src="scripts/jqxdata.js"></script>
    <script type="text/javascript" src="scripts/jqxchart.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            // prepare chart data as an array
            jQuery.ajax({

                //url : "http://localhost:30082/restfrchrst.svc?wsdl",
                // prepare the data
                source :
                 {
                     url : "http://localhost:30082/restfrchrst.svc?wsdl",
                     datatype: "json",
                     datafields: [ { name: 'marks' }, { name: 'progress(%)'} ],
                     url: url,
                     type:"GET",
                 }
            })
            var dataAdapter = new $.jqx.dataAdapter(source);

            var settings = {
                title: "Fitness & exercise weekly scorecard",
                description: "Time spent in vigorous exercise by activity",
                enableAnimations: true,
                showLegend: true,
                padding: { left: 10, top: 5, right: 10, bottom: 5 },
                titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
                source: dataAdapter,
                categoryAxis:
                    {
                        text: 'Category Axis',
                        textRotationAngle: 0,
                        dataField: 'Day',
                        showTickMarks: true,
                        valuesOnTicks: false,
                        tickMarksInterval: 1,
                        tickMarksColor: '#888888',
                        unitInterval: 1,
                        gridLinesInterval: 1,
                        gridLinesColor: '#888888',
                        axisSize: 'auto'
                    },
                colorScheme: 'scheme05',
                seriesGroups:
                    [
                        {
                            type: 'line',
                            showLabels: true,
                            symbolType: 'circle',
                            valueAxis:
                            {
                                unitInterval: 10,
                                minValue: 0,
                                maxValue: 100,
                                description: 'Marks in test',
                                axisSize: 'auto',
                                tickMarksColor: '#888888'
                            },
                            series: [  { dataField: 'Marks', displayText: 'Student Marks' } ]
                        }
                    ]
            };
            // setup the chart
            $('#jqxChart').jqxChart(settings);
            });
    </script>
</head>
<body class='default'>
    <div id='jqxChart' style="width:680px; height:400px">
    </div>
</body>
</html>





但没有得到帮助......



but not getting help me...

推荐答案

(document).ready(function(){
//将图表数据准备为数组
jQuery.ajax({

// url:http:/ /localhost:30082/restfrchrst.svc?wsdl,
//准备数据
来源:
{
url:http:// localhost:30082 / restfrchrst.svc ?wsdl,
数据类型:json,
数据字段:[{name:'marks'},{name:'progress(%)'}],
url:url,
类型:GET,
}
})
var dataAdapter = new
(document).ready(function () { // prepare chart data as an array jQuery.ajax({ //url : "http://localhost:30082/restfrchrst.svc?wsdl", // prepare the data source : { url : "http://localhost:30082/restfrchrst.svc?wsdl", datatype: "json", datafields: [ { name: 'marks' }, { name: 'progress(%)'} ], url: url, type:"GET", } }) var dataAdapter = new


.jqx.dataAdapter(source );

var settings = {
title:Fitness& exercise weekly scorecard,
description:通过活动进行剧烈运动所花费的时间,
enableAnimations:true ,
showLegend:true,
padding:{left:10,top:5,right:10,bottom:5},
titlePadding:{left:90,top:0,right: 0,bottom:10},
source:dataAdapter,
categoryAxis:
{
text:'Category Axis',
textRotationAngle:0,
dataField :'Day',
showTickMarks:true,
valuesOnTicks:false,
tickMarksInterval:1,
tickMarksColor:'#888888',
unitInterval:1,
gridLinesInterval:1,
gridLinesColor:'#888888',
axisSize:'auto'
},
colorScheme:'scheme05',
seriesGroups:
[
{
类型:'line',
showLabels:true,
symbolType:'circle',
valueAxis:
{
unitInterval:10,
minValue :0,
maxValue:100,
描述:'测试中的标记',
axisSize:'auto',
tickMarksColor:'#888888'
},
系列:[{dataField:'Marks',displayText:'Student Marks'}]
}
]
};
//设置图表
.jqx.dataAdapter(source); var settings = { title: "Fitness & exercise weekly scorecard", description: "Time spent in vigorous exercise by activity", enableAnimations: true, showLegend: true, padding: { left: 10, top: 5, right: 10, bottom: 5 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: dataAdapter, categoryAxis: { text: 'Category Axis', textRotationAngle: 0, dataField: 'Day', showTickMarks: true, valuesOnTicks: false, tickMarksInterval: 1, tickMarksColor: '#888888', unitInterval: 1, gridLinesInterval: 1, gridLinesColor: '#888888', axisSize: 'auto' }, colorScheme: 'scheme05', seriesGroups: [ { type: 'line', showLabels: true, symbolType: 'circle', valueAxis: { unitInterval: 10, minValue: 0, maxValue: 100, description: 'Marks in test', axisSize: 'auto', tickMarksColor: '#888888' }, series: [ { dataField: 'Marks', displayText: 'Student Marks' } ] } ] }; // setup the chart


('#jqxChart')。jqxChart(settings);
});
< / script >
< / head >
< body class =' 默认' >
< div id =' jqxChart' style = width:680px; height:400px >
< / div >
< / body >
< / html > ;
('#jqxChart').jqxChart(settings); }); </script> </head> <body class='default'> <div id='jqxChart' style="width:680px; height:400px"> </div> </body> </html>





但没有得到帮助......



but not getting help me...


这篇关于如何通过wcf rest服务将数据发送到jquery折线图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆