gpt4 book ai didi

javascript - Google 图表时间轴 - 将日期/年份移至图表顶部?

转载 作者:行者123 更新时间:2023-11-30 07:57:02 25 4
gpt4 key购买 nike

这是 Google Superbowl 时间轴的示例:

https://developers.google.com/chart/interactive/docs/datesandtimes#dates-and-times-using-the-date-string-representation

有没有办法将日期/年份移动到时间线图表的顶部?

或者,是否有任何其他时间轴图表可以提供额外的定制?

最佳答案

我还没有找到任何谷歌选项,但我用 SVG 转换做到了这一点

https://jsfiddle.net/d1x5hyes/1/

function afterDraw() {
var g = document.getElementsByTagName("svg")[0].getElementsByTagName("g")[1];
document.getElementsByTagName("svg")[0].parentNode.style.top = '40px';
document.getElementsByTagName("svg")[0].style.overflow = 'visible';
var height = Number(g.getElementsByTagName("text")[0].getAttribute('y')) + 15;
g.setAttribute('transform','translate(0,-'+height+')');
g = null;
}

关于javascript - Google 图表时间轴 - 将日期/年份移至图表顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37328945/

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