Highcharts甘特图基本用法(highcharts-gantt.js)
参考官方文档:
https://www.highcharts.com/docs/gantt/getting-started-gantt
https://www.highcharts.com/demo/gantt/project-management
https://www.hcharts.cn/demo/gantt
链接在下面按需引入

https://code.highcharts.com/gantt/highcharts-gantt.js
https://code.highcharts.com/highcharts.js
https://code.highcharts.com/gantt/modules/gantt.js
JS初始化举例:
const day = 24 * 36e5,today = Math.floor(Date.now() / day) * day;const options = {chart: {plotBackgroundColor: 'rgba(128,128,128,0.02)',plotBorderColor: 'rgba(128,128,128,0.1)',plotBorderWidth: 1},plotOptions: {series: {borderRadius: '50%',connectors: {dashStyle: 'ShortDot',lineWidth: 2,radius: 5,startMarker: {enabled: false}},groupPadding: 0,dataLabels: [{enabled: true,align: 'left',format: '{point.name}',padding: 10,style: {fontWeight: 'normal',textOutline: 'none'}}, {enabled: true,align: 'right',format: '{#if point.completed}{(multiply ' +'point.completed.amount 100):.0f}%{/if}',padding: 10,style: {fontWeight: 'normal',textOutline: 'none',opacity: 0.6}}]}},series: [{name: 'Offices',data: [{name: 'New offices',id: 'new_offices',owner: 'Peter'}, {name: 'Prepare office building',id: 'prepare_building',parent: 'new_offices',start: today - (2 * day),end: today + (6 * day),completed: {amount: 0.2},owner: 'Linda'}, {name: 'Inspect building',id: 'inspect_building',dependency: 'prepare_building',parent: 'new_offices',start: today + 6 * day,end: today + 8 * day,owner: 'Ivy'}, {name: 'Passed inspection',id: 'passed_inspection',dependency: 'inspect_building',parent: 'new_offices',start: today + 9.5 * day,milestone: true,owner: 'Peter'}, {name: 'Relocate',id: 'relocate',dependency: 'passed_inspection',parent: 'new_offices',owner: 'Josh'}, {name: 'Relocate staff',id: 'relocate_staff',parent: 'relocate',start: today + 10 * day,end: today + 11 * day,owner: 'Mark'}, {name: 'Relocate test facility',dependency: 'relocate_staff',parent: 'relocate',start: today + 11 * day,end: today + 13 * day,owner: 'Anne'}, {name: 'Relocate cantina',dependency: 'relocate_staff',parent: 'relocate',start: today + 11 * day,end: today + 14 * day}]}, {name: 'Product',data: [{name: 'New product launch',id: 'new_product',owner: 'Peter'}, {name: 'Development',id: 'development',parent: 'new_product',start: today - day,end: today + (11 * day),completed: {amount: 0.6,fill: '#e80'},owner: 'Susan'}, {name: 'Beta',id: 'beta',dependency: 'development',parent: 'new_product',start: today + 12.5 * day,milestone: true,owner: 'Peter'}, {name: 'Final development',id: 'finalize',dependency: 'beta',parent: 'new_product',start: today + 13 * day,end: today + 17 * day}, {name: 'Launch',dependency: 'finalize',parent: 'new_product',start: today + 17.5 * day,milestone: true,owner: 'Peter'}]}],tooltip: {pointFormat: '<span style="font-weight: bold">{point.name}</span><br>' +'{point.start:%e %b}' +'{#unless point.milestone} → {point.end:%e %b}{/unless}' +'<br>' +'{#if point.completed}' +'Completed: {multiply point.completed.amount 100}%<br>' +'{/if}' +'Owner: {#if point.owner}{point.owner}{else}unassigned{/if}'},title: {text: 'Gantt Project Management'},xAxis: [{currentDateIndicator: {color: '#2caffe',dashStyle: 'ShortDot',width: 2,label: {format: ''}},dateTimeLabelFormats: {day: '%e<br><span style="opacity: 0.5; font-size: 0.7em">%a</span>'},grid: {borderWidth: 0},gridLineWidth: 1,min: today - 3 * day,max: today + 18 * day,custom: {today,weekendPlotBands: true}}],yAxis: {grid: {borderWidth: 0},gridLineWidth: 0,labels: {symbol: {width: 8,height: 6,x: -4,y: -2}},staticScale: 30},accessibility: {keyboardNavigation: {seriesNavigation: {mode: 'serialize'}},point: {descriptionFormatter: function (point) {const completedValue = point.completed ?point.completed.amount || point.completed : null,completed = completedValue ?' Task ' + Math.round(completedValue * 1000) / 10 +'% completed.' :'',dependency = point.dependency &&point.series.chart.get(point.dependency).name,dependsOn = dependency ?' Depends on ' + dependency + '.' : '';return Highcharts.format(point.milestone ?'{point.yCategory}. Milestone at {point.x:%Y-%m-%d}. ' +'Owner: {point.owner}.{dependsOn}' :'{point.yCategory}.{completed} Start ' +'{point.x:%Y-%m-%d}, end {point.x2:%Y-%m-%d}. Owner: ' +'{point.owner}.{dependsOn}',{ point, completed, dependsOn });}}},lang: {accessibility: {axis: {xAxisDescriptionPlural: 'The chart has a two-part X axis ' +'showing time in both week numbers and days.'}}}};// Plug-in to render plot bands for the weekendsHighcharts.addEvent(Highcharts.Axis, 'foundExtremes', e => {if (e.target.options.custom && e.target.options.custom.weekendPlotBands) {const axis = e.target,chart = axis.chart,day = 24 * 36e5,isWeekend = t => /[06]/.test(chart.time.dateFormat('%w', t)),plotBands = [];let inWeekend = false;for (let x = Math.floor(axis.min / day) * day;x <= Math.ceil(axis.max / day) * day;x += day) {const last = plotBands.at(-1);if (isWeekend(x) && !inWeekend) {plotBands.push({from: x,color: {pattern: {path: 'M 0 10 L 10 0 M -1 1 L 1 -1 M 9 11 L 11 9',width: 10,height: 10,color: 'rgba(128,128,128,0.15)'}}});inWeekend = true;}if (!isWeekend(x) && inWeekend && last) {last.to = x;inWeekend = false;}}axis.options.plotBands = plotBands;}});Highcharts.ganttChart('container', options);//container这里是div的id
相关文章:
Highcharts甘特图基本用法(highcharts-gantt.js)
参考官方文档: https://www.highcharts.com/docs/gantt/getting-started-gantt https://www.highcharts.com/demo/gantt/project-management https://www.hcharts.cn/demo/gantt 链接在下面按需引入 https://code.highcharts.com/gantt/highcharts-gantt.js htt…...
【Linux庖丁解牛】—Linux基本指令(上)!
🌈个人主页:秋风起,再归来~🔥系列专栏: Linux庖丁解牛 🔖克心守己,律己则安 目录 1、 pwd命令 2、ls 指令 3、cd 指令 4、Linux下的根目录 5、touch指令 6、 stat指令 7、mkdi…...
node.js 中的进程和线程工作原理
本文所有的代码均基于 node.js 14 LTS 版本分析 概念 进程是对正在运行中的程序的一个抽象,是系统进行资源分配和调度的基本单位,操作系统的其他所有内容都是围绕着进程展开的 线程是操作系统能够进行运算调度的最小单位,其是进程中的一个执…...
Qt/C++ TCP调试助手V1.1 新增图像传输与接收功能(附发布版下载链接)
发布版本链接 通过百度网盘分享的文件:TCP调试助手V1.zip(含客户端与服务器) 链接:https://pan.baidu.com/s/14LTRPChPhYdwp_s6KeyBiA?pwdcedu 提取码:cedu 基于Qt/C实现了一款功能丰富的TCP服务器与客户端调试助手…...
DNS解析流程
DNS解析流程: 浏览器DNS缓存: 当我们在浏览器中访问某个域名时,浏览器首先会检查自己内部的DNS缓存,看是否有该域名的对应IP地址。如果有,直接使用缓存中的IP地址,跳过后续步骤。 本地系统DNS缓存…...
[PTA]7-1 藏头诗
[PTA]7-1 藏头诗 本题要求编写一个解密藏头诗的程序。 注:在 2022 年 7 月 14 日 16 点 50 分以后,该题数据修改为 UTF-8 编码。 输入格式: 输入为一首中文藏头诗,一共四句,每句一行。注意:一个汉字占三…...
每日OJ题_牛客_WY22 Fibonacci数列(斐波那契)
目录 牛客_WY22 Fibonacci数列(斐波那契) 解析代码 牛客_WY22 Fibonacci数列(斐波那契) Fibonacci数列_牛客题霸_牛客网 解析代码 求斐波那契数列的过程中,判断⼀下:何时 n 会在两个 fib 数之间。 #in…...
SQL 查询语句汇总
在软件开发和数据分析中,SQL(结构化查询语言)是与数据库交互的重要工具。为了更好地理解 SQL 查询语句的使用,本文将设计一个简单的数据库,包括几张表,并通过这些表展示各种 SQL 查询的应用。 一、背景信息…...
封装一个语言识别文字的方法
语音识别 需求: 参考官方文档,整合语音识别apicallback 的写法改为 Promise 的版本 在startRecord中: 参考文档实例化-开启转换将录制的内容传递给录音识别回调函数中的 Log,改为 Logger 在closeRecord: 结束识别…...
解决 iOS App Tracking Transparency 权限问题
解决 iOS App Tracking Transparency 权限问题 在 iOS 14 及更高版本中,Apple 引入了 App Tracking Transparency (ATT) 框架,要求应用在跟踪用户之前必须获得用户的明确许可。这通常涉及到访问用户的广告标识符(IDFA)。如果没有…...
ClickHouse 的底层架构和原理
ClickHouse 是一个用于实时分析和处理大规模数据的列式数据库,其设计目标是高效地处理海量数据的查询需求。它特别适合 OLAP(Online Analytical Processing)场景,能够在不依赖复杂的索引结构的情况下,实现极快的查询速…...
rtmp推流
获取摄像头名称 打开命令行工具,运行以下命令以列出所有可用的视频设备: ffmpeg -f dshow -list_devices true -i dummy查找输出中的“Video devices”部分,记录下你的摄像头名称。 构建推流命令 ffmpeg -f dshow -i video"摄像头名称…...
【数据库】死锁排查方式
定位 查是否锁表 select username,lockwait,status,machine,program from v$session where sid in (select session_id from v$locked_object); 查锁表sql select sql_text from v$sql where hash_value in (select sql_hash_value from v$session where sid in (select s…...
去耦合的一些建议
尽量少用全局变量,以减少状态共享和潜在的副作用。 模块化设计:将代码分成小模块,每个模块独立实现特定功能,减少模块之间的相互依赖。 封装:将数据和操作封装在类中,控制对内部状态的访问,避…...
SpringBoot+Thymeleaf图书管理系统
一、项目介绍 > 这是一个基于SpringBootThymeleaf实现的图书管理系统。 > 包含图书管理、作者管理、分类管理、出版社管理等功能。 > 界面简洁美观,代码结构清晰,完成度比较高,适用于JAVA初学者作为参考项目。 二、项目演示 三…...
TDengine 签约前晨汽车,解锁智能出行的无限潜力
在全球汽车产业转型升级的背景下,智能网联和新能源技术正迅速成为商用车行业的重要发展方向。随着市场对环保和智能化需求的日益增强,企业必须在技术创新和数据管理上不断突破,以满足客户对高效、安全和智能出行的期待。在这一背景下…...
模板字符串中定义方法并传参
遇到一个使用js es6的模板字符串进行事件绑定和传参的问题,这个问题的引起是因为使用innerHTML插入了一大串html并进行事件的绑定和传参。 以react为例,写一个demo记录一下 模板字符串中写方法的话需要用onclick来定义,传参需要这么写${char…...
Numpy 数组元素添加与元素删除函数详解
元素添加 Numpy中有类似python列表操作函数append()及insert(),但是用法稍有不同,append()及insert()不作为数组的实例方法使用。 np.append() np.append()的参数如下 def append(arr, values, axisNone): 其中,arr为数组对象࿰…...
【Python】高效图像处理库:pyvips
月亮慢慢变圆,日子慢慢变甜。 在图像处理领域,pyvips 是一个轻量级且高效的库,适合处理大规模图像、实现高性能的操作。相较于其他常见的图像处理库如 PIL 或 OpenCV,pyvips 以其低内存占用和出色的速度脱颖而出。本文将介绍 pyv…...
java项目之在线考试与学习交流网页平台源码(springboot)
风定落花生,歌声逐流水,大家好我是风歌,混迹在java圈的辛苦码农。今天要和大家聊的是一款基于springboot的在线考试与学习交流网页平台。项目源码以及部署相关请联系风歌,文末附上联系信息 。 项目简介: 基于JAVA语言…...
[CD326(EpCAM)] 靶点技术深度解析:分子机制、抗体药物开发与未来趋势
在生物制药与细胞生物学研究领域,靶点的选择与机制解析是药物研发的基石。CD326(EpCAM,上皮细胞黏附分子) 作为一种广泛表达于上皮细胞表面的I型跨膜糖蛋白,不仅是上皮组织稳态维持的关键因子,更是当前抗体…...
腾讯云推出“领域虾”CloudQ:把企业云上治理,装进你每天都在用的聊天框
好家伙,腾讯云又给龙虾市场上新了。最近,腾讯云官宣的 CloudQ IT 老师傅(全球首款 ITOM“领域虾”),直接把云上的技术难题给办了。你甚至都不用登录控制台、不用敲命令,在微信里聊聊天就能完成架构巡检、风…...
4个核心预训练模型应用指南:从资源获取到问题诊断
4个核心预训练模型应用指南:从资源获取到问题诊断 【免费下载链接】so-vits-svc SoftVC VITS Singing Voice Conversion 项目地址: https://gitcode.com/gh_mirrors/so/so-vits-svc 预训练模型是so-vits-svc实现高质量语音转换的基础组件,这些经过…...
Ai2Psd终极指南:如何将Illustrator矢量图层完美导出到Photoshop
Ai2Psd终极指南:如何将Illustrator矢量图层完美导出到Photoshop 【免费下载链接】ai-to-psd A script for prepare export of vector objects from Adobe Illustrator to Photoshop 项目地址: https://gitcode.com/gh_mirrors/ai/ai-to-psd 还在为AI到PSD的格…...
从系统编程到 JavaScript/TypeScript
然而,在通往 AGI(通用人工智能)的道路上,一个反直觉的现象正在发生。如果你拆解当下最热门的 AI 项目,你会惊讶地发现:TypeScript 和 JavaScript 正在成为 AI 应用层的“官方语言”。OpenClaw (ClawdBot): …...
Graphormer模型架构深度解析:Positional Encoding如何编码分子图拓扑结构?
Graphormer模型架构深度解析:Positional Encoding如何编码分子图拓扑结构? 1. Graphormer模型概述 Graphormer是微软研究院开发的一种基于纯Transformer架构的图神经网络模型,专门为分子图(原子-键结构)的全局结构建…...
轰动全国的“327国债期货事件”的四大赢家后来都怎么样了?
轰动全国的“327国债期货事件”的四大赢家后来都怎么样了?轰动全国的“327国债期货事件”,四大赢家28岁的魏东、29岁的袁宝璟、34岁的周正毅以及30岁的刘汉,一举实现资本原始积累,称霸一方。天道好还,四人最终悲剧谢幕…...
提升中文编辑效率:notepad--本土化配置指南
提升中文编辑效率:notepad--本土化配置指南 【免费下载链接】notepad-- 一个支持windows/linux/mac的文本编辑器,目标是做中国人自己的编辑器,来自中国。 项目地址: https://gitcode.com/GitHub_Trending/no/notepad-- 作为中文用户&a…...
Klipper固件深度剖析:从分布式架构到高级运动控制实战指南
Klipper固件深度剖析:从分布式架构到高级运动控制实战指南 【免费下载链接】klipper Klipper is a 3d-printer firmware 项目地址: https://gitcode.com/GitHub_Trending/kl/klipper Klipper是一款革命性的3D打印机固件,采用独特的分布式架构设计…...
精准权限控制:Excel限制密码设置与使用技巧
当Excel表格发出去后,你是否会担心表格被随意修改?其实,Excel提供的“限制密码”就能很好的避免这个问题。下面一起来看看具体如何使用吧!一、认识两种限制密码Excel的限制密码分为两大类:保护工作表和保护工作簿。前者…...
