PDA

View Full Version : interesting algorithm needed..



SmoothDime
July 31st, 2008, 03:10 AM
i am making an event timeline. it's based on years. negative indicates BC, so -300 == 300BC.

the algorithm i'd like to come up with would be as to how to place the events on the timeline dynamically. for example you could define a timeline of length 2000 pixels and then fit a set of say 40 events on that timeline.

the tough part is that some may be very far apart and then on the other hand you have clumps of 10+ over a short period. so how do you dynamically distribute them in a nice way?

i am doing a history timeline and our first dates are 3000BC, 400AD, 1776, 1820, 1840, etc..

as you can see it needs to accepts big dates. and you can see the pattern above where it begins to shorten out in terms of years between.

you want to see the close clumps at a more magnified time level.

thanks

Anogar
July 31st, 2008, 03:16 AM
Well, you could just go ahead and place them as close as possible based on a percentage, but define a minimum distance between each if there are too many clustered together.

Pier25
July 31st, 2008, 07:44 AM
or place the labels for the years in different "y" so that they don't overlap

dthought
July 31st, 2008, 08:25 AM
Or count the difference in years based on proximity, and end up with a kind of "logarithmic"-ish scale?