【问题标题】:How to change the X and Y axis names of Pie chart High Chart?如何更改饼图 High Chart 的 X 轴和 Y 轴名称?
【发布时间】:2012-08-24 08:36:24
【问题描述】:

大家好,我是饼图中的一些数据...在切片悬停时,我会像这样悬停

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

我希望我的工具提示显示为这样

    [ProjectName=Hr,Logged Bugs=12]

我该怎么做..这是我将数据绑定到饼图的方式

    <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>

任何人都可以帮助我改变这个

【问题讨论】:

    标签: highcharts pie-chart


    【解决方案1】:

    默认情况下,Highchart 工具提示会选择工具提示中的系列名称。

    您可以使用以下方式自定义工具提示:

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

    这里是example

    Highchart 有一个非常好的文档:http://api.highcharts.com/highcharts#tooltip

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-29
      • 2018-11-29
      • 1970-01-01
      • 2015-03-10
      • 1970-01-01
      相关资源
      最近更新 更多