【问题标题】:Change text format on piecharts in google sheets api在 google sheet api 中更改饼图上的文本格式
【发布时间】:2017-05-09 10:47:23
【问题描述】:

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

谢谢。

【问题讨论】:

    标签: google-sheets google-sheets-api


    【解决方案1】:

    正如Chart section 所说,这似乎还没有出现在 Sheets API 中

    Sheets API 尚未授予对 Google 图表的完全控制权 床单。某些图表类型和某些图表设置(例如 背景颜色或轴标签格式)无法访问或 使用当前 API 选择。

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

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

    { 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);
    

    【讨论】:

    • 感谢您的宝贵时间。我们希望下一个版本将具有此功能。
    猜你喜欢
    • 2021-03-15
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多