-- 作者:xiaohuli
-- 发布时间:2015/8/17 20:42:00
--
老师,还有一个绘制甘特图的问题,表中有一下字段,销售编号,产品名称,计划销售数量,实际销售数量,开始日期,结束日期等字段,我想通过实际销售数量/计划销售数量来绘制甘特图,这个该怎么绘制?下面的代码应该如何改?
If DrawGannt Then Dim r As Row = Tables("销售进度_Table1").Rows(e.Row.Index) Dim dt1 As Date = r("开始日期") Dim dt2 As Date = r("结束日期") Dim dt As Date = e.Col.Name.Replace("年","-").Replace("月_","-") If dt>=dt1 AndAlso dt<=dt2 Then e.StartDraw() If dt < Date.Today Then e.Graphics.FillRectangle(Brushes.Green,e.x ,e.y + 5, e.Width, e.Height - 10) Else e.Graphics.FillRectangle(Brushes.Red,e.x ,e.y + 3, e.Width, e.Height - 7) End If If r.IsNull("计划销售数量") = False Then Dim day As Double = r("实际销售数量") / r("计划销售数量") Output.Show(day) If dt <= dt1.AddHours(24 * day) Then Dim d As Integer = math.Floor(day) If (dt-dt1).Days < d Then \'满格 e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, e.Width, e.Height - 16) Else Dim width As Integer = (day - d) * e.width e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, width, e.Height - 16) End If End If End If e.EndDraw() End If End If \' \' \' \'
|
-- 作者:大红袍
-- 发布时间:2015/8/17 21:05:00
--
If r.IsNull("计划销售数量") = False Then Dim day As Integer = r("实际销售数量") / r("计划销售数量") * (dt2-dt1).TotalDays Dim dt3 As Date = dt1.AddDays(day) If dt <= dt3 Then e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, e.Width, e.Height - 16) End If End If
|