How to disable x-axis and y-axis in google api line chart

im using google api for line chart in my web application. in this line chart, I do not want the x-axis and the y-axis, but I can’t exactly delete the lines except the graph. Can you 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> 
+6
source share
2 answers

You cannot remove or disable the x and y axes in google api to change the baselineColor and gridlineColor patterns to the same as the background color and set textPosition to none.

 vAxis:{ baselineColor: '#fff', gridlineColor: '#fff', textPosition: 'none' } 
+16
source

In the current version of Google Charts, the following removal of axis lines:

 hAxis: { baselineColor: 'none', ticks: [] }, vAxis: { baselineColor: 'none', ticks: [] } 
+5
source

Source: https://habr.com/ru/post/954913/


All Articles