Timeline display tool Timeline

Source: Internet
Author: User
Timeline display tool Timeline [1] can display a Timeline on the web page. In time-related data presentation, it has a better effect. The specific usage is as follows. 1. Write html pages, introduce JS scripts, introduce JSON data, and set the calendar location to be displayed & lt; scriptsr... SyntaxHighlighter. al

Timeline display tool Timeline [1] can display a Timeline on the web page. In time-related data presentation, it has a better effect. The specific usage is as follows.

1. Write html pages, introduce JS scripts, introduce JSON data, and set the calendar location to be displayed.
Script

Script

2. Compile the Loading Function and call it on the webpage.
Script

Var tl;

Function onLoad (){

Var tl_el = document. getElementById ("tl ");

Var eventSource1 = newTimeline. DefaultEventSource ();

Var theme1 = Timeline. ClassicTheme. create ();

Theme1.autoWidth = true; // Set theTimeline's "width" automatically.

// SetautoWidth on the Timeline's first band's theme,

// Willaffect all bands.

Theme1.timeline _ start = newDate (Date. UTC (1980, 0, 1 ));

Theme1.timeline _ stop = new Date (Date. UTC (2150, 0, 1 ));

Var d = Timeline. DateTime. parseGregorianDateTime ("1980 ")

Var bandInfos = [

Timeline. createBandInfo ({

Width: 45, // set to a minimum, autoWidthwill then adjust

IntervalUnit: Timeline. DateTime. DECADE,

IntervalPixels: 200,

EventSource: eventSource1,

Date: d,

Theme: theme1,

Layout: 'original' // original, overview, detailed

})

];

// Create the Timeline

Tl = Timeline. create (tl_el, bandInfos, Timeline. HORIZONTAL );

Var url = '.'; // The base url forimage, icon and background image

// References in thedata

EventSource1.loadJSON (timeline_data, url); // The data was stored beyond

// Timeline_data variable.

Tl. layout (); // display theTimeline

}

Var resizeTimerID = null;

Function onResize (){

If (resizeTimerID = null ){

ResizeTimerID = window. setTimeout (function (){

ResizeTimerID = null;

Tl. layout ();

},500 );

}

}

Script

Call this function:

3. Compile a JSON file containing the event
Vartimeline_data = {// save as a globalvariable

'Datetimeformat': 'iso8601 ',

'Wikiurl': "http://simile.mit.edu/shelf ",

'Wikisection ': "Simile Cubism Timeline ",

 

'Events ':[

{'Start': '123 ',

'Title': 'birthday of gongqingkui ',

'Description': 'This is description ',

'Image': 'http: // portrait7.sinaimg.cn/1150968582/blog/180 ',

'Link': 'http: // blog.sina.com.cn/gongqingkui ',

'Icon ': "dark-red-circle.png ",

'Color': 'red ',

'Textcolor': 'green'

},

{'Start': '123 ',

'End': '123 ',

'Isduration': true,

'Title': 'aaa ',

// 'Tapimage': 'blue_stripes.png ',

'Taperepeid': 'Repeat-x ',

'Caption ': "This is the event 'scaption attribute .",

'Classname': 'hot _ event'

},

]

}

The JSON data currently includes a point event and a period of time.

4. Loading Effect

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.