VARCHART XGantt系列教程:如何用值来标记曲线
时间: 2018-12-13来源:OSCHINA
前景提要
「深度学习福利」大神带你进阶工程师,立即查看>>>
VARCHART XGantt 是一款功能强大的 甘特图控件 。其模块化的设计让您可以创建满足您和您的客户所需求的应用程序(我们领先的甘特图控件 VARCHART XGantt 可用于.NET,ActiveX和ASP.NET应用程序)。 VARCHART XGantt 可以快速、简单地集成到您的应用程序中,帮助您识别性能瓶颈、避免延迟以及高效利用资源,使复杂数据变得更加容易理解。

如果您使用 Gantt Charts 来进行资源控制,那么您通常会对当前情况有一个清晰和精确的概述感兴趣。特别是在某些事情似乎不怎么明了的情况下,您需要立即看到问题。介于此本文旨在讲述如何使用值来标记曲线,供大家学习讨论。
详细的规划不仅需要用 直方图 来表示资源,而且还需要显示 资源利用率 的准确值,以便能够快速识别资源瓶颈。
使用的一个生动的例子是精确控制机器部件数量的生产计划,由于一个或多个直方图的高度复杂性,这些直方图具有许多值的堆叠曲线,在许多情况下会导致空间不足,从而妨碍标签的可读性,因此不能在其中标记曲线。如果应用程序中只显示少量且很少更改的值,从而在x方向上为标签留出足够的空间,则可以通过放置在直方图下方的第二个 VARCHART XGantt 实例获得曲线标签。
在我们的示例中,甘特图是由 VARCHART XGantt ActiveX创建的。机器的容量由部件的数量来衡量,与计划的部件数量一起显示(第一个数字一般表示利用率,第二个数字表示资源的最大可用性):
【直方图中生产计划显示利用率】
直方图显示了资源调度器在8点时计算出的20个片和9点时计算出的10个片的分布,因此,9点10件的可用容量很容易识别。
需要注意以下四点: 必须禁用上部XGantt的水平滚动条,以使两个XGantt实体看起来像一个图。 缩放系数、表宽、水平滚动偏移量和图的单位宽度的设置必须相同。 XGantt在设计时要定位数字,需要在第二步中创建一个用于包含标签的层。 在运行时,每个标签创建一个组和一个节点,标签被放置在要标记的曲线的那个周期。
当组布局切换到 “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系列教程将在后续更新,敬请关注~
查看文章转载原文请点击 这里 。

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行