javascript - 如何删除谷歌图表中的彩色线条示例标签

标签 javascript charts google-visualization

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

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%"
        });

最佳答案

您的选项定义中有额外的花括号
导致两个对象而不是一个
所以图表仅使用 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%"
  }
});

关于javascript - 如何删除谷歌图表中的彩色线条示例标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46486036/

相关文章:

javascript - 简单脚本不运行

php - 折线图生成

javascript - Flot - 绘制带有时间的图表不起作用

javascript - 将图表类型参数传递给自定义函数作为谷歌图表函数

php - 谷歌在laravel中绘制标题中的字符重音

javascript - 如何将自动完成值添加到列表中?

javascript - ngFor 隐藏取消隐藏详细信息

javascript - 禁用带有特定 Div ID 的输入的 Tab 键

javascript - 创建叠加折线图

javascript - 将 Google Charts API 与 PHP 来源的值一起使用