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

梦想与她 提交于 2019-12-31 05:15:11

问题


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:


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



来源:https://stackoverflow.com/questions/12105829/how-to-change-the-x-and-y-axis-names-of-pie-chart-high-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!