I found a work-around.  If I convert all dates to UTC before passing
them in, it handles them correctly.  I do it like this:

function UTCDate(date){
    return new Date(date.toUTCString())
}
chart.setVisibleChartRange(UTCDate(start), UTCDate(end))

This also gets around the pointer problem.  Since I'm creating a fresh
Date object, the annotated timeline library is not able to alter my
original Date object.

On Jul 6, 11:58 am, Nick Retallack <[email protected]> wrote:
> It isn't.  This happens no matter where you call
> setVisibleChartRange.  You can call it from your console and it will
> still do this, walking its way backward in increments of your time
> zone with every call.  It doesn't matter how slowly or quickly you
> call it, either.
>
> On Jul 4, 7:41 am, ChartMan <[email protected]> wrote:
>
>
>
> > Can you try resetting the range not from the ready event.
> > It may be the case that 'ready' is triggered after setRange.
>
> > On Fri, Jul 2, 2010 at 11:20 AM, Nick Retallack 
> > <[email protected]>wrote:
>
> > > Paste this into the playground:
> > >http://friendpaste.com/126VYV8RXJXvrzH1uejTjE
>
> > >http://code.google.com/apis/ajax/playground/?type=visualization#annot...
>
> > > I set the range to itself twice, but the second time it offset itself
> > > by my time zone.
>
> > > On Jun 30, 8:14 am, ChartMan <[email protected]> wrote:
> > > > can you send an example page ?
>
> > > > On Tue, Jun 29, 2010 at 5:27 AM, Nick Retallack <[email protected]
> > > >wrote:
>
> > > > > Given any annotated time line, if you do this repeatedly, you will
> > > > > find the visible portion of your chart marches by units of your time
> > > > > zone with every iteration.
>
> > > > > for (i = 0; i < 5; i++){
> > > > >  var range = chart.getVisibleChartRange()
> > > > >  chart.setVisibleChartRange(range['start'], range['end'])
> > > > > }
>
> > > > > That means getVisibleChartRange does not produce output that
> > > > > setVisibleChartRange expects.  But the problem is even worse than
> > > > > that.  You don't even have to call getVisibleChartRange repeatedly:
> > > > > setVisibleChartRange alters the date objects you pass into it each
> > > > > time.
>
> > > > > var range = chart.getVisibleChartRange()
> > > > > for (i = 0; i < 5; i++){
> > > > >  console.debug(range) // wtf, it's different every time
> > > > >  chart.setVisibleChartRange(range['start'], range['end'])
> > > > > }
>
> > > > > I am assuming this means that setVisibleChartRange expects dates in
> > > > > your data's time zone and adjusts them to the client's time zone
> > > > > internally without creating new date objects, while
> > > > > getVisibleChartRange simply returns the client time that is displayed
> > > > > on the chart.  Either way, it's totally ignoring the time zone data in
> > > > > the Date object, leading to very confusing results.
>
> > > > > ---
>
> > > > > Btw, what I was trying to do here was synchronize all annotated
> > > > > timelines on the page, so if you zoomed in one of them, all of them
> > > > > would zoom to the same place.  It seems I have to adjust for the time
> > > > > zone every time though.  They also respond to adjustments rather
> > > > > slowly.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google Visualization API" group.
> > > > > To post to this group, send email to
> > > > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-visualization-
> > > > >  api%[email protected]><google-visualization-
> > > api%[email protected] <api%[email protected]>>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-visualization-api?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Visualization API" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-visualization-
> > >  api%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-visualization-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to