此主题相关图片如下:qq图片20191126161227.png
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = Forms("进度").Controls("Chart2") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '条形
Chart.DataSource = "进度" '设置绑定表
Chart.AxisY.Min = 0 '指定Y轴的最小值
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加第1个图系
Series.Text = "前期调研报告文件数"
Series.X(0) =Tables("进度").Current("前期调研报告文件数")
Series.Y.DataField = "前期调研报告文件数" 'Y轴绑定到
'Series.DataLabelText = "{#YVAL}"'数据标示
Series.DataLabelCompass = LabelCompassEnum.North '标示显示位置
'Series.FillColor = Color.Lime '图状颜色填充
Series.DataLabelForeColor = Color.White '标示字体白字
Series = Chart.SeriesList.Add() '增加第2个图系
Series.Text = "项目实施计划文件数"
Series.X(1) =Tables("进度").Current("项目实施计划文件数")
Series.Y.DataField = "项目实施计划文件数" 'Y轴绑定到
'Series.DataLabelText = "{#YVAL}"'数据标示
Series.DataLabelCompass = LabelCompassEnum.North '标示显示位置
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.LegendVisible = True '显示图列
Series.FillColor = Color.Red '图状颜色填充
Series.DataLabelForeColor = Color.yellow '标示字体白字
'''''''''
Series = Chart.SeriesList.Add() '增加第3个图系
Series.Text = "资金使用计划文件数"
Series.X(2) =Tables("进度").Current("资金使用计划文件数")
Series.Y.DataField = "资金使用计划文件数" 'Y轴绑定到
'Series.DataLabelText = "{#YVAL}" '数据标示
Series.DataLabelCompass = LabelCompassEnum.North '标示显示位置
Series.FillColor = Color.Blue '图状颜色填充
Series.DataLabelForeColor = Color.White '标示字体白字
'''''''
Series = Chart.SeriesList.Add() '增加第4个图系
Series.Text = "项目宣传推广文件数"
Series.X(3) =Tables("进度").Current("项目宣传推广文件数")
Series.Y.DataField = "项目宣传推广文件数" 'Y轴绑定到
'Series.DataLabelText = "{#YVAL}" '数据标示
Series.DataLabelCompass = LabelCompassEnum.North '标示显示位置
Series.FillColor = Color.yellow '图状颜色填充
Series.DataLabelForeColor = Color.White '标示字体白字
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端
Dim fnt As New Font("微软雅黑",18,FontStyle.Bold) '标题大小和字体
Chart.AxisX.Font = fnt
Chart.Font = new font("微软雅黑",15,FontStyle.Bold) '设置图表字体大小X轴加粗有用(图例和标示字体大小)
'...................面板颜色边框................
Dim b As C1.Win.C1Chart.C1Chart = Forms("进度").Controls("Chart2").BaseControl
b.BackColor = Color.White '图板外颜色White
b.ChartArea.Style.BackColor = Color.White '图板内颜色White
b.ChartArea.Style.Border.BorderStyle = 0 '图板外形框线型
b.ChartArea.Style.GradientStyle = 0 '图板外形框样式
Chart.BackColor = System.Drawing.Color.black '图表本身黑色
Dim ct0l = Chart.BaseControl
ct0l.ChartArea.Style.Opaque = False
ct0l.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None
ct0l.ChartArea.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None
Chart.BarClusterWidth = 80 '图例宽度
Dim gd As C1Chart.C1Chart = Chart.BaseControl
'gd.ChartArea.AxisX.ScrollBar.min =-0.5
'
'gd.ChartArea.AxisX.ScrollBar.Scale = 10 / Tables("月度统计").Rows.count
Chart.ForeColor = Color.Gold '下标题+标示文字颜色+图形框颜色
Chart.AxisX.AnnoWithLabels = True '启用字符标示