timeglider / jquery_widget

Timeglider's JS Widget component. See README for details.
193 stars 41 forks source link

Problems with date spans (for negative dates) #41

Open chieffff opened 12 years ago

chieffff commented 12 years ago

When I initially load the timeline at zoom level 83, focusing the timeline at 3 m.e. bce , event with date "-3000000" is a few pixels too far to the left (at "-3039063 years" approximately). When I try to change timescale using the slider, the situation is the same: event is some pixels too far to the left (for example "-3008010" instead of "-3000000" at zoom level 77).

WBR, A. Sokoloff Russia

timeglider commented 12 years ago

Thanks for filing this Alexander. This problem has been really vexing me. Here's an attempt to at least understand the problem:

  1. We use "seconds per pixel" to calculate positioning of events on the screen, based on the focus date. Basically, if the seconds per pixel is off by a small amount, the farther left or right of center an event is, the more it's off. If the "seconds per pixel" are off by just a tiny percentage, it adds up fast for dates in the billions.

So, at these larger dates, we're allotting too few "seconds per pixel" ----- so a when you calculate (event_date - focus_date / seconds per pixel) the offset of the events, they're not shifting far enough to the left. I'm experimenting with a correction to this (which is at about 1%) for dates over 1 million years...

  1. The second problem relates to how we, on the one hand, calculate pixel values from dates (related to problem #1, with dates provided as YYYY-MM-DD, etc), and conversely, generate dates from pixel-values (or changes to pixel values), respecting pixel-value changes as one drags the timeline around. So there's a lack of total symmetry in the "date->seconds->pixels" and "pixels(->seconds)->date" algorithms.

I've gotten as far as evaluating the problem ------ I'll try to take it a step farther in the coming week.

Michael

On Wed, Mar 14, 2012 at 5:16 AM, chieffff < reply@reply.github.com

wrote:

When I initially load the timeline at zoom level 83, focusing the timeline at 3 m.e. bce , event with date "-3000000" is a few pixels too far to the left (at "-3039063 years" approximately). When I try to change timescale using the slider, the situation is the same: event is some pixels too far to the left (for example "-3008010" instead of "-3000000" at zoom level 77).

WBR, A. Sokoloff Russia


Reply to this email directly or view it on GitHub: https://github.com/timeglider/jquery_widget/issues/41

chieffff commented 12 years ago

Thank you! I will wait and hope :)

chieffff commented 12 years ago

Hi! How are you? Perhaps, there is a simple decision for my case?

chieffff commented 12 years ago

By the way, It's seems to me that "timeglider-event-spanners" are positioned almost precisely...