Highcharts图表未显示

时间:2017-05-16 12:36:00

标签: javascript jquery highcharts

我正在使用Highcharts创建图表,当ajax调用成功时,我将数据呈现给div,它显示为空

我的ajax电话

  var mWhereParam = { arrSelectedValues: arrSelectedValues };

    $.ajax({
        type: "POST",
        url: "OssmWebService.asmx/FillChart",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(mWhereParam),
        dataType: "json",
        success: function (data1) {
            debugger;
         //   var ChartData = data1.d;


            var Graph = "line"

          Highcharts.setOptions({
              chart: {
                  type: Graph
              },

              credits: {
                  enabled: false
              },


              options3d: {
                  enabled: true,
                  alpha: 15,
                  beta: 15,
                  depth: 50,
                  viewDistance: 25
              },

              //title: { text: ''},
              //subtitle: { text:''},
              //xAxis: { categories: '' },
              yAxis: {
                  // reversed: true,
                  title: {
                      text: 'Rank'
                  },

                  labels: {
                      formatter: function () {
                          return this.value ;
                      }
                  },
              },
              xAxis: {
                  labels : {
                      useHTML: true,
                      formatter: function() {
                          return this.value; // clean, unformatted number for year
                      }
                  }

              },
              plotOptions: {
                  series: {
                      animation: {
                          duration: 4000,
                      }
                  },
              },
              tooltip: {
                  headerFormat: '<b>{series.name}</b><br/>',
                  //animation: [true],
                  // pointFormat: '{point.x} Year: {point.y}'
              },
              //series: ''

              //legend: {
              //    layout: 'vertical',
              //    align: 'right',
              //    verticalAlign: 'middle',
              //    borderWidth: 0
              //},

          });

          debugger;
                var chart1 = new Highcharts.Chart({
                    chart:{renderTo:'container1'},
                    //   title : {text :'<% = ViewState["DbTitle"].ToString() + " --  " + ViewState["DbSubTitle"].ToString() %>'},
                    title : data1.d



                });






            debugger;
            console.log(data1);
            console.log('success');
        }

    });


})

我的数据是ajax成功的

"{ text :'Basic Requirement'}, subtitle : { text : 'Basic Requirement'}, xAxis: { categories:['2010-2011','2011-2012','2012-2013','2013-2014','2014-2015','2015-2016','2016-2017']},
 series:[{ name: 'Basic Requirement-Oman', data: [24,20,15,13,19,29,42] , visible : true ,  dataLabels: {  enabled: true } },
{ name: 'Efficiency Enhancers-Oman', data: [48,45,45,39,49,63,63] } ] " 

和我的Html Div

它在表格上显示如下 Chart

请告诉我,我的错误是数据存在问题还是什么?无法弄清楚。

0 个答案:

没有答案