Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I get rid of X-axis in Google chart?

Tip: To hide the vertical axis line, uncheck the box next to "Show axis line". On your computer, open a spreadsheet in Google Sheets. Select the cells you want to include in your chart.

How do I remove axis from bar chart?

Hide and Display Chart Axes Select a blank area of the chart to display the Chart Tools on the right side of the chart. Select Chart Elements, the plus sign (+), to open the Chart Elements menu. To hide all axes, clear the Axes check box.

How do I change the X-axis values in a Google chart?

addColumn('string', 'Topping'); data. addColumn('number', 'Slices'); data. addRows([ ['Mushrooms', 5], ['Onions', 4], ['Olives', 3] ['Zucchini', 2], ['Pepperoni', 1] ]); Chart is created successfully but on X-Axis it shows value from 0 to 6.


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


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


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. :)


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', '');

Google changes the API so fast, this is what works today:

chart.draw(daily, {
    hAxis : {textColor: '#ffffff'},
    [... your other options here ...]
});