我正在Google电子表格中使用迷你图功能。这是一些数据的示例:

Feb-2015    MTD Actual  MTD Budget  Budget
Campaign 1  $41.32       $13.71   $96.00


我想根据文档here创建堆积的条形图迷你图。

=sparkline(D9:F9,{
    "charttype","bar";
    "color1","blue";
    "color2","yellow";
    "color3","red"})


D9:F9对应于$ 41.42:$ 96

结果如下所示:


我曾期望一个段是红色的(color3)。但是迷你图似乎只能自定义2种颜色。在文档中看不到任何有关此的内容。这是一个错误吗?还是我误会了什么?

如果我只能使用此功能编辑2种颜色,我不认为可以使用Google-Apps-Script编辑该功能吗?

最佳答案

条形图仅列出了color1和color2选项。迷你图未明确显示给Apps脚本,但可以作为值写入到单元格中。例如:

ss.appendRow(['==sparkline(D9:F9,{"charttype","bar";"color1","blue";"color2","yellow";})']);


从文档:
https://support.google.com/docs/answer/3093289?hl=en

For bar charts:

"max" sets the maximum value along the horizontal axis.
"color1" sets the first color used for bars in the chart.
"color2" sets the second color used for bars in the chart.
"empty" sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".
"nan" sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".
"rtl" determines whether or not the chart is rendered right to left. Options are true or false.

09-26 12:52