I’m working on a time-series chart that should support different time-zones. Once the time zone is changed, the section of the chart that is being viewed shifts.
I would like to keep the reference viewing area constant, meaning, whenever I switch from
UTC+01:00 (London) to
UTC+03:00 (Istanbul) for example, I would like to re-center the portion of the chart that was displayed before.
Right now, I have a solution for this but it seems to be a bit crude. Here is the solution:
On time zone change, calculate the time-delta and use that to offset the chart so the viewed are remains same.
Here is a diagram of the process (sorry for the poor drawings).
This works, but what I have noticed is that, I first have to apply the shifted position, by setting the
.end properties. Once those are set, I can only apply the corrective time delta then and shift the viewing window back into it’s relative space. This creates a bit of jump and is not looking very elegant. Please see the
*.gif file below:
Is there a way to apply the time delta in a different way? Before everything is rendered?