多列图??? [英] Multiple Column Chart ???

查看:38
本文介绍了多列图???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

道歉,如果已经在其他地方询问过,但我可以使用一些帮助。

Apologies if this has already been asked elsewhere but I could use some assistance.

我需要显示一个图表,显示沿X轴的周数和生产值。 Y使用列格式图表类型。更具体地说,对于每个数据点,我需要显示与计划生产能力相比的总生产能力,
因此每个星期数字并排两列。

I need to display a chart showing week number along the X axis and production values on the Y using a column format chart type. More specifically, for each data point I need to show the Total Production Capacity compared to the Planned Production Capacity, so two columns side by side for each week number.

我有一个SQL视图设置,它提供了我需要的数据,我认为我所要做的就是添加第二个系列,但它似乎并不重要我做什么,它只为每个数据点渲染一列,我知道事实上,这两个值都有数据。

I have a SQL view set up which gives me the data I need and I thought all I would have to do is add a second series but it doesn't seem to matter what I do, it only ever renders one column per data point and I know for a fact both values have data.

我的代码如下:

       ;      myWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(" / Flexcon_Planning")

            connStr = myWebConfig.ConnectionStrings.ConnectionStrings(" MfgSys803ConnectionString")

            connStrText = connStr.ToString()

            myQuery ="选择TotalCapacity作为[TotalCapacity],sum(ScheduleCapacity)作为[ScheduleCapacity],weeknum作为[Year / Week]来自Flex_plantCapacity  group by Weeknum,TotalCapacity" b $ b            myConnection = New SqlConnection(connStrText)

            myCommand = New SqlCommand(myQuery,myConnection)

            myConnection.Open()

            Dim myReader As SqlDataReader = myCommand.ExecuteReader()

            Chart1.Series(" Series1")。Points.DataBindXY(myReader," Year / Week",myReader,&ScheduleCapacity")

             Chart1.Series(" Series2")。Points.DataBindXY(myReader," Year / Week",myReader," TotalCapacity")

             myReader.Close()

            myConnection.Close()

如果有人能告诉我哪里出错了,我将非常感谢。

If someone can tell me where I'm going wrong I'd appreciate it thanks.

R

 

 

推荐答案

问题是你只能阅读
SqlDataReader
一次,然后用完了。在第一次数据绑定后再次调用 myReader.Close()
myReader.ExecuteReader(),或者将数据读取到其他类型的对象,例如DataSet或DataTable并使用它来绑定数据。

The problem is that you can only read an SqlDataReader once, and then its used up. Either call myReader.Close() and myReader.ExecuteReader() again after the first data bind, or read the data to some other type of object, like a DataSet or a DataTable and use it to bind the data.


这篇关于多列图???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆