vasturiano / timelines-chart

Timelines Chart
http://vasturiano.github.io/timelines-chart/example/categorical/
MIT License
556 stars 121 forks source link

feature request automatic margin size #49

Closed ghost closed 4 years ago

ghost commented 5 years ago

we don't know how much space our groups and labels need. So it's pretty hard for us to set the margins manually to a fixed value. It would be great if it would be possible to automatically set the left and right margins depending on the longest group/label.

vasturiano commented 5 years ago

@ChristophRuckstetter it's difficult for the library to determine that accurately because of different character sizes, etc. The consumer of the lib is in a better position to determine that, you can sweep through your data and find the longest label like you described and then call leftMargin(<px>) and rightMargin(<px>) accordingly. You can even do it dynamically if your data changes.