Google饼图更改文本对齐方式 [英] Google Pie Chart Change Text Alignment

查看:134
本文介绍了Google饼图更改文本对齐方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的报告,

如何一次而不是滚动地更改我的最低值.

How to change my bottom value one by one instead of scroll.

 var options = {
                legend:'bottom',
                is3D: true
                }

推荐答案

为了在图例上允许多行,
您必须使用图例位置-> 'top'
那么您可以增加-> maxLines

in order to allow multiple lines on the legend,
you must use legend position --> 'top'
then you can increase the number of --> maxLines

legend: {
  position: 'top',
  maxLines: 3
},

来自文档 ...

legend.maxLines-图例中的最大行数.将此数字设置为大于1的数字可向图例添加行.仅当legend.position'top'时,此选项才有效.

legend.maxLines - Maximum number of lines in the legend. Set this to a number greater than one to add lines to your legend. This option works only when legend.position is 'top'.

请参阅以下工作片段...

see following working snippet...

google.charts.load('current', {
  packages: ['corechart', 'table']
}).then(function () {
  var data = google.visualization.arrayToDataTable([
    ['category', 'value'],
    ['Category 1', 34],
    ['Category 2', 18.7],
    ['Category 3', 18.6],
    ['Category 4', 18.6],
    ['Category 5', 10]
  ]);

  var pie = new google.visualization.PieChart(document.getElementById('chart-pie'));
  pie.draw(data, {
    legend: {
      position: 'top',
      maxLines: 3
    },
    height: 400,
    is3D: true,
    width: 400
  });
});

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart-pie"></div>

这篇关于Google饼图更改文本对齐方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆