Google Visualization饼图文本锚点问题和文本被截断

时间:2016-09-12 10:42:39

标签: javascript google-api google-visualization

我正在使用谷歌饼图,一切正常,但右侧的传奇标签被截断。enter image description here

谷歌API中也没有选项来控制这些标签。这是文件 https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options

为whiteHat 请看这里是图像.. 带隐藏div的第一个hide-div

并且div不能隐藏......

no-hide div

1 个答案:

答案 0 :(得分:1)

传说通常会换行,请参阅以下工作片段,
使用附图中显示的选项



google.charts.load('current', {
  callback: function () {
    var container = document.getElementById('chart_div');
    var chart = new google.visualization.PieChart(container);

    var data = google.visualization.arrayToDataTable([
      ['Education', 'People'],
      ['less than high school', 10],
      ['high school', 10],
      ['college associate', 10],
    ]);

    var options = {
      width: '470',
      height: '450',
      chartArea: {
        width: '80%',
        height: '80%',
        left: 100,
      },
      pieSliceTextStyle: {
        color: 'white',
        fontSize: '17.5'
      },
      colors: ['#90c458', '#ff7f66', '#ffce55', '#52c2e8']
    };

    chart.draw(data, options);
  },
  packages: ['corechart']
});

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
&#13;
&#13;
&#13;