【问题标题】:Google Script: setOption chartArea doesn't work in Google Spreadsheet embedded chartbuilderGoogle 脚本:setOption chartArea 在 Google 电子表格嵌入式图表生成器中不起作用
【发布时间】:2017-12-05 20:04:36
【问题描述】:

我想在我的 Google 电子表格中创建一个图表。图表响应除 chartArea 之外的所有选项。我希望我的标签显示在 V 轴的左侧。现在这些隐藏在 chartArea 后面。 (照片)

This chart has the labels hidden behind the chartArea

    var chartBuilder = SS.newChart();
chartBuilder.addRange(range)
.setPosition(10, 2, 0, 0)
   .setChartType(Charts.ChartType.BAR)
     .setOption('height', BVhoogte)
   .setOption('width', 720)
   .setOption('isStacked', true)
   .setOption('legend', { position: "bottom" })
.setOption( 'hAxis', {textStyle:{color:"white"}, gridlines:{color:"white"}})
   .setOption('height', 150)
   .setOption('width',720)
   .setOption('colors', ["#6d6f75","#000000", "#dcdee2"])
   .asBarChart().setOption('chartArea',{ left:200, width: 500}) ;
    SS.insertChart(chartBuilder.build());

我试过了

         .asBarChart().setOption('chartArea.left', 100)

但这也不起作用。

【问题讨论】:

    标签: charts google-apps-script spreadsheet


    【解决方案1】:

    下面的修改怎么样?

    发件人:

    .asBarChart().setOption('chartArea.left', 100)
    

    收件人:

    .asBarChart().setOption('chartArea', {left:'20%', top:'10%', width:"60%", height:"60%"})
    

    关于每个参数,请根据您的设计进行调整。如果这对您没有用,我很抱歉。

    【讨论】:

    • 谢谢,田池。这行得通。绝对值没有。但相对的人做到了。
    • 是的。我可以从你的问题中注意到这一点。也谢谢你。
    猜你喜欢
    • 1970-01-01
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多