nvd3 piechart.js - How to edit the tooltip?

前端 未结 9 1621
别那么骄傲
别那么骄傲 2020-11-27 06:09

I\'m using nvd3\'s piechart.js component to generate a piechart on my site. The provided .js file includes several var\'s, as follows:

var margin = {top: 30,         


        
9条回答
  •  轮回少年
    2020-11-27 06:54

    If you happen to use the Angular NVD3 wrapper, the way to set the custom message is through chart options, simply:

    $scope.options = {
      chart: {
      ...
      tooltip: {
          contentGenerator: function(d) {
              return d.series[0].key + ' ' + d.series[0].value;
          }
      },
      ...
      }
    };
    

提交回复
热议问题