如何使用 Plot.plot 函式在 Observable 中包裝長刻度文本?
以下是 D3 的示例:

svg.select(".x_axis")
.call(xAxis.tickFormat(d3.timeFormat("%d-%m-%Y %H:%M:%S")))
.selectAll("text")
.call(function (t) {
t.each(function (d) {
var self = d3.select(this);
var s = self.text().split(' ');
self.text(null);
self.append("tspan")
.attr("x", 0)
.attr("dy", ".8em")
.text(s[0]);
self.append("tspan")
.attr("x", 0)
.attr("dy", "1.2em")
.text(s[1]);
})
});
我不清楚如何將其集成到繪圖功能中。我可以為此使用 tickFormat 嗎?

uj5u.com熱心網友回復:
我們一直在https://github.com/observablehq/plot/issues/460討論這個問題,但還沒有官方支持。我們的想法是考慮刻度格式的換行符,以便創建一個新行,就像我們在 Plot.text 中所做的那樣。草稿可在https://github.com/observablehq/plot/pull/609和https://github.com/d3/d3-axis/pull/83獲得
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/504316.html
