翻譯|使用教程|編輯:黃竹雯|2018-12-13 12:31:19.000|閱讀 346 次
概述:本文主要介紹VARCHART XGantt系列教程之如何用值來標記曲線,內附效果圖和下載鏈接。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VARCHART XGantt是一款功能強大的甘特圖控件。其模塊化的設計讓您可以創建滿足您和您的客戶所需求的應用程序(我們領先的甘特圖控件VARCHART XGantt可用于.NET,ActiveX和ASP.NET應用程序)。VARCHART XGantt可以快速、簡單地集成到您的應用程序中,幫助您識別性能瓶頸、避免延遲以及高效利用資源,使復雜數據變得更加容易理解。
如果您使用Gantt Charts來進行資源控制,那么您通常會對當前情況有一個清晰和精確的概述感興趣。特別是在某些事情似乎不怎么明了的情況下,您需要立即看到問題。介于此本文旨在講述如何使用值來標記曲線,供大家學習討論。
詳細的規劃不僅需要用直方圖來表示資源,而且還需要顯示資源利用率的準確值,以便能夠快速識別資源瓶頸。
使用的一個生動的例子是精確控制機器部件數量的生產計劃,由于一個或多個直方圖的高度復雜性,這些直方圖具有許多值的堆疊曲線,在許多情況下會導致空間不足,從而妨礙標簽的可讀性,因此不能在其中標記曲線。如果應用程序中只顯示少量且很少更改的值,從而在x方向上為標簽留出足夠的空間,則可以通過放置在直方圖下方的第二個VARCHART XGantt實例獲得曲線標簽。
在我們的示例中,甘特圖是由VARCHART XGantt ActiveX創建的。機器的容量由部件的數量來衡量,與計劃的部件數量一起顯示(第一個數字一般表示利用率,第二個數字表示資源的最大可用性):
直方圖顯示了資源調度器在8點時計算出的20個片和9點時計算出的10個片的分布,因此,9點10件的可用容量很容易識別。
當組布局切換到“All nodes in one row”和“Nodes optimized”時,標簽將在正確的位置繪制。使用以下代碼創建標簽:
Dim currentDate As Date Dim histogram As VcHistogram Dim capacityCurve As VcCurve Dim loadCurve As VcCurve Dim leftDate As Date Dim rightDate As Date Dim leftValue1 As Long Dim leftValue2 As Long Dim rightValue As Long Dim cal As VcCalendar 'Reset second XGantt (only necessary if switching between several curves is possible) VcGantt2.Reset vcRemoveNodes 'Calculate necessary objects Set cal = VcGantt1.CalendarCollection.Active Set histogram = VcGantt1.HistogramCollection.HistogramByName _ (histogramName) Set capacityCurve = histogram.CurveCollection.CurveByName(histogramName) Set loadCurve = histogram.CurveCollection.CurveByName _ ("Load_" + histogramName) 'Create nodes in a loop over the time displayed currentDate = VcGantt1.TimeScaleStart Do While currentDate < VcGantt2.TimeScaleEnd 'Read curves Call capacityCurve.GetValues(d, leftDate, leftValue1, _ rightDate, rightValue) Call loadCurve.GetValues(d, leftDate, leftValue2, _ rightDate, rightValue) 'create node for second XGantt with Node-ID, 2 values, group name = 'histogram name, start and end date VcGantt2.InsertNodeRecord CStr(d) + ";" + _ CStr(leftValue2) + "/" + _ CStr(leftValue2) + "/" + _ histogramName + ";" + _ normDat(d) + ";" + _ normDat(DateAdd("h", 1, d)) 'calculate next start date (at the end of a working day moving forward to 'the beginning of the next working day) currentDate = cal.AddDuration(currentDate, 1) If Hour(currentDate) = 17 Then currentDate = cal.AddDuration(cal.AddDuration(currentDate, 1), -1) End If Loop 'import all nodes to the Gantt diagram VcGantt2.EndLoading 'Perform grouping again VcGantt2.GroupNodes True
更多VARCHART XGantt系列教程將在后續更新,敬請關注~
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn