vis.js 4.21.0 Timeline localization
from:http://visjs.org/timeline_examples.html
https://github.com/almende/vis
https://github.com/moment/moment/
https://momentjs.com/
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8"> <title>Timeline | Horizontal Scroll Option</title>
<script src="moment/2.8.1/moment-with-locales.min.js"></script>
<script src="../../../dist/vis.js"></script>
<link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Timeline horizontal scroll option</h1> <div id="mytimeline"></div> <script> // create groups
var numberOfGroups = 25;
var groups = new vis.DataSet()
for (var i = 0; i < numberOfGroups; i++) {
groups.add({
id: i,
content: 'Truck ' + i
})
} // create items
var numberOfItems = 1000;
var items = new vis.DataSet(); var itemsPerGroup = Math.round(numberOfItems/numberOfGroups); for (var truck = 0; truck < numberOfGroups; truck++) {
var date = new Date();
for (var order = 0; order < itemsPerGroup; order++) {
date.setHours(date.getHours() + 4 * (Math.random() < 0.2));
var start = new Date(date); date.setHours(date.getHours() + 2 + Math.floor(Math.random()*4));
var end = new Date(date); items.add({
id: order + itemsPerGroup * truck,
group: truck,
start: start,
end: end,
content: 'Order ' + order
});
}
} // specify options
var options = {
stack: true,
locale:'zh-cn',
horizontalScroll: true,
zoomKey: 'ctrlKey',
maxHeight: 400,
start: new Date(),
end: new Date(1000*60*60*24 + (new Date()).valueOf()),
editable: true,
margin: {
item: 10, // minimal margin between items
axis: 5 // minimal margin between items and the axis
},
orientation: 'top'
}; // create a Timeline
var container = document.getElementById('mytimeline');
timeline = new vis.Timeline(container, items, groups, options); </script> </body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8">
<title>Timeline | Localization</title>
<style type="text/css">
body, html, select {
font-family: sans-serif;
font-size: 11pt;
}
</style> <script src="moment/2.8.1/moment-with-locales.min.js"></script>
<!--https://momentjs.com/
https://github.com/moment/moment/
<script src="moment-with-locales.min.js"></script>--> <script src="../../../dist/vis.js"></script>
<link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" /> </head>
<body>
<p>
To localize the Timeline, one has to load a version of moment.js including locales. To set a locale, specify option <code>{locale: STRING}</code>.
</p> <p>
<label for="locale">Select a locale:</label>
<select id="locale">
<option value="en" >en</option>
<option value="it">it</option>
<option value="nl">nl</option>
<option value="de">de</option>
<option value="zh-cn">zh-cn</option>
<option value="zh-cn">zh-hk</option>
<option value="zh-cn">zh-tw</option>
<option value="ar">Arabic</option>
<option value="fr">French</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="ru">Russian</option>
<option value="es">Spanish</option>
</select>
</p> <div id="visualization"></div>
<script type="text/javascript">
var DAY = 24 * 60 * 60 * 1000; // DOM element where the Timeline will be attached
var container = document.getElementById('visualization'); // Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: new Date(new Date().valueOf() - DAY)},
{id: 2, content: 'item 2', start: new Date(new Date().valueOf() + 2 * DAY)}
]); // Configuration for the Timeline
var options = {
locale: 'zh-cn',
showCurrentTime: true
}; // Create a Timeline
var timeline = new vis.Timeline(container, items, options);
timeline.addCustomTime(new Date()); timeline.setCustomTime(new Date(new Date().valueOf() + DAY)); // update the locale when changing the select box value
var select = document.getElementById('locale');
select.onchange = function () {
timeline.setOptions({
locale: this.value
});
};
select.onchange();
</script>
</body>
</html>
win7 IE 11
https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads#!%2Fzh-cn%2Fhelp%2F17621%2Finternet-explorer-downloads
https://www.microsoft.com/zh-cn/download/internet-explorer-11-for-windows-7-details.aspx
vis.js 4.21.0 Timeline localization的更多相关文章
- 动态可视化库Vis.js:社交关系谱
Form Here:http://code.csdn.net/news/2819345 Vis.js 是一个动态的.基于浏览器的可视化库,可处理大量的动态数据并能与这些数据进行交互操作.该项目是由Al ...
- Vis.js – 基于浏览器的动态 JavaScript 可视化库
Vis.js 是一个动态的,基于浏览器的可视化库.该库被设计为易于使用,能处理大量的动态数据.该库由以下几部分组成:一是数据集和数据视图,基于灵活的键/值数据集,可以添加,更新和删除项目,订阅数据集变 ...
- 日常英语---四、vis.js是什么
日常英语---四.vis.js是什么 一.总结 一句话总结:A dynamic, browser based visualization library. 动态基于浏览器的可视库 http://vis ...
- vis.js绘图库的一个BUG以及源码修正
1. BUG 1.1 BUG触发情况 在使用vis.js绘图时,加入两个节点A和B之间既存在一条从A指向B的边,同时也存在一条从B指向A的边,那么这个绘图库就会崩溃. 1.2 BUG解析 vis.js ...
- HiShop2.x版本中的上传插件分析,得出所用的模板语言为Underscore.js 1.6.0且自己已修改
效果: 上传组件非常的酷,但是分析其使用JS写法使用了模板语言的,代码如下: <script type="text/j-template" id="tpl_popb ...
- node.js 在 Express4.0 框架使用 Connect-Busboy 实现文件上传
node.js下四种post提交数据的方式 今天说分享的是其中一种,就是上传文件. Express 4.0 以后,将功能原子化,高内聚,低耦合,独立出了很多中间件 今天主要分享文件上传 对于conne ...
- jquery-2.0.3.js和jquery-2.0.3.min.js的区别
两个文件的作用是完全一样的. jquery-2.0.3.js里的代码是没有进行处理的原代码,适合于人们阅读与研究. jquery-2.0.3.min.js里的代码进行过特殊的处理, 如变量的名称基本都 ...
- Vis.js图表插件
Vis.js是一款基于JavaScript的可视化图表库,Vis.js不像其他的图表库那样仅仅支持几种常用的数据图表,比如线形图.柱状图.饼图等,Vis.js支持上百种不同类型的可视化图表类型,比如时 ...
- AeroGear.js 1.2.0 发布,手机Web应用脚手架 - 开源中国社区
AeroGear.js 1.2.0 发布,手机Web应用脚手架 - 开源中国社区 AeroGear.js 1.2.0 发布,手机Web应用脚手架
随机推荐
- Linux下CenOS系统 安装MariaDB
1.首先去MariaDB官网下载安装包,首页是:https://mariadb.org/ 2.放在linux下的新建目录下:/root/mariadb 然后解压缩,命令为:tar -xzvf mari ...
- nova vnc proxy基本原理
先上图 VNC Proxy的功能: 将公网(public network)和私网(private network)隔离 VNC client运行在公网上,VNCServer运行在私网上,VNC Pro ...
- Win10 安装 VMWare中 MAC OS X的安装,VMWare tools的配置与iOS的Helloworld
iOS的开发必须在MAC OS X系统下进行,这很蛋疼,现在MACBOOK动不动就上千上万大洋,这足够买台配置怪兽了,好吗?然而,我们是可以通过在VMWare中安装MAC OS X进行iOS开发的.对 ...
- IntelliJ Idea 2017 免费激活方法
1. 到网站 http://idea.lanyus.com/ 获取注册码. 2.填入下面的license server: http://intellij.mandroid.cn/ http://ide ...
- [Swift]LeetCode367. 有效的完全平方数 | Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else Fa ...
- Python基础语法(三)
Python基础语法(三) 1. 数值型数据结构 1.1 要点 在之前的博客也有提到,数值型数据结构在这里就不过多介绍了.在这里提及一些需要知道的知识点. int.float.complex.bool ...
- Identity Server 4登陆后返回登录前页面
- Java数据结构和算法 - 什么是2-3-4树
Q1: 什么是2-3-4树? A1: 在介绍2-3-4树之前,我们先说明二叉树和多叉树的概念. 二叉树:每个节点有一个数据项,最多有两个子节点. 多叉树:(multiway tree)允许每个节点有更 ...
- C/C++数据在内存中的存储方式
目录 1 内存地址 2 内存空间 在学习C/C++编程语言时,免不了和内存打交道,在计算机中,我们存储有电影,文档,音乐等数据,这些数据在内存中是以什么形式存储的呢?下面做一下简单介绍. 本文是学 ...
- Android studio使用过程中错误的解决方法
错误一:No such property: POM_DESCRIPTION for class: org.gradle.api.publication.maven.internal.pom 刚开始出现 ...