当前位置: 首页 > news >正文

vue 甘特图 vxe-gantt 如何自定义依赖线的颜色

vue 甘特图 vxe-gantt 如何自定义依赖线的颜色,通过设置 links 定义连接线,from 对应源任务的行主键,tom 对应目标任务的行主键

查看官网:https://gantt.vxeui.com/
gitbub:https://github.com/x-extends/vxe-gantt
gitee:https://gitee.com/x-extends/vxe-gantt

自定义所有连接线的的颜色

image

通过设置 task-link-config.lineColor 自定义连接线的颜色

<template><vxe-gantt v-bind="ganttOptions"></vxe-gantt>
</template><script setup>
import { reactive } from 'vue'
import { VxeGanttDependencyType } from 'vxe-gantt'const ganttOptions = reactive({border: true,height: 500,rowConfig: {keyField: 'id' // 行主键},taskBarConfig: {showProgress: true, // 是否显示进度条showContent: true, // 是否在任务条显示内容move: true, // 是否允许拖拽任务移动日期resize: true, // 是否允许拖拽任务调整日期barStyle: {round: true, // 圆角bgColor: '#fca60b', // 任务条的背景颜色completedBgColor: '#65c16f' // 已完成部分任务条的背景颜色}},taskViewConfig: {tableStyle: {width: 480 // 表格宽度}},taskLinkConfig: {lineColor: '#fad06c' // 给所有线自定义颜色},links: [{ from: 10001, to: 10002, type: VxeGanttDependencyType.FinishToFinish },{ from: 10004, to: 10005, type: VxeGanttDependencyType.StartToStart },{ from: 10005, to: 10006, type: VxeGanttDependencyType.FinishToStart },{ from: 10013, to: 10012, type: VxeGanttDependencyType.StartToFinish }],columns: [{ type: 'seq', width: 70 },{ field: 'title', title: '任务名称' },{ field: 'start', title: '开始时间', width: 100 },{ field: 'end', title: '结束时间', width: 100 },{ field: 'progress', title: '进度(%)', width: 80 }],data: [{ id: 10001, title: '任务1', start: '2024-03-01', end: '2024-03-04', progress: 3 },{ id: 10002, title: '任务2', start: '2024-03-03', end: '2024-03-08', progress: 10 },{ id: 10003, title: '任务3', start: '2024-03-03', end: '2024-03-11', progress: 90 },{ id: 10004, title: '任务4', start: '2024-03-05', end: '2024-03-11', progress: 15 },{ id: 10005, title: '任务5', start: '2024-03-08', end: '2024-03-15', progress: 100 },{ id: 10006, title: '任务6', start: '2024-03-10', end: '2024-03-21', progress: 5 },{ id: 10007, title: '任务7', start: '2024-03-15', end: '2024-03-24', progress: 70 },{ id: 10008, title: '任务8', start: '2024-03-05', end: '2024-03-15', progress: 50 },{ id: 10009, title: '任务9', start: '2024-03-19', end: '2024-03-20', progress: 5 },{ id: 10010, title: '任务10', start: '2024-03-12', end: '2024-03-20', progress: 10 },{ id: 10011, title: '任务11', start: '2024-03-01', end: '2024-03-08', progress: 90 },{ id: 10012, title: '任务12', start: '2024-03-03', end: '2024-03-06', progress: 60 },{ id: 10013, title: '任务13', start: '2024-03-02', end: '2024-03-05', progress: 50 },{ id: 10014, title: '任务14', start: '2024-03-04', end: '2024-03-15', progress: 0 },{ id: 10015, title: '任务15', start: '2024-03-01', end: '2024-03-05', progress: 30 }]
})
</script>

每条线单独自定义颜色

image

<template><vxe-gantt v-bind="ganttOptions"></vxe-gantt>
</template><script setup>
import { reactive } from 'vue'
import { VxeGanttDependencyType } from 'vxe-gantt'const ganttOptions = reactive({border: true,height: 500,rowConfig: {keyField: 'id' // 行主键},taskBarConfig: {showProgress: true, // 是否显示进度条showContent: true, // 是否在任务条显示内容move: true, // 是否允许拖拽任务移动日期resize: true, // 是否允许拖拽任务调整日期barStyle: {round: true, // 圆角bgColor: '#fca60b', // 任务条的背景颜色completedBgColor: '#65c16f' // 已完成部分任务条的背景颜色}},taskViewConfig: {tableStyle: {width: 480 // 表格宽度}},links: [{ from: 10001, to: 10002, lineColor: '#fad06c', type: VxeGanttDependencyType.FinishToFinish },{ from: 10004, to: 10005, lineColor: '#92c1f1', type: VxeGanttDependencyType.StartToStart },{ from: 10005, to: 10006, lineColor: '#fd9393', type: VxeGanttDependencyType.FinishToStart },{ from: 10013, to: 10012, lineColor: '#e78dd2', type: VxeGanttDependencyType.StartToFinish }],columns: [{ type: 'seq', width: 70 },{ field: 'title', title: '任务名称' },{ field: 'start', title: '开始时间', width: 100 },{ field: 'end', title: '结束时间', width: 100 },{ field: 'progress', title: '进度(%)', width: 80 }],data: [{ id: 10001, title: '任务1', start: '2024-03-01', end: '2024-03-04', progress: 3 },{ id: 10002, title: '任务2', start: '2024-03-03', end: '2024-03-08', progress: 10 },{ id: 10003, title: '任务3', start: '2024-03-03', end: '2024-03-11', progress: 90 },{ id: 10004, title: '任务4', start: '2024-03-05', end: '2024-03-11', progress: 15 },{ id: 10005, title: '任务5', start: '2024-03-08', end: '2024-03-15', progress: 100 },{ id: 10006, title: '任务6', start: '2024-03-10', end: '2024-03-21', progress: 5 },{ id: 10007, title: '任务7', start: '2024-03-15', end: '2024-03-24', progress: 70 },{ id: 10008, title: '任务8', start: '2024-03-05', end: '2024-03-15', progress: 50 },{ id: 10009, title: '任务9', start: '2024-03-19', end: '2024-03-20', progress: 5 },{ id: 10010, title: '任务10', start: '2024-03-12', end: '2024-03-20', progress: 10 },{ id: 10011, title: '任务11', start: '2024-03-01', end: '2024-03-08', progress: 90 },{ id: 10012, title: '任务12', start: '2024-03-03', end: '2024-03-06', progress: 60 },{ id: 10013, title: '任务13', start: '2024-03-02', end: '2024-03-05', progress: 50 },{ id: 10014, title: '任务14', start: '2024-03-04', end: '2024-03-15', progress: 0 },{ id: 10015, title: '任务15', start: '2024-03-01', end: '2024-03-05', progress: 30 }]
})
</script>

https://gitee.com/x-extends/vxe-gantt

http://www.jsqmd.com/news/122000/

相关文章:

  • LangFlow构建用户反馈智能分类系统
  • Excalidraw能否替代PowerPoint进行技术宣讲?
  • LangFlow打造预算申请智能审核工具
  • 调试的终结 软件现在可以自我编写、运行和修复——我们的工作正在从控制转向描述。
  • LangFlow输出格式定制:满足不同下游需求
  • Linux MIPI摄像头数据零拷贝投放到DRM显示系统全栈分析
  • 我们对人类IPO的圣诞愿望清单 告诉我们您的优化目标是什么
  • Postman接口测试实战:从基础到高效应用
  • PAT 1091 Acute Stroke
  • LangFlow调度定时任务:自动化AI处理流程
  • JMeter性能测试全流程配置详解
  • 移动端自动化测试的核心利器:Appium技术解析与实践指南
  • LangFlow集成HuggingFace模型:释放开源大模型全部潜力
  • Agent Skills 这项技术如何“教会”AI 助手做专业化工作
  • LangFlow创建多语言翻译管道的实际操作
  • 期末复习01-02(结构类)
  • LangFlow实现多轮对话管理的架构设计
  • 宁夏银川/西安/郑州/太原商业文旅街区氛围升级设计公司【TOP3】
  • LangFlow后端扩展开发教程:添加私有模型支持
  • LangFlow导入导出功能使用说明:跨平台迁移无忧
  • Agent Skills 扩展了 Claude 用户创建、部署、分享与发现新的“智能体技能”的能力
  • 基于Java+SSM+Flask校内互助交易平台(源码+LW+调试文档+讲解等)/校园互助/校内交易/学生互助平台/校园二手交易/校内交易平台/学生交易平台/校园资源共享/校内资源共享/学生买卖平台
  • MCP与 Claude Skills让我想起 Unix/Linux 与 Web 的早期
  • LangFlow开发股票行情解读机器人的实践
  • 大学生必备8个免费AI写论文工具:效率飙升200%,告别拖延! - 麟书学长
  • LangFlow构建个性化推荐引擎的尝试
  • LangFlow批量处理数据集的高效方式
  • LangFlow创建会议纪要自动生成工具的步骤
  • LangFlow构建跨部门协作流程优化器
  • 2025年广东惠州高光喷涂服务商选型深度剖析与行业指南 - 2025年品牌推荐榜