mark 甘特图
第二段代码,自己处理一下。
Dim Chart As WinForm.Chart
Chart= Forms("窗口1").Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Gantt '图表类型为甘特图
Chart.Inverted = True '对调X轴和Y轴位置
Chart.AxisY.DateType= True 'Y轴为日期型
Chart.AxisY.AnnoFormatString = "MM-dd" '设置Y轴的标示格式
Chart.AxisY.MinDate = New DateTime(2004, 1, 1)
Chart.AxisY.MaxDate = New DateTime(2004, 4, 30)
Chart.AxisX.GridMajorVisible = False '隐藏X轴的网格线
Dim bchart = chart.BaseControl
Dim cg = bchart.ChartGroups.Group0
Dim cdsc = cg.ChartData.SeriesList
cdsc.Clear()
Dim clc = bchart.ChartLabels.LabelsCollection
Dim cds = cdsc.AddNewSeries()
cds.Label = "任务一"
cds.Y.CopyDataIn(New DateTime() {New DateTime(2004, 1, 1)})
cds.Y1.CopyDataIn(New DateTime() {New DateTime(2004, 3, 9)})
Dim p As Integer
clc.clear
For p = 0 To cds.Length - 1
Dim lab As C1.Win.C1Chart.Label = clc.AddNewLabel()
Dim start As DateTime = CType(cds.Y(p), DateTime)
Dim [End] As DateTime = CType(cds.Y1(p), DateTime)
lab.Text = start.ToString("ddMMM") + "-" + [End].ToString("ddMMM")
lab.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex
lab.AttachMethodData.GroupIndex = 0
lab.AttachMethodData.SeriesIndex = 0
lab.AttachMethodData.PointIndex = p
lab.Compass = LabelCompassEnum.West
lab.Offset = 0
lab.style.forecolor = Color.red
lab.Visible = True
Next