gpt4 book ai didi

google-visualization - 谷歌图表轴标题

转载 作者:行者123 更新时间:2023-12-01 01:23:13 26 4
gpt4 key购买 nike

是否可以在 Google 图表(折线图)上添加轴标题而不更改刻度线?

广告中的 Tnx!

最佳答案

是的你可以。这是一个稍微修改的示例:
http://code.google.com/apis/ajax/playground/?type=visualization#line_chart

诀窍是获取两个垂直轴的轴标签(还没有想出如何做到这一点)。

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'x');
data.addColumn('number', 'Cats');
data.addColumn('number', 'Blanket 1');
data.addColumn('number', 'Blanket 2');
data.addRow(["A", 1, 1, 0.5]);
data.addRow(["B", 2, 0.5, 1]);
data.addRow(["C", 4, 1, 0.5]);
data.addRow(["D", 8, 0.5, 1]);
data.addRow(["E", 7, 1, 0.5]);
data.addRow(["F", 7, 0.5, 1]);
data.addRow(["G", 8, 1, 0.5]);
data.addRow(["H", 4, 0.5, 1]);
data.addRow(["I", 2, 1, 0.5]);
data.addRow(["J", 3.5, 0.5, 1]);
data.addRow(["K", 3, 1, 0.5]);
data.addRow(["L", 3.5, 0.5, 1]);
data.addRow(["M", 1, 1, 0.5]);
data.addRow(["N", 1, 0.5, 1]);

// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10, title: "my Axis"}}
);
}


google.setOnLoadCallback(drawVisualization);
</script>

关于google-visualization - 谷歌图表轴标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8297195/

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