gpt4 book ai didi

javascript - 如何在 x 轴上具有不同的值,并在 graphael 上具有不同的标签?

转载 作者:行者123 更新时间:2023-11-28 01:39:33 25 4
gpt4 key购买 nike

我想在 graphael 图表中使用日期,如下所示。

var lines = r.linechart(30, 30, 600, 440, [
[01 / 01 / 2014 12: 00: 00, 02 / 01 / 2014 12: 00: 00, 03 / 01 / 2014 12: 00: 00, 04 / 01 / 2014 12: 00: 00, 05 / 01 / 2014 12: 00: 00]
], [
[100, 150, 130, 85, 100]
], {
axisxstep: 20,
nostroke: false,
axis: "0 0 1 1",
symbol: "circle",
smooth: true
}).hoverColumn(function () {
this.tags = r.set();

for (var i = 0, ii = this.y.length; i < ii; i++) {
this.tags.push(r.tag(this.x, this.y[i], this.values[i], 160, 10).insertBefore(this).attr([{
fill: "#fff"
}, {
fill: this.symbols[i].attr("fill")
}]));
}
}, function () {
this.tags && this.tags.remove();
});

但是,graphael 似乎无法识别日期。如果我将这些值而不是日期设置为 1,2,3 ... ,之后如何在 x 轴上显示日期标签?

再次感谢

最佳答案

尝试使用以毫秒为单位的日期。要以您需要的任何格式在 x 轴上呈现日期,您可以按照此处所述进行操作:https://bocoup.com/weblog/alternate-x-axis-intervals-in-g-raphael-js-linechart

关于javascript - 如何在 x 轴上具有不同的值,并在 graphael 上具有不同的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21082511/

25 4 0