时间线展示工具Timeline
时间线展示工具Timeline[1],可以实现网页上展示一个时间轴。在时间相关的数据展示中,有比较好的效果。测试了下,具体的用法是这样的。
1.编写html页面,引入JS脚本,引入JSON数据,设定待显示日历位置
<scriptsrc="http://static.simile.mit.edu/timeline/api-2.3.0/timeline-api.js?bundle=true"type="text/javascript"></script>
<scriptsrc="local_data2.js" type="text/javascript"></script>
<divid='tl'></div>
2.编写加载函数,并在网页中调用该函数
<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 intothe
// 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>
调用该函数:<body οnlοad="onLoad();"οnresize="onResize();">
3.编写包含事件的JSON文件
vartimeline_data = { // save as a globalvariable
'dateTimeFormat':'iso8601',
'wikiURL':"http://simile.mit.edu/shelf/",
'wikiSection':"Simile Cubism Timeline",
'events' : [
{'start': '1987',
'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':'1986',
'end':'1990',
'isDuration':true,
'title':'aaa',
//'tapeImage': 'blue_stripes.png',
'tapeRepeat': 'repeat-x',
'caption': "This is the event'scaption attribute.",
'classname': 'hot_event'
},
]
}
该JSON数据目前包括一个点事件和一个段时间。
4.加载效果
这是最简单的使用方法,一些详细的例子在这里http://simile-widgets.org/timeline/examples/index.html。与这个相似的一个应用timeplot[2]可以画时间相关的数据直方图,效果如下。
参考
1.Timeline项目主页http://simile-widgets.org/timeline/
2.Timeplot项目主页http://simile-widgets.org/timeplot/
时间线展示工具Timeline相关推荐
- 什么是 Hudi Timeline (时间线)
Timeline 不同时刻对表的所有操作都被 Hudi 维护在一条时间线上,这有助于提供表的瞬时的视图查询,同时还能根据数据的到达顺序支持高校的数据检索服务.Hudi instant 核心概念包含以下 ...
- layui框架学习(10:时间线)
时间线,英文timeline,也叫时光轴.时间轴,是指以时间为记录方式的一种网络布局形式,其形式之一为下图所示(示例图来自参考文献5). Layui官网教程中的更新日志页面也用了时间线样式,如 ...
- 046_Timeline时间线
1. Timeline时间线 1.1. Timeline时间线可视化地呈现时间流信息. 1.2. Timeline Attributes 参数 说明 类型 可选值 默认值 reverse 指定节点排序 ...
- Streamline(流线),Pathline(迹线),Streakline(脉线) and Timeline(时间线)
流线.迹线.脉线和时间线可以用来描述和可视化流动,它们的定义如下: 1.流线 流线是在给定时刻,画出的流线与流动中每一点的速度矢量相切,这是理解流动的有力工具. 2.迹线 迹线是由一个给定的粒子所描出 ...
- Dorea.js框架介绍:纯CSS写出优雅好看的时间线/时间轴(左右垂直展示)
在准备搭建博客,准备写一个心情的功能模块,以时间线的形式展现出来(有的人称为时间轴),发现Layer的提供的时间线挺好看的.速递地址:layui.但不是很符合本人自己的心意,想要一种左右左右展示的风格 ...
- R语言ggplot2可视化:使用ggplot2绘制按时间顺序排列的时间线图(chronological timeline plot)
R语言ggplot2可视化:使用ggplot2绘制按时间顺序排列的时间线图(chronological timeline plot) 目录 R语言ggplot
- WPF中的动画——(三)时间线(TimeLine)
WPF中的动画--(三)时间线(TimeLine) 原文:WPF中的动画--(三)时间线(TimeLine) 时间线(TimeLine)表示时间段. 它提供的属性可以让控制该时间段的长度.开始时间.重 ...
- Timeline 时间线基础用法
1.html内容 Timeline 可拆分成多个按照时间戳排列的活动, 时间戳是其区分于其他控件的重要特征 <el-timeline style="flex: 1; overflow ...
- 微信小程序Timeline时间线效果实现
微信小程序实现类似elementUI的Timeline时间线效果,自适应页面与文本 wxml代码: <view class="box"><view wx:for= ...
最新文章
- ADS1.2安装要点
- 如何使用hyperopt对xgboost进行自动调参
- linux的for循环怎么写,Linux命令:for循环写法总结
- 自定义计算器 android,自定义公式计算app下载
- mysql 第二天数据_MySQL入门第二天------数据库操作
- 单机斗地主单机_单击浏览器中的URL会发生什么
- lucene分词器与搜索
- webcontent 与 webroot 问题解决
- 云计算的发展趋势_云计算的未来发展趋势
- springboot接收多对象_springboot实现邮件发送
- cmd echo写入shell_为什么说Shell脚本就是最好的教程和笔记呢?
- 数据AES加密安全传输之后台JAVA加密解密
- layui框架实战案例(9):layPage 静态数据分页组件
- python apply函数不打印_Python Pandas dataframe shift在apply函数中不起作用
- 关于「微软拼音」自定义文本这件事
- php 字符串加密解密
- Mysql相关操作与命令
- sap采购申请自动转采购订单_采购订单_参考第三方销售生成的采购申请
- 编程乐趣:获取12306的所有车站电报码
- Python入门到精通(4):关系与逻辑表达式