欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript多功能甘特圖組件jsGantt詳解

 更新時(shí)間:2023年07月06日 08:58:04   作者:杭州程序員張張  
jsGantt是一個(gè)可定制的、靈活的、多語言的甘特圖組件,由原生 JavaScript構(gòu)建,它使用客戶端渲染以獲得快速的性能和動(dòng)態(tài)的交互性,非常適用于任何需要交互式時(shí)間線或時(shí)間表顯示的項(xiàng)目,本文就給大家介紹一下JavaScript多功能甘特圖組件jsGantt

更多特點(diǎn)

  • 多語言支持: 通過對(duì)多語言的支持,使您的甘特圖可以在全球范圍內(nèi)使用。

  • 任務(wù)和可折疊的任務(wù)組: 以有組織的方式構(gòu)建你的任務(wù),并輕松瀏覽它們。

  • 依賴關(guān)系和突出顯示: 可視化任務(wù)的依賴性,并通過簡(jiǎn)單的懸停獲得任務(wù)細(xì)節(jié)。

  • 數(shù)據(jù)可編輯性: 通過內(nèi)嵌的責(zé)任方列表,隨時(shí)更新你的甘特表。

  • 附加列: 使用附加列來豐富你的甘特表,使其具有更多的數(shù)據(jù)。

  • 動(dòng)態(tài)加載和格式變化: 動(dòng)態(tài)加載任務(wù),并在小時(shí)、日、周、月和季度格式之間毫不費(fèi)力地切換。

  • 遠(yuǎn)程或本地?cái)?shù)據(jù): 從本地JS對(duì)象或遠(yuǎn)程JSON/XML數(shù)據(jù)源獲取你的甘特圖數(shù)據(jù)。

  • 也可與Angular、React、Vue和.Net合作

如何使用它

1.安裝并導(dǎo)入jsGantt。

# NPM
$ npm i jsgantt-improved
import {JSGantt} from 'jsgantt-improved';

2.或者直接在文檔中加載所需的JS/CSS文件。

<!-- OR -->
<link rel="stylesheet" href="dist/jsgantt.css" rel="external nofollow"  />
<script src="dist/jsgantt.js"></script>

3.創(chuàng)建一個(gè)空的容器來放置甘特圖。

<div style="position:relative" class="gantt" id="example"></div>

4.創(chuàng)建一個(gè)新的甘特圖實(shí)例。

  • pDiv: 圖表容器的選擇器

  • pFormat: "小時(shí)"、"日"、"周"、"月 "或 "季度"

// JSGantt.GanttChart(pDiv, pFormat);
const myChart = new JSGantt.GanttChart(document.getElementById('GanttChartDIV'), 'day');

5.從JS對(duì)象、JS字符串、JSON或XML加載任務(wù)數(shù)據(jù)。

// object
myChart.AddTaskItemObject({
  pID: 1,
  pName: "Name 1",
  pStart: "2023-02-25",
  pEnd: "2023-03-17",
  pPlanStart: "2023-04-01",
  pPlanEnd: "2023-04-15 12:00",
  pClass: "",
  pPlanClass: ""
  pLink: "",
  pMile: 0,
  pRes: "Brian", // resource name
  pComp: 0,
  pGroup: 0, // 0 = normal task, 1 = standard group task, 2 = combined group task
  pParent: 0, // parent ID
  pOpen: 1, // 1 = open, 0 = closed
  pDepend: "", // comma separated list of ids this task is dependent on
  pCaption: "",
  pCost: 1000,
  pNotes: "Some Notes text",
  pBarText: "ex. bar text",
  category: "My Category",
  sector: "Finance"
});
// JSON
JSGantt.parseJSON('./data.json', myChart);
// XML
JSGantt.parseXML("./data.xml", myChart);

6.在頁面上畫出圖表。

myChart.Draw();

7.按ID刪除一個(gè)任務(wù)項(xiàng)目。

myChart.RemoveTaskItem(5);

8.清除所有任務(wù)。

myChart.ClearTasks()

9.設(shè)置選項(xiàng)。

g.setOptions({
  vCaptionType: 'Complete',  // Set to Show Caption : None,Caption,Resource,Duration,Complete,     
  vQuarterColWidth: 36,
  vDateTaskDisplayFormat: 'day dd month yyyy', // Shown in tooltip box
  vDayMajorDateDisplayFormat: 'mon yyyy - Week ww',// Set format to display dates in the "Major" header of the "Day" view
  vWeekMinorDateDisplayFormat: 'dd mon', // Set format to display dates in the "Minor" header of the "Week" view
  vLang: lang,
  vAdditionalHeaders: { // Add data columns to your table
    category: {
      title: 'Category'
    },
    sector: {
      title: 'Sector'
    }
  },
  vShowTaskInfoLink: 1, // Show link in tool tip (0/1)
  vShowEndWeekDate: 0,  // Show/Hide the date for the last day of the week in header for daily view (1/0)
  vUseSingleCell: 10000, // Set the threshold at which we will only use one cell per table row (0 disables).  Helps with rendering performance for large charts.
  vFormatArr: ['Day', 'Week', 'Month', 'Quarter'], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers
  vScrollTo: new Date(),
  // EVENTS
  // OnChangee
  vEventsChange: {
    taskname: console.log,
    res: console.log,
  },
  // EventsClickCell
  vEvents: {
    taskname: console.log,
    res: console.log,
    dur: console.log,
    comp: console.log,
    start: console.log,
    end: console.log,
    planstart: console.log,
    planend: console.log,
    cost: console.log,
    additional_category: console.log, // for additional fields
    beforeDraw: ()=>console.log('before draw listener'),
    afterDraw: ()=>console.log('before after listener')
  },
  vEventClickRow: console.log,
  vEventClickCollapse: console.log
});

到此這篇關(guān)于JavaScript多功能甘特圖組件jsGantt詳解的文章就介紹到這了,更多相關(guān)JavaScript 甘特圖組件jsGantt內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 如何在uni-app使用微軟的文字轉(zhuǎn)語音服務(wù)

    如何在uni-app使用微軟的文字轉(zhuǎn)語音服務(wù)

    有了語音識(shí)別,交流就會(huì)變得很簡(jiǎn)單,下面這篇文章主要給大家介紹了關(guān)于如何在uni-app使用微軟的文字轉(zhuǎn)語音服務(wù)的相關(guān)資料,需要的朋友可以參考下
    2022-06-06
  • 基于Ionic3實(shí)現(xiàn)選項(xiàng)卡切換并重新加載echarts

    基于Ionic3實(shí)現(xiàn)選項(xiàng)卡切換并重新加載echarts

    這篇文章主要介紹了基于Ionic3實(shí)現(xiàn)選項(xiàng)卡切換并重新加載echarts,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-09-09
  • JavaScript Window.open彈窗使用詳解

    JavaScript Window.open彈窗使用詳解

    這篇文章主要為大家介紹了JavaScript Window.open 彈窗使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-11-11
  • JavaScript中數(shù)字計(jì)算時(shí)丟失精度問題解決方法

    JavaScript中數(shù)字計(jì)算時(shí)丟失精度問題解決方法

    在前端開發(fā)中,精度丟失是一個(gè)常見的問題,特別是在涉及到浮點(diǎn)數(shù)計(jì)算時(shí),下面這篇文章主要給大家介紹了關(guān)于JavaScript中數(shù)字計(jì)算時(shí)丟失精度問題的解決方法,需要的朋友可以參考下
    2024-09-09
  • 探討js字符串?dāng)?shù)組拼接的性能問題

    探討js字符串?dāng)?shù)組拼接的性能問題

    這篇文章主要介紹了有關(guān)js對(duì)字符串?dāng)?shù)組進(jìn)行拼接的性能問題,字符串連接一直是js中性能最低的操作之一,應(yīng)該如何解決呢?請(qǐng)參看本文的介紹
    2014-10-10
  • isArray()函數(shù)(JavaScript中對(duì)象類型判斷的幾種方法)

    isArray()函數(shù)(JavaScript中對(duì)象類型判斷的幾種方法)

    我們知道,JavaScript中檢測(cè)對(duì)象類型的運(yùn)算符有:typeof、instanceof,還有對(duì)象的constructor屬性
    2009-11-11
  • 微信小程序訪問豆瓣電影api的實(shí)現(xiàn)方法

    微信小程序訪問豆瓣電影api的實(shí)現(xiàn)方法

    這篇文章主要介紹了微信小程序訪問豆瓣電影api的實(shí)現(xiàn)方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2019-03-03
  • 詳解uniapp頁面跳轉(zhuǎn)URL傳參大坑

    詳解uniapp頁面跳轉(zhuǎn)URL傳參大坑

    本文主要介紹了詳解uniapp頁面跳轉(zhuǎn)URL傳參大坑,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • js實(shí)現(xiàn)下一頁頁碼效果

    js實(shí)現(xiàn)下一頁頁碼效果

    本文主要介紹了js實(shí)現(xiàn)下一頁頁碼效果的實(shí)例,具有很好的參考價(jià)值。下面跟著小編一起來看下吧
    2017-03-03
  • Javascript中this關(guān)鍵字指向問題的測(cè)試與詳解

    Javascript中this關(guān)鍵字指向問題的測(cè)試與詳解

    this是Javascript中一個(gè)非常容易理解錯(cuò),進(jìn)而用錯(cuò)的特性。所以下面這篇文章主要給大家介紹了關(guān)于Javascript中this關(guān)鍵字指向問題的相關(guān)資料,文中通過測(cè)試的題目考驗(yàn)大家對(duì)this的熟悉程度,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-08-08

最新評(píng)論