Charts 谷歌图表:显示坐标轴

Charts 谷歌图表:显示坐标轴,charts,google-visualization,Charts,Google Visualization,有人能给我解释一下,是什么让左边的示例显示x轴的实线,是什么让右边的示例没有显示x轴的直线? 我想像左边的例子那样显示x轴,但我不确定Google Charts决定如何显示它。我正在使用npm的谷歌图表库。澄清一下:我想在图表中以实线显示x轴和y轴 var linearOptions = { //This one shows x-axis title: 'World Population Since 1400 A.D. in Linear Scale', legend: 'non

有人能给我解释一下,是什么让左边的示例显示x轴的实线,是什么让右边的示例没有显示x轴的直线? 我想像左边的例子那样显示x轴,但我不确定Google Charts决定如何显示它。我正在使用npm的谷歌图表库。澄清一下:我想在图表中以实线显示x轴和y轴

var linearOptions = { //This one shows x-axis
    title: 'World Population Since 1400 A.D. in Linear Scale',
    legend: 'none',
    width: 450,
    height: 500,
    hAxis: {
      title: 'Date'
    },
    vAxis: {
      title: 'Population (millions)',
      ticks: [0, 1000, 2000, 4000, 6000]
    }
  };

  var logOptions = { //This one does not show x-axis
    title: 'World Population Since 1400 A.D. in Log Scale',
    legend: 'none',
    width: 450,
    height: 500,
    hAxis: {
      title: 'Date'
    },
    vAxis: {
      title: 'Population (millions)',
      scaleType: 'log',
      ticks: [0, 1000, 2000, 4000, 6000]
    }
  };

从文档中。。。

根据
vAxis.scaleType
的文档

“log”
-对数缩放。未绘制负值和零值。此选项与设置vAxis:{logscale:true}相同

由于未打印零值,因此将忽略选项中的第一个勾号

为了在使用
'log'
时显示x轴的实线,
vAxis

请参阅以下工作片段,
数据表方法
getColumnRange(colIndex)
用于查找y轴列的
min

google.charts.load('current'{
软件包:['corechart']
}).然后(函数(){
var data=new google.visualization.DataTable();
data.addColumn('date','date');
data.addColumn('number','Population');
data.addRows([
[新日期(1400,1,1),374],
[新日期(1500,1,1),460],
[新日期(1600,1,1),579],
[新日期(1700,1,1),679],
[新日期(1750年1月1日),770年],
[新日期(1800年1月1日),954年],
[新日期(1850年1月1日),1241年],
[新日期(1900年1月1日),1633年],
[新日期(1910年1月1日),1750年],
[新日期(1920年1月1日),1860年],
[新日期(1930年1月1日),2070年],
[新日期(1940年1月1日),2300年],
[新日期(1950年1月1日),2558],
[新日期(1951年1月1日),2595],
[新日期(1952年1月1日),2637年],
[新日期(1953年1月1日),2682],
[新日期(1954年1月1日),2730],
[新日期(1955年1月1日),2782],
[新日期(1956年1月1日)2835],
[新日期(1957年1月1日),2891],
[新日期(1958年1月1日),2948],
[新日期(1959年1月1日),3001年],
[新日期(1960年1月1日),3043],
[新日期(1961年1月1日),3084],
[新日期(1962年1月1日),3140],
[新日期(1963年1月1日),3210年],
[新日期(1964年1月1日),3281],
[新日期(1965年1月1日),3350],
[新日期(1966年1月1日),3421],
[新日期(1967年1月1日),3490],
[新日期(1968年1月1日),3562],
[新日期(1969年1月1日),3637],
[新日期(1970年1月1日),3713],
[新日期(1971年1月1日),3790],
[新日期(1972年1月1日),3867],
[新日期(1973年1月1日),3942],
[新日期(1974年1月1日),4017],
[新日期(1975年1月1日),4089],
[新日期(1976年1月1日),4160],
[新日期(1977年1月1日),4232],
[新日期(1978年1月1日),4304],
[新日期(1979年1月1日),4379],
[新日期(1980年1月1日),4451],
[新日期(1981年1月1日),4534],
[新日期(1982年1月1日),4615],
[新日期(1983年1月1日),4696],
[新日期(1984年1月1日),4775],
[新日期(1985年1月1日),4856],
[新日期(1986年1月1日),4941],
[新日期(1987年1月1日),5027],
[新日期(1988年1月1日),5115],
[新日期(1989年1月1日),5201],
[新日期(1990年1月1日),5289],
[新日期(1991年1月1日),5372],
[新日期(1992年1月1日),5456],
[新日期(1993年1月1日),5538],
[新日期(1994年1月1日),5619],
[新日期(1995年1月1日),5699],
[新日期(1996年1月1日),5779],
[新日期(1997年1月1日),5858],
[新日期(1998年1月1日),5935],
[新日期(1999年1月1日),6012],
[新日期(2000年1月1日),6089],
[新日期(2001年1月1日),6165],
[新日期(2002年1月1日),6242],
[新日期(2003年1月1日),6319],
[新日期(2004年1月1日),6396],
[新日期(2005年1月1日),6473],
[新日期(2006年1月1日),6551],
[新日期(2007年1月1日),6630],
[新日期(2008年1月1日),6709],
[新日期(2009年1月1日),6788]
]);
var populationRange=data.getColumnRange(1);
变量logOptions={
标题:“自公元1400年以来的世界人口对数比例”,
图例:“无”,
宽度:450,
身高:500,
哈克斯:{
标题:“日期”
},
言辞:{
标题:“人口(百万)”,
scaleType:'log',
滴答声:[populationRange.min,1000200040006000],
}
};
var logChart=newgoogle.visualization.LineChart(document.getElementById('log_div');
日志图。绘制(数据、登录选项);
});

对不起,第一次发帖:P我已经解决了