Art,
Thank you for your input and suggested solution. However, your
solution will not work for me as my situation is somewhat complicated.
My implementation of the timeline includes a band where events are
added dynamically. That is, my event source initially does not contain
any events and events are added to and removed from the band using the
onAddOne, onAddMany, onRemove and onClear methods. And the initial
interval unit of the band is set to DAY and as events are added and
removed from the band the interval width is resized to display as many
events as possible. But at some point, even with dynamically resizing
the day interval width, the length of time between the starting event
and ending event becomes so great that the events cannot be all
displayed in the visible display width of the band. So what I need to
do is change the interval unit as events are added and removed to WEEK
or MONTH to display all the events in the visible display.
So the problem with your solution for me is that setting the timeline
to null then re-creating the timeline with the new unit will clear all
of the events that have been dynamically added to the band.
Thank you for your suggestion anyway, and if you have any other
recommendations or solutions that will solve the problem please let me
know.
Scott
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Art Hanson
Sent: Tuesday, June 05, 2007 3:39 PM
To: General List
Subject: Re: Dynamically changing interval unit for Timeline
bands
I've been able to do it by recreating the timeline object. The
new interval data is included in the JSON array. The timeline is set
to null then recreated with the new unit and pixel interval. It's not
at all pretty but it works. I've pasted an abbreviated excerpt of my
code below.
Thanks to David and everyone else who's worked on this for a
great tool. I discovered it about a month ago.
Art Hanson
www.watchjeffersoncounty.net
try {
t1 = null;
eventSource = new
Timeline.DefaultEventSource(0);
// Create new range
var I1= Timeline.DateTime.WEEK;
if (data[5]=='DAY') {I1=
Timeline.DateTime.DAY;}
if (data[5]=='WEEK') {I1=
Timeline.DateTime.WEEK;}
if (data[5]=='MONTH') {I1=
Timeline.DateTime.MONTH;}
var I2 = Timeline.DateTime.YEAR;
if (data[6]=='WEEK') {I2=
Timeline.DateTime.WEEK;}
if (data[6]=='MONTH') {I2=
Timeline.DateTime.MONTH;}
if (data[6]=='YEAR') {I2=
Timeline.DateTime.YEAR;}
var bandInfos = [
Timeline.createBandInfo({
intervalUnit: I1,
intervalPixels: data[7],
}),
Timeline.createBandInfo ({
intervalUnit: I2,
intervalPixels: data[8]
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl =
Timeline.create(document.getElementById("g_timeline"), bandInfos);
}catch(err){
alert('Timeline Error: '+err);
}
On 6/5/07, Bennett, Scott R. <[EMAIL PROTECTED]> wrote:
Hi,
I was reading in the general mailing list archives a
post a year ago from Adam Fields about changing the interval unit for a
timeline band on-the-fly. And David Huynh had responded that at that
time the Timeline API did not support changing the timeline's
properties on the fly but he was considering implementing in the future
the functionality to allow changes to the ethers and then calling the
layout function.
I need to implement this capability for my project and
I was wondering if any work has been done to include this functionality
or if anyone has any thoughts on how this can be done. Specifically I
need to modify the ether for a timeline band so I can dynamically
change the interval unit for a band from day to week or month. Any
insight on how to accomplish this would be greatly appreciated.
Thanks,
Scott R. Bennett
Sr. Software Systems Engineer
The MITRE Corporation
[EMAIL PROTECTED]
781-271-4533
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general