相关疑难解决方法(0)

jqPlot的JSON

我想使用来自服务器端的jqPlot usinge数据来自JSON,如本例中所述:http://www.jqplot.com/tests/data-renderers.php

我的代码几乎与示例相同:

function myGraph(jsonurl) {

  var ajaxDataRenderer = function(url, plot, options) {
    var ret = null;
    $.ajax({
      // have to use synchronous here, else the function
      // will return before the data is fetched
      async: false,
      url: url,
      dataType:"json",
      success: function(data) {
        ret=data;
        console.warn(data);
      }
    });
    return ret;
  };



var plot1 = $.jqplot('chartdiv', jsonurl, {
      title: 'myTitle',
      dataRenderer: ajaxDataRenderer,
      dataRendererOptions: {  unusedOptionalUrl: jsonurl    },
      series: [{
          label: 'myLabel',
          neighborThreshold: -1
      }],
      axes: {
          xaxis: {
              renderer: $.jqplot.DateAxisRenderer, …
Run Code Online (Sandbox Code Playgroud)

javascript arrays json getjson jqplot

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

getjson ×1

javascript ×1

jqplot ×1

json ×1