d3-milestones icon indicating copy to clipboard operation
d3-milestones copied to clipboard

How about a callback option on the render function?

Open phoebebright opened this issue 1 year ago • 1 comments

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");
            });

phoebebright avatar Aug 18 '24 20:08 phoebebright

Thanks for the suggestion, I'll try to find some time to look into that option!

walterra avatar Sep 10 '24 14:09 walterra

v1.5.0 is out featuring the rendering callback: https://github.com/walterra/d3-milestones/releases/tag/v1.5.0

walterra avatar Apr 26 '25 22:04 walterra