gpt4 book ai didi

javascript - 使用 Google Charts 创建整页背景折线图

转载 作者:太空宇宙 更新时间:2023-11-04 11:10:48 24 4
gpt4 key购买 nike

我正在尝试制作价格转换器 div 后面的折线图。我不希望它有任何轴,我怎样才能删除它们并让线到达页面的两端?如果可能的话,我还希望这条线位于价格框的后面。

这是我现在得到的:

google.load('visualization', '1', {packages: ['corechart', 'line']});
google.setOnLoadCallback(drawAxisTickColors);

function drawAxisTickColors() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'X');
data.addColumn('number', 'Price');

data.addRows([
[0, 0], [1, 10], [2, 23], [3, 17], [4, 18], [5, 9],
[6, 11], [7, 27], [8, 33], [9, 40], [10, 32], [11, 35], [12, 35], [13, 35], [14, 35], [15, 35], [16, 35], [17, 35], [18, 35], [19, 35], [20, 35], [21, 35], [22, 35], [23, 35]
]);

var options = {
hAxis: {
gridlines: {
color: '#ffffff'
},
},
vAxis: {
gridlines: {
color: '#ffffff'
},
},
colors: ['blue', '#ffffff'],
legend: 'none'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<center>
<div class = "ratesBox">
<div class = "bitcoin">
<div class = "rateboxy"><input value = "1" type="text" name = "btc" id="btc" class="rate" onchange="btcConvert(this);" onkeyup ="btcConvert(this);"/></div>
</div>
<div class= "unitBox">
<div class = "smallUnitBox" onclick="satoshiConvert(btc);" id="satoshiBox">sat</div>
<div class = "smallUnitBox" onclick="bitConvert(btc);" id="bitBox">bit</div>
<div class = "smallUnitBox" onclick="mBTCConvert(btc);"id="mBTCBox">mBTC</div>
<div class = "smallUnitBox2" onclick="bitcoinConversion(btc);" id="BTCBox">BTC</div>
</div>
<p id = "equals">=</p>
<div class = "rateboxy"><input value = "<?php echo $bitcoinPrice; ?>"type="text" name="cur" id="cur" class="rate" onchange="usdConvert(this);" onkeyup ="usdConvert(this);"/></div>
</div>
</center>
<div id="chart_div"></div>
</body>
</html>

折线图的样式

#chart_div {
position:absolute;
top:0;
left:0;
width:100%;
}

最佳答案

我认为这就是您所追求的。

var options = {
chartArea: {
left: 0,
top: 0,
right: 0,
bottom: 0,
width: "100%",
height: "100%"
},
hAxis: {
textPosition: 'none',
baselineColor: 'none',
gridlines: {
color: 'none'
},
},
vAxis: {
textPosition: 'none',
baselineColor: 'none',
gridlines: {
color: 'none'
}
},
colors: ['blue', '#ffffff'],
legend: 'none'
};

JSFiddle

关于javascript - 使用 Google Charts 创建整页背景折线图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33643426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com