Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i remove x-axis title in google bar chart?

i tried to create a bar chart using google chart api. in which i want to remove the x-axis title

   <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1.1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'first six', 'second six'],
          ['2010', 3750, 3800],
          ['2011', 3900, 3850],
          ['2012', 3850, 3900],
          ['2013', 4280, 4160],
          ['2014', 4350, 0000]
        ]);

        var options = {

          width: 400,
          height: 320,
          bar: {groupWidth: "90%"},
          legend: { position: "none" },
        };

        var chart = new google.charts.Bar(document.getElementById('columnchart_material_price'));

        chart.draw(data, options);
      }

this is the code for bar chart i tried

var options = {
  hAxis: {title: '  ',  titleTextStyle: {color: 'white'}},
}

but this does nothing . how can i remove x-axis title it is by default "year"?

like image 388
SAC Avatar asked Nov 27 '14 13:11

SAC


Video Answer


1 Answers

Following code will help you.It works for me.

var options = {
          width: 400,
          height: 320,
          bar: {groupWidth: "90%"},
          legend: { position: "none" },
          hAxis: { textPosition: 'none' },
};
like image 85
Janith Widarshana Avatar answered Sep 26 '22 14:09

Janith Widarshana