更改 google 张 api 中饼图的文本格式

Change text format on piecharts in google sheets api

我们正在尝试通过 api 为饼图的标题指定特定格式。有什么办法吗?我们知道基本图表有这个功能,但饼图没有。

谢谢。

这似乎没有出现在表格 API 中,但正如 Chart section 所说

The Sheets API does not yet grant full control of charts in Google Sheets. Some chart types and certain chart settings (such as background color or axis label formatting) cannot be accessed or selected with the current API.

关于标题格式,我能找到的最接近的东西是 Google 图表 API、Pie Chart data format

titleTextStyle 指定标题文本样式的 object。 object 具有以下格式:

{ color: <string>,
  fontName: <string>,
  fontSize: <number>,
  bold: <boolean>,
  italic: <boolean> }

所以它看起来像:

 var options = {
        title: 'Popularity of Types of Pizza',
        titleTextStyle: {
            color: <string>,
            fontName: <string>,
            fontSize: <number>,
            bold: <boolean>,
            italic: <boolean> 
        },
        sliceVisibilityThreshold: .2
      };

      var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
      chart.draw(data, options);