我在第三个变量上的Y轴范围遇到问题,我尝试添加最小值,最大值,视图范围,但是因为它是一个百分比,并且根据体积/价格的大小而变得越来越不可见。任何想法或帮助都将大大鼓励。这是以下设置的图形:
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart"></div>
<script>
google.charts.load('current', {
callback: function () {
var data = new google.visualization.DataTable({
cols: [
{label: 'Time', type: 'string', format: 'decimal'},
{label: 'Volume', type: 'number'},
{label: '฿', type: 'number'},
{label: 'Buy %', type: 'number'},
],
rows: [
<?php
while($row = mysqli_fetch_assoc($result)) {
echo "{c:[{v: '" . $row["Timestamp"] . "'}, {v:" . $row["Volume"] . "}, {v:" . $row["LastPrice"] . "}, {v:" . $row["buyers"]*100 . "}]},";
}
?>
]
});
var container = document.getElementById('chart');
var formatter = new google.visualization.NumberFormat({
fractionDigits: 8
});
formatter.format(data, 2);
var chart = new google.visualization.LineChart(container);
chart.draw(data, {
height: 525,
crosshair: { trigger: 'both' },
series: {
1: {
targetAxisIndex: 1,
}
},
theme: 'material',
vAxes: {
0: {
title: '',
},
1: {
title: '',
},
2: {
title: '',
minValue: 0,
maxValue: 100,
format: '#\'%\'',
}
},
});
},
packages: ['corechart']
});
</script>
尝试将每个系列分配到自己的轴......
series: {
1: {
targetAxisIndex: 1
},
2: {
targetAxisIndex: 2
}
}