【问题标题】:Google Line Chart: Disable list of variable names assigned to colors谷歌折线图:禁用分配给颜色的变量名称列表
【发布时间】:2014-04-13 09:39:22
【问题描述】:

我想禁用或隐藏分配给 Google 折线图中不同颜色曲线的变量名称列表。

            var options = {
                curveType: 'function',
                title: 'Profit Graph',
                backgroundColor: {fill:'transparent'},
                            // option to disable color-variable mapping ?? 
            };

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

可选:如果可能的话,我希望能够使用回调函数自定义列表格式(带有附加数据)。

【问题讨论】:

    标签: javascript graph google-visualization


    【解决方案1】:

    这由legend 选项控制。要隐藏它,您必须使用:

            legend: {
                position: 'none'
            }
    

    如何自定义?问题How to add Percentage and Total on the Legend of Google Pie Charts 中描述了一种可能性。它适用于饼图,但该解决方案也可以用于折线图。

    【讨论】:

      猜你喜欢
      • 2020-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 2022-01-16
      • 2014-07-07
      相关资源
      最近更新 更多