如何在Highchart中动态对齐3D饼图

时间:2019-12-23 13:01:38

标签: ajax highcharts

我是新手,图表很高,在集成数据时遇到问题。饼图显示了准确的数据,但未设置对齐方式。

In this image a pie chart on the left is working perfectly.

var user_daily=new Highcharts.chart('user_data', {
    chart: {
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 45,
            beta: 0
        }
    },
    title: {
        text: 'Employee Record'
    },
    accessibility: {

    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.y}</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            depth: 35,
            dataLabels: {
                enabled: true,
                format: '{point.name}',

            },

        }
    },
    series: [{
        type: 'pie',
        name: 'Employee Entries',
        data: [
            ['Default', 45.0],

        ]
    }]
});
    var chart =new Highcharts.chart('container', {
            chart: {
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false,
              type: 'pie'
            },
            title: {
              text: "User's Daily Entries  "
            },
            tooltip: {
              pointFormat: '{series.name}: <b>{point.y}</b>'
            },
            plotOptions: {
              pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                  enabled: true
                },
                showInLegend: false
              }
            },
            series: [{
                 name: 'Entries',
                 colorByPoint: true,
                 data: [{ name:'',y:22 }

                 ]
            }]
          });

关于更改功能:-

  type:'post',
  url:'user_daily_graph.jsp',
  data:{
      user_id:$('#ad_user_id').val(),
      date:$('#Daily_graph_date').val(),
  },
  success:function(msg){
      msg=msg.trim();

        list=msg.split("!!");
        user_daily.redraw();
        while(user_daily.series.length > 0)
            user_daily.series[0].remove(true);
        user_daily.addSeries({  
             type: 'pie',
            name: 'Entries'


        }, false);

        for(var i=1;i<list.length;i++){

            if(list[i].length!=0){

                temp2=list[i].split("!@")

                user_daily.series[0].addPoint({
                       name: temp2[0],
                        y: parseInt(temp2[1]),
                    },true);
            }
        }


  }

在页面加载时,图形停留在应该位于的位置。当我单击功能时,它显示数据,但对齐方式出错。

0 个答案:

没有答案