highcharts + sharepoint 2010-呈现空白页

问题描述 投票:0回答:0

我在使用SPservices在sharepoint 2010中使用highcharts时遇到问题; 由于某种原因,我根本无法渲染图表,并且剩下一个完全空白的页面。 我正在尝试清理代码中的错误,但似乎找不到任何明显的错误。 我已经用自己的代码进行了测试,并具有相同的空白页,现在尝试使用别人指出的在他们的环境中工作的其他人,它们产生了相同的结果。 任何见解将不胜感激。 先感谢您。

<script type="text/javascript">
$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    CAMLQuery: "<Query><OrderBy><FieldRef Name='Phase'/></OrderBy></Query>",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title'/></ViewFields>",
    listName: "{5C783CEC-4E49-4DAD-B833-CD1F049C114D}",
    completefunc: processData
  });


function processData(xData, status) {
  var progData = [];

  $(xData.responseXML).SPFilterNode("z:row").each(function() {
    progData.push({
      project: $(this).attr('ows_Title'),
      phase: $(this).attr('ows_Phase'),
      status: $(this).attr('ows_Status'),

    });
  });

  var chartData = [];
  var phaseData = _.groupBy(progData, 'phase');

  _.each(phaseData, function(row) {
    var phaseCount = row.length;

    chartData.push({
      name: row[0].phase,
      y: phaseCount
    });

  });

  renderChart(chartData);
});

function renderChart(data) {
  var chart = new Highcharts.Chart({
    chart: {
      renderTo: 'programchart',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false
    },
    credits: {
      enabled: true
    },
    title: {
      text: 'Program by Phase'
    },
    plotOptions: {
      pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
          enabled: true,
          color: '#000000',
          connectorColor: '#000000',
          formatter: function() {
            return '<b>' + this.point.name + '</b>: ' + this.y + ' Times';
          }
        },
      }
    },
    series: [{
      type: 'pie',
      name: 'Phase Count',
      data: data
    }]
  });
});



});

</script>
<div id="programchart"></div>

如果有所作为,我正在使用jquery 1.8和spservices 2014。

javascript jquery sharepoint highcharts sharepoint-2010
© www.soinside.com 2019 - 2024. All rights reserved.