jsGantt(甘特图控件)_jsgantt 框架-程序员宅基地

技术标签: stylesheet  date  variables  constructor  HTML  J2EE  javascript  任务  

jsGantt是一个基于Javascript/CSS/HTML实现的甘特图控件。可以对任务进行分组、设置任务依赖、不同任务用不同颜标识、设置里程碑。支持动态加载任务,按天、周、月、小时、分钟查看任务甘特图。

主页:http://www.jsgantt.com/

下载地址:http://download.csdn.net/detail/evangel_z/4441353


TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend)
pID: (required) is a unique ID used to identify each row for parent functions and for setting dom id for hiding/showing
pName: (required) is the task Label
pStart: (required) the task start date, can enter empty date ('') for groups. You can also enter specific time (2/10/2008 12:00) for additional percision or half days.
pEnd: (required) the task end date, can enter empty date ('') for groups
pColor: (required) the html color for this task; e.g. '00ff00'
pLink: (optional) any http link navigated to when task bar is clicked.
pMile:(optional) represent a milestone
pRes: (optional) resource name
pComp: (required) completion percent
pGroup: (optional) indicates whether this is a group(parent) - 0=NOT Parent; 1=IS Parent
pParent: (required) identifies a parent pID, this causes this task to be a child of identified task
pOpen: can be initially set to close folder when chart is first drawn
pDepend: optional list of id's this task is dependent on ... line drawn from dependent to this item
pCaption: optional caption that will be added after task bar if CaptionType set to "Caption"
*You should be able to add items to the chart in realtime via javascript and issuing "g.Draw()" command.

JSGantt.parseXML("project.xml",g);

<project>
<task>
	<pID>10</pID>
	<pName>WCF Changes</pName>
	<pStart></pStart>
	<pEnd></pEnd>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes></pRes>
	<pComp>0</pComp>
	<pGroup>1</pGroup>
	<pParent>0</pParent>
	<pOpen>1</pOpen>
	<pDepend />
</task>
<task>
	<pID>20</pID>
	<pName>Move to WCF from remoting</pName>
	<pStart>8/11/2008</pStart>
	<pEnd>8/15/2008</pEnd>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes>Rich</pRes>
	<pComp>10</pComp>
	<pGroup>0</pGroup>
	<pParent>10</pParent>
	<pOpen>1</pOpen>
	<pDepend></pDepend>
</task>
<task>
	<pID>30</pID>
	<pName>add Auditing</pName>
	<pStart>8/19/2008</pStart>
	<pEnd>8/21/2008</pEnd>
	<pColor>0000ff</pColor>
	<pLink></pLink>
	<pMile>0</pMile>
	<pRes>Mal</pRes>
	<pComp>50</pComp>
	<pGroup>0</pGroup>
	<pParent>10</pParent>
	<pOpen>1</pOpen>
	<pDepend>20</pDepend>
</task>
</project>

Final code should look like 

<link rel="stylesheet" type="text/css" href="jsgantt.css" />
<script language="javascript" src="jsgantt.js"></script>
<div style="position:relative" class="gantt" id="GanttChartDIV"></div>
<script>
  var g = new JSGantt.GanttChart('g',document.getElementById('GanttChartDIV'), 'day');
  g.setShowRes(1); // Show/Hide Responsible (0/1)
  g.setShowDur(1); // Show/Hide Duration (0/1)
  g.setShowComp(1); // Show/Hide % Complete(0/1)
  g.setCaptionType('Resource');  // Set to Show Caption
  if( g ) {
    g.AddTaskItem(new JSGantt.TaskItem(1,   'Define Chart API',     '',          '',          'ff0000', 'http://help.com', 0, 'Brian',     0, 1, 0, 1));
    g.AddTaskItem(new JSGantt.TaskItem(11,  'Chart Object',         '2/20/2008', '2/20/2008', 'ff00ff', 'http://www.yahoo.com', 1, 'Shlomy',  100, 0, 1, 1));
    g.AddTaskItem(new JSGantt.TaskItem(12,  'Task Objects',         '',          '',          '00ff00', '', 0, 'Shlomy',   40, 1, 1, 1));
    g.AddTaskItem(new JSGantt.TaskItem(121, 'Constructor Proc',     '2/21/2008', '3/9/2008',  '00ffff', 'http://www.yahoo.com', 0, 'Brian T.', 60, 0, 12, 1));
    g.AddTaskItem(new JSGantt.TaskItem(122, 'Task Variables',       '3/6/2008',  '3/11/2008', 'ff0000', 'http://help.com', 0, '',         60, 0, 12, 1,121));
    g.AddTaskItem(new JSGantt.TaskItem(123, 'Task Functions',       '3/9/2008',  '3/29/2008', 'ff0000', 'http://help.com', 0, 'Anyone',   60, 0, 12, 1, 0, 'This is another caption'));
    g.AddTaskItem(new JSGantt.TaskItem(2,   'Create HTML Shell',    '3/24/2008', '3/25/2008', 'ffff00', 'http://help.com', 0, 'Brian',    20, 0, 0, 1,122));
    g.AddTaskItem(new JSGantt.TaskItem(3,   'Code Javascript',      '',          '',          'ff0000', 'http://help.com', 0, 'Brian',     0, 1, 0, 1 ));
    g.AddTaskItem(new JSGantt.TaskItem(31,  'Define Variables',     '2/25/2008', '3/17/2008', 'ff00ff', 'http://help.com', 0, 'Brian',    30, 0, 3, 1, ,'Caption 1'));
    g.AddTaskItem(new JSGantt.TaskItem(32,  'Calculate Chart Size', '3/15/2008', '3/24/2008', '00ff00', 'http://help.com', 0, 'Shlomy',   40, 0, 3, 1));
    g.AddTaskItem(new JSGantt.TaskItem(33,  'Draw Taks Items',      '',          '',          '00ff00', 'http://help.com', 0, 'Someone',  40, 1, 3, 1));
    g.AddTaskItem(new JSGantt.TaskItem(332, 'Task Label Table',     '3/6/2008',  '3/11/2008', '0000ff', 'http://help.com', 0, 'Brian',    60, 0, 33, 1));
    g.AddTaskItem(new JSGantt.TaskItem(333, 'Task Scrolling Grid',  '3/9/2008',  '3/20/2008', '0000ff', 'http://help.com', 0, 'Brian',    60, 0, 33, 1));
    g.AddTaskItem(new JSGantt.TaskItem(34,  'Draw Task Bars',       '',          '',          '990000', 'http://help.com', 0, 'Anybody',  60, 1, 3, 1));
    g.AddTaskItem(new JSGantt.TaskItem(341, 'Loop each Task',       '3/26/2008', '4/11/2008', 'ff0000', 'http://help.com', 0, 'Brian',    60, 0, 34, 1, "332,333"));
    g.AddTaskItem(new JSGantt.TaskItem(342, 'Calculate Start/Stop', '4/12/2008', '5/18/2008', 'ff6666', 'http://help.com', 0, 'Brian',    60, 0, 34, 1));
    g.AddTaskItem(new JSGantt.TaskItem(343, 'Draw Task Div',        '5/13/2008', '5/17/2008', 'ff0000', 'http://help.com', 0, 'Brian',    60, 0, 34, 1));
    g.AddTaskItem(new JSGantt.TaskItem(344, 'Draw Completion Div',  '5/17/2008', '6/04/2008', 'ff0000', 'http://help.com', 0, 'Brian',    60, 0, 34, 1));
    g.AddTaskItem(new JSGantt.TaskItem(35,  'Make Updates',         '10/17/2008','12/04/2008','f600f6', 'http://help.com', 0, 'Brian',    30, 0, 3,  1));
    g.Draw();	
    g.DrawDependencies();
  }
  else
  {
    alert("not defined");
  }
</script>
  

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/evangel_z/article/details/7768100

智能推荐

Python之高阶函数(abs、map、reduce、filter、lambda匿名函数)_print( list( map( abs,n)))-程序员宅基地

Python之高阶函数(abs、map、reduce、filter、lambda匿名函数)什么是内置高阶函数高阶函数:一个函数可以作为参数传给另外一个函数,或者一个函数的返回值为另外一个函数(若返回值为该函数本身,则为递归),满足其一则为高阶函数。abs函数abs() 函数返回数字的绝对值。示例:>>> a = -16>>> print(a..._print( list( map( abs,n)))

如何从官网下载Hibernate源码与jar包2017.12.05(包含历史版本)-程序员宅基地

Hibernate在Java三大框架SSH中,主要完成数据持久化操作第一步:访问官方网站http://hibernate.org/;点击下图标识模块中more按钮第二步:点击下图中Releases右侧的弹出菜单选择需要的历史版本第三步:选择需要的版本进行下载

java之用三元组实现稀疏矩阵_java 三元组-程序员宅基地

之前写过js的算法实现,但是也只是看了教程,自己没有去手动实现,所以算法的水平还是很低。现在重新开始好好写一下这段时间学习算法的代码实现。算法来源是b站的BV1E4411H73v.因为教学是java实现的,所以跟着老师用java的算法实现,虽然工作中用的是c#,就当做新学一门语言吧。稀疏矩阵 在矩阵中,若数值为0的元素数目远远多于非0元素的数目,并且非0元素分布没有规律时,则称该矩阵为稀疏矩阵;与之相反,若非0元素数目占大多数时,则称该矩阵为稠密矩阵。定义非零元素的总数比..._java 三元组

bzoj1006 [HNOI2008]神奇的国度(求弦图的色数,最大势算法)_弦图色数-程序员宅基地

题目大意就是给你一张弦图,问你色数。弦图的色数等于团数。我们可以用最大势算法(Maximum Cardinality Search)求出完美消除序列,然后贪心的倒序染最小的颜色,染的最大的颜色就是答案。我这里直接认为就是label的最大值+1,不知道对不对,感觉没啥问题。如果有问题还请dalao指出,求轻虐。具体有关弦图的理论可以看cdq在wc2009的论文:《弦图与区间图》其实应该用链表来实现,不_弦图色数

深度探索MySQL主从复制原理-程序员宅基地

概要MySQL Replication (MySQL 主从复制) 是什么?为什么要主从复制以及它的实现原理是什么?MySQL 主从复制概念MySQL 主从复制是指数据可以从一个MySQL数据库服务器主节点复制到一个或多个从节点。MySQL 默认采用异步复制方式,这样从节点不用一直访问主服务器来更新自己的数据,数据的更新可以在远程连接上进行,从节点可以复制主数据库中的所有数据库或者...

【CodeForces】651C - Watchmen(排序,容斥原理)-程序员宅基地

题目链接:点击打开题目C. Watchmentime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWatchmen are in a danger and D

随便推点

android nat64,dpvs学习笔记: 18 nat64 的实现_殷商时代的博客-程序员宅基地

这几天 iqiyi 同学做了大更新,dpvs 增加 nat64 功能,这样机房对外暴露 ipv6, 对内还不用修改 ipv4 业务代码。算是重量级武器吧,为 ipv6 升级过渡提供了双栈的保障。提前想好的问题如何使用 nat64 配置呢?会不会很繁琐后端 real server 看到的也是 ipv6 地址?怎么正确的获取源 ip,涉及 toa 的实现为了兼容 4 to 4 和 6 to 6,现有..._./ipvsadm --add-laddr

火狐插件油猴Greasemonkey系列一-程序员宅基地

油猴Greasemonkey是火狐浏览器user script插件,类似于浏览器端的页面拦截器,对于补充修改增强遗留系统功能有不错的效果。缺点在于插件是安装在浏览器端,部署不是很方便,所以只能是个小众软件。本系列主要测试油猴插件引用jQuery库的操作。火狐版本25.0,油猴插件版本1.15.1-signed。引入的两个测试jQuery版本为:页面版本2.2.1,插件版本1.12.1。...

日更第3期-2015-1-18-openFrameworks系列第二讲-规范学习函数式编程!-程序员宅基地

昨天周六,我休息了一次。今天感觉心情还不错,就干脆多更一点。恩,同学们,注意啦,今天的课程可是不仅长,还非常的不轻松哦!我们主要要讲一下C++中继承于C的函数式编程,还有判断这种特殊结构;除此之外,OpenFrameworks的一些基础函数、概念,我也会悉数讲解。总之,做好觉悟再上吧!有问题可以发到我的邮箱:[email protected]于是,开始今天的课程!...

ThinkPHP中表单的action中应该如何写_thinkphp 表单中的action-程序员宅基地

1.问题描述用ThinkPHP做一个用户登录和注册界面,在提交表单时action属性不知如何填写注:我使用的是ThinkPHP3.2.3版本 不同版本应该会有差异2.解决过程方法1):localhost/..../index.php/模块/控制器/方法/参数....即使用完整的URL地址,指向你_thinkphp 表单中的action

前端未来发展方向_前端技术建设长期-程序员宅基地

转载至:https://jixianqianduan.com/frontend-javascript/2016/12/11/future-front-end.html2016年结束了,前端技术的发展也将进入到一个新的阶段,那么未来又会给我们带来什么呢?这里就个人发表下意见,不喜勿喷。  就前端主流技术框架的发展而言,过去的几年里发展极快,在填补原有技术框架空白和不足的同时也渐渐趋于_前端技术建设长期

a33 linux 硬解码_全志A33-修改linux kernel启动参数-程序员宅基地

开发板:A33,运行linux-3.4.39主机:Ubuntu 14.04----------------------------------------------1. 修改kernel启动参数的几种方式1)make menuconfig里修改“General Setup”子菜单中的“Default kernel command string” 选项,通过修改这个选项来修改autoconf.h文..._ubuntu 23 kernel 参数