gpt4 book ai didi

google-visualization - 垂直对齐标签谷歌图表

转载 作者:行者123 更新时间:2023-12-03 18:28:09 24 4
gpt4 key购买 nike

如何在 y 或 r 轴上垂直对齐谷歌图表中的标签?

最佳答案

是的,垂直对齐现在是可能的。

你可以通过

var options = {
title: "Test",
hAxis: {
direction:-1,
slantedText:true,
slantedTextAngle:90 // here you can even use 180
}
};

我正在添加用于测试的完整代码
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChartModeldaily);

function drawChartModeldaily() {
var data = google.visualization.arrayToDataTable(
[
['daily', 'Views', 'Likes'],
['Tue', 4, 19],
['Mon', 22, 16],
['Sat', 3, 1],
['Fri', 15, 34],
['Thu', 27, 44],
['Wed', 17, 23],
]
);

var options = {
title: "Test",
hAxis: {
direction:-1,
slantedText:true,
slantedTextAngle:90
}
};

var chart = new google.visualization.LineChart(document.getElementById("chart_div_daily"));
chart.draw(data, options);
}
</script>
<div id="chart_div_daily" style="width: 900px; height: 500px;"></div>

我正在使用最新的 Google Chart。请查看 https://developers.google.com/chart/

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

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