如何从谷歌条形图中删除右侧文字?

时间:2016-06-02 06:26:37

标签: javascript graph google-visualization

我正在使用google bar chart。我想用蓝色迷你矩形删除右侧文字,我用红色圆圈标记。请参见下图: -

enter image description here

这是我的代码: -

var data = new google.visualization.DataTable();
      data.addColumn('string', 'Household Income');
      data.addColumn('number', 'Holder');
      data.addRows([
        ['Under 20K', resdata[0].un20],
        ['20 to 50K', resdata[0].fr20to50],
        ['50 to 75K', resdata[0].fr50to75],
        ['75 to 100K', resdata[0].fr75to100],
        ['100 to 150K', resdata[0].fr100to150],
        ['150 to 250K', resdata[0].fr150to250],
        ['250K and up', resdata[0].up250]
      ]);
      var options = {};
      // Instantiate and draw the chart.
      var chart = new google.visualization.BarChart(document.getElementById('myBarChart'));
      chart.draw(data, options);

1 个答案:

答案 0 :(得分:2)

在初始配置对象中使用legend.position = "none"。有关配置选项的进一步说明,请参阅API文档(https://developers.google.com/chart/interactive/docs/gallery/barchart#configuration-options)。