以下代码粗体部份提示错误:从字符串“ 型号 = 'ERJIXIAN' And 销售员 = '高”到类型“Boolean”的转换无效,恳请指教。代码如下:
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries
'定义一个图系变量
Dim tbl As DataTable =
DataTables("销售") '定义一个变量tbl引用数据表
Dim lst As List(Of String) =
tbl.GetValues("销售员") '获得销售员集合
Dim lst2 As List(Of String) =
tbl.GetValues("型号") '获得型号集合
Chart =
e.Form.Controls("Chart2") ' 引用窗口中的图表
Chart.ChartType =
ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.SeriesList.Clear() '清除图表原来的图系
For r2 As Integer = 0 To
lst.Count - 1
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = lst(r2) '设置图系的标题
Series.Length = lst2.Count '设置图系的长度
For r As Integer = 0 To lst2.Count - 1
Series.X(r) = r
Dim filter=" 型号 = '" & lst2(r) & "' And 销售员 =
'" & lst(r2) & "'"
If filter=True Then
Series.Y(r) =
tbl.Compute("Sum(毛利)",filter ) '指定垂直坐标
Else
Series.Y(r) = 0
End If
Next
Next
For r As Integer = 0 To
lst2.Count - 1
Chart.AxisX.SetValueLabel(r, lst2(r)) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True
'启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
[此贴子已经被作者于2017/10/29 22:22:36编辑过]