如何删除谷歌图表中的颜色线示例标签

时间:2017-09-29 09:37:05

标签: javascript charts google-visualization

如何删除Google图表中的彩色线条示例?我的意思是附图中右侧的线条示例

enter image description here

exampleChart.draw(view, {
        vAxis: {
            viewWindow: {
                min: 0
            },
            viewWindowMode: "explicit"
        }
    }, {
        legends: "none",
        curveType: "function",
        backgroundColor: "#000",
        fontSize: "18",
        colors: ["#000"],
        series: {
            1: {
                lineDashStyle: [0, 0]
            }
        },
        lineWidth: 1,
        chartArea: {
            width: "100%"
        });

3 个答案:

答案 0 :(得分:1)

您的选项定义中有额外的花括号 导致两个对象而不是一个对象 因此图表仅使用vAxis定义

{
    vAxis: {
        viewWindow: {
            min: 0
        },
        viewWindowMode: "explicit"
    }
}, {   // <-- remove these, add comma above
    legend: "none",
    curveType: "function",
    backgroundColor: "#000",
    fontSize: "18",
    colors: ["#000"],
    series: {
        1: {
            lineDashStyle: [0, 0]
        }
    },
    lineWidth: 1,
    chartArea: {
        width: "100%"
    });

请参阅以下摘录...

chart.draw(view, {
  vAxis: {
    viewWindow: {
      min: 0
    },
    viewWindowMode: "explicit"
  },
  legend: "none",
  curveType: "function",
  backgroundColor: "rgb(238, 238, 238)",
  fontSize: "10",
  colors: ["#176bad"],
  series: {
    1: {
      lineDashStyle: [0,0]
    }
  },
  lineWidth: 0,
  chartArea: {
    width: "100%"
  }
});

答案 1 :(得分:0)

请尝试以下脚本,

exampleChart.draw(view, {
    vAxis: {
        viewWindow: {
            min: 0
        },
        viewWindowMode: "explicit"
    }
}, {
    legend: "none",
    curveType: "function",
    backgroundColor: "#000",
    fontSize: "18",
    colors: ["#000"],
    series: {
        1: {
            lineDashStyle: [0, 0]
        }
    },
    lineWidth: 1,
    chartArea: {
        width: "100%"
    });

答案 2 :(得分:0)

这称为“图例”,可以通过line charts configuration options中指定的设置添加legend: "none"来删除。