How do you remove the x-axis from a bar chart produced by Google's Visualization API?

前端 未结 7 964
太阳男子
太阳男子 2020-12-11 15:00

Referring to the kind of chart shown here: http://code.google.com/apis/visualization/documentation/gallery/barchart.html

There doesn\'t seem to be a simple switch, a

相关标签:
7条回答
  • 2020-12-11 15:24

    let options = {legend: { position: 'none' }};

    0 讨论(0)
  • 2020-12-11 15:29

    I was able to remove the label in the material version of the chart by removing the string in my datatable.

    Before:

    data.addColumn('string', 'Date');
    

    After:

    data.addColumn('string', '');
    
    0 讨论(0)
  • 2020-12-11 15:30

    You can set hAxis.textPosition to the value of 'none'

    For example:

    var options = {
    
                    hAxis: { textPosition: 'none' },
                };
    
    chart.draw(data, options);
    

    See https://developers.google.com/chart/interactive/docs/gallery/barchart#Configuration_Options

    0 讨论(0)
  • 2020-12-11 15:44

    Check out http://code.google.com/apis/chart/docs/gallery/bar_charts.html#axis_label_styles

    Axis Label Styles chxs "axis_or_tick"

    You'll notice this documentation: "_ - (Underscore) Draw neither axis line nor tick marks. If you want to hide an axis line, use this value."

    Example: 'chxs=0,,0,0,_'

    0 讨论(0)
  • 2020-12-11 15:45

    axisFontSize : 0 will remove x-axis and y-axis data

    0 讨论(0)
  • 2020-12-11 15:46

    Their API has no function for this indeed, but:

    chart.draw( data, 
        {
            width: 400, 
            height: 240, 
            is3D: true, 
            legend :'none',
            axisFontSize : 0
        });
    

    Setting axisFontSize to 0 will remove your x-axis data. :)

    0 讨论(0)
提交回复
热议问题