首页 文章

如何在ng2-google-charts中绘制x轴和y轴原点线?

提问于
浏览
0
options: {
        height: '100%', width: '90%', backgroundColor: 'transparent',
        tooltip: {
            isHtml: true,
            trigger: 'selection'
        },
        hAxis: { textPosition: 'none', logscale: true  },
        chartArea: {
            width: "78%",
            'backgroundColor': {
                'fill': '#ffffff',
                'opacity': 100
            },
        },
        vAxis: {
            textStyle: {
                fontSize: 13 // or the number you want
            },
            viewWindow: {
                min: 0,
                max: 100
            },
            gridlines: {
                color: 'transparent'
            },
            ticks: [0, 25, 50, 75, 100] // display labels every 25
        },
        legend: { position: 'none' },
        colors: ["orange", "orange", "orange", "orange", "orange", "orange", "orange", "orange", "orange", "orange"]
    },

我使用上面的选项来隐藏网格线,但在我的情况下,我想在柱形图中单独绘制x轴和y轴原点线 .

 above options graph

x轴正确但在y轴原点线上我无法绘制 .

谁可以帮我这个事 . 提前致谢 .

1 回答

  • 0

    试试这个

    hAxis: {
      baselineColor: 'black',
      ticks: []
    },
    vAxis: {
      baselineColor: 'black',
      ticks: []
    }
    

    hAxis的基线是垂直线,vAxis的基线是水平线 . 因此,如果要删除水平黑线,则需要设置vAxis baselineColor,反之亦然 .

相关问题