【问题标题】:Change static google chart [Bar Chart] background-color更改静态谷歌图表 [条形图] 背景颜色
【发布时间】:2012-12-02 10:01:59
【问题描述】:

我需要更改条形图的谷歌静态图表的背景颜色。任何人有任何解决方案? 现在颜色是白色[#ffffff]

https://chart.googleapis.com/chart?cht=bhs&chd=t:60,40&chs=250x100&chl=Hello|World

【问题讨论】:

    标签: google-visualization


    【解决方案1】:

    您正在寻找类似的参数

    chf=bg,s,ff0000
    

    https://chart.googleapis.com/chart?cht=bhs&chd=t:60,40&chs=250x100&chl=Hello|World&bg=FF0000&chf=bg,s,ff0000
    

    【讨论】:

      【解决方案2】:

      尽管您已将此标记为 CSS/HTML 问题,但在阅读了 Google 上的文档后,javascript 可能会更好地实现这一点。在您的 javascript 代码中,包括以下内容:

          var options = {
      
            //The background color for the main area of the chart. Can be either a simple HTML color string, for example: 'red' or '#00cc00', or an object with the following properties.
            backgroundColor: 'black',
      
            //The color of the chart border, as an HTML color string
            backgroundColor.stroke: 'blue'
      
           //The chart fill color, as an HTML color string
            backgroundColor.fill: 'yellow'
          };
      

      删除不需要的东西。我添加了一些额外的自定义选项。

      来源:Google chart tool documentation。那里有更多的自定义选项。

      【讨论】:

      • 我正在创建的页面必须放在电子邮件中。这是一封电子邮件通讯。地图必须是静态的。无法使用 javascript。