如何在google api折线图中禁用x轴和y轴线 [英] how to disable the x axis and y axis line in google api line chart

查看:108
本文介绍了如何在google api折线图中禁用x轴和y轴线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的web应用程序中使用谷歌API的线图。在该线图我不想要x轴线和y轴线,但我不能罚款如何删除除图线之外的线。你可以帮我吗。我为自己的诊所使用了这个例子

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

var options = {
title:'公司表现'
};

var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data,options);
}
< / script>


解决方案

您无法删除或禁用您的x和y轴google api的改变方式是将baselineColor和gridlineColor设置为背景颜色,并将textPosition设置为none。

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


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>

解决方案

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'
       }

这篇关于如何在google api折线图中禁用x轴和y轴线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆