还是上面那个例子,我想把材料成本分为实际与标准,间接费用也分为实际与标准,然后分别在两个图中显示,我编写了一段代码,不知道什么原因还是分不开帮我看一下:
Dim Chart As New ChartBuilder
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("成本核算") '定义一个变量t引用数据表
Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.DataSource = "成本核算" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisY.Min = 0 '指定Y轴的最小值
'Chart.AxisY.Max =15000 '指定Y轴的最大值
Chart.PrintWidth = 140 '宽度设为140毫米
Chart.PrintHeight = 100 '高度设为100毫米
Series = Chart.SeriesList.Add()
Series.Text = "标准成本_材料成本" '设置图系的标题
Series.X.DataField = "年月" 'X轴绑定到产品列
Series.Y.DataField = "标准成本_材料成本" '设置Y轴的绑定列
Series.DataLabelText = "{#YVAL}"
Series = Chart.SeriesList.Add()
Series.Text = "实际成本_材料成本" '设置图系的标题
Series.X.DataField = "年月" 'X轴绑定到产品列
Series.Y.DataField = "实际成本_材料成本" '设置Y轴的绑定列
Series.DataLabelText = "{#YVAL}"
Chart.BarClusterWidth = 80
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Dim Chart1 As New ChartBuilder
Dim Series1 As WinForm.ChartSeries '定义一个图系变量
Dim t1 As Table = Tables("成本核算") '定义一个变量t引用数据表
Chart1.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart1.DataSource = "成本核算" '设置绑定表
'Chart1.SeriesList.Clear() '清除图表原来的图系
Chart1.AxisY.Min = 0 '指定Y轴的最小值
'Chart.AxisY.Max =15000 '指定Y轴的最大值
Chart1.PrintWidth = 140 '宽度设为140毫米
Chart1.PrintHeight = 100 '高度设为100毫米
Series1 = Chart.SeriesList.Add()
Series1.Text = "标准成本_间接费用" '设置图系的标题
Series1.X.DataField = "年月" 'X轴绑定到产品列
Series1.Y.DataField = "标准成本_间接费用" '设置Y轴的绑定列
Series1.DataLabelText = "{#YVAL}"
Series1 = Chart.SeriesList.Add()
Series1.Text = "实际成本_间接费用" '设置图系的标题
Series1.X.DataField = "年月" 'X轴绑定到产品列
Series1.Y.DataField = "实际成本_间接费用" '设置Y轴的绑定列
Series1.DataLabelText = "{#YVAL}"
Chart1.BarClusterWidth = 80
Chart1.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart1.LegendVisible = True '显示图列
Chart1.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Dim doc As New PrintDoc
Dim drx As new prt.RenderArea
Dim rm As New prt.RenderImage
Dim rm1 As New prt.RenderImage
rm.Image = Chart.Image
rm1.Image = Chart1.Image
drx.Children.Add(rm)
drx.Children.Add(rm1)
doc.Body.Children.Add(drx)
Doc.Preview()