我们可以先显示Y值,然后显示X值吗?图例在下图中是四舍五入的。107.58为Y轴值,01-20-201707.20AM为X轴值。我们可以在Dygraph中互换这两个值吗?

发布于 2017-01-21 01:24:27
如果你正在使用dygraphs 2,你可以用legendFormatter来做这件事。
下面这样的代码应该能起到作用:
function legendFormatter(data) {
if (data.x == null) return ''; // no selection
const yHTML = data.series.map(v => v.labelHTML + ': ' + v.yHTML).join(' ');
return yHTML +' ' + data.xHTML; // y, then x
}
new Dygraph(div, data, { legendFormatter });https://stackoverflow.com/questions/41763935
复制相似问题