How to change the X and Y axis names of Pie chart

2019-03-03 16:45发布

HI all i am some data in a pie chart...on hover of slice i get the hover like this

    [Hr Resources:x=Hr Resources,y=12]

i want my tooltip to show like this

    [ProjectName=Hr,Logged Bugs=12]

how do i do this..here is how i am binding my data to the pie chart

    <script type="text/javascript">
  $(function () {
      $.getJSON('<%= Url.Action("GetData","JqueryCharts") %>', {}, function (data) {
          var json = data;
          alert(json);
          var jsondata = [];              
          for (var i in json) {
             // var serie = new Array(json[i].Projects, json[i].Bugs);
              jsondata.push([json[i].Projects, json[i].Bugs]);
          }              
      var chart = new Highcharts.Chart({
          chart: {
              renderTo: 'container',
              type: 'pie',
               plotBackgroundColor: null,
               plotBorderWidth: null,
               plotShadow: false
          },
           title: {
               text: 'Resource Reports of BugTracker'
           },              
          plotOptions: {
              pie: {
                  showInLegend: true,
                  animation: false,
                  allowPointSelect: true,
                  cursor: 'pointer'
              }
          },
          legend: {
              enabled: true
          },
          series: [{
              type: 'pie',
              name: 'Resource Reports',
              data: jsondata
          }]
      });
      });
  });
    </script>

can any one help where i have to change this

1条回答
聊天终结者
2楼-- · 2019-03-03 17:36

By default, Highchart tooltip picks up, series name in the tooltip.

You can customize tooltip using:

tooltip: {
    formatter: function() {
          return '<b>ProjectName = '+ this.point.name +', Logged Bugs= '+ this.y + '</b>';
    }
}

Here is the example

Highchart has a very good documentation at :http://api.highcharts.com/highcharts#tooltip

查看更多
登录 后发表回答