Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable the x axis and y axis line in google api line chart

im using google api for line graph in my web application. in that line chart i dont want x axis line and y axis line, but i cant to fine how to remove the lines except the graph. could you please help me. i used this example for my practice

<script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance'
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
like image 930
Hariprasath Avatar asked Sep 30 '13 04:09

Hariprasath


2 Answers

you cant remove or disable your x and y axis in google api the alter way is to set the baselineColor and gridlineColor same as the background color and set the textPosition to none.

vAxis:{
         baselineColor: '#fff',
         gridlineColor: '#fff',
         textPosition: 'none'
       }
like image 128
Hariprasath Avatar answered Sep 30 '22 15:09

Hariprasath


With the current version of Google Charts, the following removes axis lines:

hAxis: {
  baselineColor: 'none',
  ticks: []
},
vAxis: {
  baselineColor: 'none',
  ticks: []
}
like image 34
dkz Avatar answered Sep 30 '22 14:09

dkz