admin管理员组文章数量:1123011
Having a dimple.js line plot to compare time series for several years, on the x axis is one tick for each month, with the month number as label.
I would like the tick labels on the x axis, to be printed at the mid of each interval, instead of being aligned to the ticks.
The ticks are set by:
var x = myLinePlot.addTimeAxis("x", "month_day");
x.tickFormat = "%m";
month_day
contains the time values, like "07/18" for the 18th of July, ranging from 01/01 to 12/31.
I assume I will likely have to use the afterDraw method or equivalent, to postprocess my chart, selecting elements with d3, doing some math, and move them rightwards.
var myLinePlot = new dimple.chart(mySVG, myJsonData);
(...)
myLinePlot.afterDraw = function (...) {
(...)
var myLinePlot = d3.select(...)
(...)
}
Is there some easier way to do that with dimple.js, and if no, how can I do this with d3?
I also need the label "01" to be printed for the month of January.
I am aware that setting a category axis instead of a time axis, would print the labels between ticks, but a time axis is still justified in this case.
本文标签: labelDimplejs How to set the XAxis ticks to the mid of each intervalStack Overflow
版权声明:本文标题:label - Dimple.js: How to set the X-Axis ticks to the mid of each interval? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736538945a1944359.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论