How about a callback option on the render function?
I'm trying to tweak the formatting after drawing the milestones because it is not playing nice with bootstrap. But if I try to do this after calling milestones() nothing happens, even when I put it in a log timeout. Works fine if I use debug and pause it there:
$(".milestones").css("margin-left", "10%")
.css("position", "relative");
even this doesn't apply the style change:
milestones('#timeline')
.parseTime('%s')
.aggregateBy('hour')
.orientation('vertical')
.distribution('top-bottom')
.labelFormat('%B%d %H:%M')
.render(data);
setTimeout(function() {
$(".milestones").css("margin-left", "10%")
.css("position", "relative");
}, 100000);
I tried adding a callback to the render function on a forked version but that doesn't work because of the chaining call that only allows a single argument (I think).
Maybe there is a simple way of doing this already? If not a callback would be really helpful so I could do:
milestones('#timeline')
.parseTime('%s')
.aggregateBy('hour')
.orientation('vertical')
.distribution('top-bottom')
.labelFormat('%B%d %H:%M')
.render(data, function() {
$(".milestones").css("margin-left", "10%")
.css("position", "relative");
});
Thanks for the suggestion, I'll try to find some time to look into that option!
v1.5.0 is out featuring the rendering callback: https://github.com/walterra/d3-milestones/releases/tag/v1.5.0