-- 作者:有点甜
-- 发布时间:2019/2/25 11:46:00
--
如
Dim Chart As WinForm.Chart Chart= Forms("窗口1").Controls("Chart1") Chart.SeriesList.Clear Chart.AxisX.ClearValueLabel Chart.AxisY.ClearValueLabel Chart.ChartType = ChartTypeEnum.Gantt \'图表类型为甘特图 Chart.Inverted = True \'对调X轴和Y轴位置 Chart.AxisY.DateType= True \'Y轴为日期型 Chart.AxisY.AnnoFormatString = "MM-dd" \'设置Y轴的标示格式 Chart.AxisY.MinDate = #01/01/2010# \'设置Y轴的起始日期 Chart.AxisY.MaxDate = #04/30/2010# \'设置Y轴的终止日期 Chart.AxisX.GridMajorVisible = False \'隐藏X轴的网格线 With Chart.SeriesList .AddGanttSeries("任务一", #1/1/2010#, #3/9/2010#) .AddGanttSeries("任务二", #1/23/2010#, #2/14/2010#) .AddGanttSeries("任务三", #1/21/2010#, #2/24/2010#) .AddGanttSeries("任务四", New DateTime() {#1/22/2010#, #2/28/2010#}, New DateTime() {#2/12/2010#, #3/24/2010#}) .AddGanttSeries("任务五", New DateTime() {#2/13/2010#, #3/8/2010#}, New DateTime() {#3/5/2010#, #3/31/2010#}) .AddGanttSeries("任务六", #3/15/2010#, #4/20/2010#) .AddGanttSeries("任务七", #4/6/2010#, #4/30/2010#) .AddGanttLabels("M月d日") End With
|