如图,代码如下,为什么多生成几次图表,Y轴显示的字就看不清楚了“Chart.SeriesList.Clear() ”这行代码没有用吗
With Tables("ftyptop")
Dim q As Integer
此主题相关图片如下:818.png
q = .FindRow("[检测号] = '" & e.Form.Controls("ComboBox1").value & "'") '从第一行开始查找
If q >= 0 Then '如果找到的话
.Position = q '定位到找到的行.
End If
End With
Dim r As Row = Tables("ftyptop").current
'绘图
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("FTYptop") '定义一个变量t引用数据表
Chart = forms("ftyptop").controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
'Chart.DataSource = "FTYptop" '设置绑定表
Chart.ChartType = ChartTypeEnum.Bar
'Chart.AxisY.Min = 0.98 '指定Y轴的最小值
'Chart.AxisY.Max = 1 '指定Y轴的最大值
'Chart.AxisY.Major = 0.002 '主刻度间隔值为
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = T.Cols.count-6 '新增图系包括个数据点
For i As Integer = 0 To T.Cols.count-7 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = r(i+6) '垂直坐标成
Chart.AxisX.SetValueLabel(i, t.cols(i+6).name) '指定字符表示
Next
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Series.DataLabelBackColor = Color.Blue '蓝底
Series.DataLabelForeColor = Color.White '白字
Dim c1Chart1 = Chart.basecontrol
Dim lbls = c1Chart1.ChartLabels
Dim v As Integer = 0
For i As Integer = 0 To T.Cols.count-6
Dim lbl As C1.Win.C1Chart.Label = lbls.LabelsCollection.AddNewLabel()
For Each c As Col In t.Cols
Select Case c.name
Case "检测号","良率","LCD型号V模组型号","入数","NG数","投产单号"
Case Else
v = v + r(c.name)
End Select
Next
If series.y(i) > 0 Then
lbl.Text = Format(series.y(i)/v, "0.0%")
End If
v = 0
lbl.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex
lbl.AttachMethodData.GroupIndex = 0
lbl.AttachMethodData.SeriesIndex = 0
lbl.AttachMethodData.PointIndex = i
lbl.Style.ForeColor = Color.Red
lbl.style.font = new font("仿宋体", 12)
lbl.Compass = LabelCompassEnum.South
lbl.Visible = True
Next