jqplot咋使用啊

luwinner 2013-12-31 05:54:12
我的图表用了dateaxisrenderer插件,横坐标显示月份,纵坐标显示数量。
jqplot的data 如何获取获取啊,求例子。。。。
...全文
273 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
luwinner 2013-12-31
  • 打赏
  • 举报
回复
引用 6 楼 defonds 的回复:
后台不要用 rowMapList 类型返回 json。 用 java.util.List 试试
好,试试先
Defonds 2013-12-31
  • 打赏
  • 举报
回复
后台不要用 rowMapList 类型返回 json。 用 java.util.List 试试
luwinner 2013-12-31
  • 打赏
  • 举报
回复
引用 4 楼 defonds 的回复:
引用 1 楼 luwinner 的回复:
如何从后台获取到那个data????
后台把 data 以 json 格式传给前台就可以了。
后台是map<String,Object> rowMapList类型 ,返回数据是[{salary:1000}], 这个怎么转换成前台用的这种格式data= [['2013-10-10',1000]].
Defonds 2013-12-31
  • 打赏
  • 举报
回复
引用 1 楼 luwinner 的回复:
如何从后台获取到那个data????
后台把 data 以 json 格式传给前台就可以了。
luwinner 2013-12-31
  • 打赏
  • 举报
回复
有谁用过的吗,急啊
Defonds 2013-12-31
  • 打赏
  • 举报
回复
jqplot 获取 json 数据的例子:
$.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    data: JSON.stringify(DTO), //JSON.stringify(AnDParms), combined, 
    url: "GetAdmitsDischarges.asmx/GetAandD",
    dataType: "json",
    success: function (data) {
        //do chart stuff here.
        var line1 = [];
        for (var prop_name in data.d) {
            line1.push([prop_name, data[prop_name]])
        }
        var ticks = ['Admits', 'Discharges'];

        var plot1 = $.jqplot('chartdiv', [line1], {
            title: 'Admits & Discharges',
            series: [{ renderer: $.jqplot.BarRenderer}],
            axesDefaults: {
                tickRenderer: $.jqplot.CanvasAxisTickRenderer
            },
            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer
                }
            }
        });
        //to prove the flow is working...
        //alert("Data: " + data.d);

    }, //end of success
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert(textStatus + ' ' + errorThrown + ' ' + XMLHttpRequest);
    } //end of error
});   //end of ajax call
luwinner 2013-12-31
  • 打赏
  • 举报
回复
如何从后台获取到那个data????

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧