【发布时间】:2019-06-06 13:42:48
【问题描述】:
我想用谷歌散点图显示一些数据。无论我如何尝试,我都无法显示 y 轴标签。
我尝试了各种方法,这些都是在这里和其他论坛上提出的。包括:调整图表大小、调整标签字体大小、调整轴和改变vAxis的textPosition。 这些都不起作用。
有趣的是,我定义的刻度显示了正确放置的网格线。只是缺少标签。还显示了轴标题,这使我得出结论,间距不是问题。代码如下所示:
function getLineChartOptions(target,leaflayer,curretnStartDate,currentEndDate) {
var ymin = 0;
var ymax = 100;
var yticks = [];
if (target == "BBCH (BBCH)"){
yAxisTitle = "BBCH";
yticks = [0, 20, 40, 60, 80, 100];
}
else{
yAxisTitle = target +" "+leaflayer+" severity";
yticks = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
}
var mo={
title: yAxisTitle,
width: 800,
height: 400,
vAxis: {
viewWindow: {
min: ymin,
max: ymax
},
ticks: yticks,
title: yAxisTitle,
labels: yticks,
textStyle : { fontSize: 10}
},
hAxis: {
viewWindow: {
min: curretnStartDate,
max: currentEndDate
},
gridlines: {
count: 6,
}
},
tooltip: {isHtml: true, trigger: 'selection'},
legend: {position: 'none'},
colorAxis: {colors: ['green','yellow', 'red']},
focusTarget: 'category'
};
return mo
var materialOptions = getLineChartOptions(target,leaflayer,curretnStartPickedDate,enddatePickedDate);
var node = document.createElement('div');
var infoWindow = new google.maps.InfoWindow();
var chart = new google.visualization.ScatterChart(node);
chart.draw(Data, materialOptions);
【问题讨论】:
标签: charts google-visualization label axis