jqueryGannt主要用于甘特图的展示,直接上步骤

1、下载

jquery.min.js

js/jquery.fn.gantt.js 的js ,可以自己去github上搜官方的。

其他的要上传对应的style和img,都可以在官网上下载

2、html

<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery.Gantt - Test Suite 01</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=IE8">
<link href="css/style.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
padding: 0 0 50px 0;
} .contain {
width: 800px;
margin: 0 auto;
} h1 {
margin: 40px 0 20px 0;
} h2 {
font-size: 1.5em;
padding-bottom: 3px;
border-bottom: 1px solid #DDD;
margin-top: 50px;
margin-bottom: 25px;
} table th:first-child {
width: 150px;
}
</style>
</head>
<body> <div class="gantt"></div> <script src="js/jquery.min.js"></script>
<script src="js/jquery.fn.gantt.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<script>
function addHour(moment) {
return moment.add(12, "hours");
}
function addHour1(moment) {
return moment.add(6, "hours");
}
function loadgantt() {
var today = moment();
var andTwoHours = addHour1(moment());
var t1 = "/Date(" + today.valueOf() + ")/";
var t2 = "/Date(" + andTwoHours.valueOf() + ")/";
var t3 = "/Date(" + addHour1(andTwoHours).valueOf() + ")/";
var t4 = "/Date(" + addHour1(addHour1(andTwoHours)).valueOf() + ")/";
$(".gantt").gantt({
source : [ {
name : "Testing",
desc : " ",
values : [ {
from : t1,
to : t2,
label : "Test",
customClass : "ganttRed"
}, {
from : t2,
to : t3,
label : "Test1",
customClass : "ganttGreen"
}, {
from : t3,
to : t4,
label : "Test2",
customClass : "ganttOrange"
} ]
}
,
{
name : "Testing1",
desc : " ",
values : [ {
from : t1,
to : t2,
label : "Test",
customClass : "ganttRed"
}, {
from : t2,
to : t3,
label : "Test1",
customClass : "ganttGreen"
}, {
from : t3,
to : t4,
label : "Test2",
customClass : "ganttOrange"
} ]
} ],
scale : "hours",
minScale : "hours",
navigate : "scroll"
}); }
$(function() {
"use strict";
var today = moment();
var andTwoHours = addHour(moment()); var t1 = "/Date(" + today.valueOf() + ")/";
var t2 = "/Date(" + andTwoHours.valueOf() + ")/";
var t3 = "/Date(" + addHour(andTwoHours).valueOf() + ")/";
var t4 = "/Date(" + addHour(addHour(andTwoHours)).valueOf() + ")/";
$(".gantt").gantt({
source : [ {
name : "Testing",
desc : " ",
values : [ {
from : t1,
to : t2,
label : "Test",
customClass : "ganttRed"
}, {
from : t2,
to : t3,
label : "Test1",
customClass : "ganttGreen"
}, {
from : t3,
to : t4,
label : "Test2",
customClass : "ganttOrange"
} ]
}
,
{
name : "Testing1",
desc : " ",
values : [ {
from : t1,
to : t2,
label : "Test",
customClass : "ganttRed"
}, {
from : t2,
to : t3,
label : "Test1",
customClass : "ganttGreen"
}, {
from : t3,
to : t4,
label : "Test2",
customClass : "ganttOrange"
} ]
} ],
scale : "hours",
minScale : "hours",
navigate : "scroll"
}); });
</script>
<input type="button" onclick="loadgantt()" />
</body>
</html>

目录结构

jqueryGannt用法的更多相关文章

  1. EditText 基本用法

    title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...

  2. jquery插件的用法之cookie 插件

    一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...

  3. Java中的Socket的用法

                                   Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...

  4. [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法

    一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...

  5. python enumerate 用法

    A new built-in function, enumerate() , will make certain loops a bit clearer. enumerate(thing) , whe ...

  6. [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结

    本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...

  7. 【JavaScript】innerHTML、innerText和outerHTML的用法区别

    用法: <div id="test">   <span style="color:red">test1</span> tes ...

  8. chattr用法

    [root@localhost tmp]# umask 0022 一.chattr用法 1.创建空文件attrtest,然后删除,提示无法删除,因为有隐藏文件 [root@localhost tmp] ...

  9. 萌新笔记——vim命令“=”、“d”、“y”的用法(结合光标移动命令,一些场合会非常方便)

    vim有许多命令,网上搜有一堆贴子.文章列举出各种功能的命令. 对于"="."d"."y",我在无意中发现了它们所具有的相同的一些用法,先举 ...

随机推荐

  1. ICTCLAS20160405分词系统调试过程

    一.前期准备: 1.下载最新版本的资源包:CTCLAS20160405171043_ICTCLAS2016分词系统下载包 2.下载最新版本的licence:https://github.com/NLP ...

  2. 简单讲解MVC(视图/模型/控制器)

    MVC全名是Model View Controller,是模型(model)-视图(view)-控制器(controller)的缩写,一种软件设计典范,用一种业务逻辑.数据.界面显示分离的方法组织代码 ...

  3. 浮动div中的图片垂直居中

    table-cell方法垂直水平居中 <!DOCTYPE html> <html> <head> <meta name="description&q ...

  4. ubuntu安装py27 spyder

    sudo apt-get install python-qt4 python-sphinx sudo pip install spyder sudo pip install -U spyder 一般网 ...

  5. 怎样处理“error C2220: warning treated as error - no object file generated”错误

    最近用VS2010 编译ceflib开源库是出现"怎样处理"error C2220: warning treated as error - no object file gener ...

  6. VirtualBox 共享文件夾

    説明:host為window10,guest為centos7 一.安装VBoxLinuxAdditions 1. 在guest上挂载virtualbox安装目录下的VBoxGuestAdditions ...

  7. Ubuntu install g++

    We can use two ways to  install g++ on Ubuntu. 1.  a. sudo apt-get install make gcc g++.      b. sud ...

  8. miniprofiler的对数据库的监测使用。以nancy,petapoco为例

    miniprofiler的使用 miniprofiler的详细介绍请看这里http://miniprofiler.com/.(可以对数据库和页面等监控如 ado ef mvc mongodb) 本文以 ...

  9. SQLite一些函数用法

    --格林威治日期时间,比北京时间晚8小时 select datetime('now'); --格林威治日期 select date('now'); --本地时间 select time('now',' ...

  10. Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) E. Santa Claus and Tangerines

    E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes inpu ...