walterra / d3-milestones

A d3 based timeline visualization.
https://walterra.github.io/d3-milestones
Other
144 stars 27 forks source link

Using custom label distribution #74

Open piper-of-dawn opened 1 year ago

piper-of-dawn commented 1 year ago

Hi,

I am creating a cash flow diagram using d3-milestones. Here label distribution has a meaning, those at the top would mean positive cashflows and those at the bottom would mean negative cashflows. Is there a way in the API, I can override the finite number of settings in the label distribution?

Example of what I am trying to create: https://observablehq.com/d/03829cdc3aec920a

walterra commented 1 year ago

Hey,

Unfortunately, the way the current layout algorithm works, it doesn't allow for this kind of custom distribution.

The way I worked around this so far was to create two instances and pass in the filtered items I wanted to show with distribution top and bottom. This will require more custom code unfortunately if you'd like to do something like you with multiple timelines split by a category. https://walterra.github.io/d3-milestones/?path=/story/d3-milestones--lord-of-the-rings

I'm currently working on a layout update that will make this kind of feature possible sometime in the future, no promises but it could be ready early next year.