ion = new SqlConnection ( strConnection) ; salesCommand = new SqlCommand ( strSales , myCon
nection) ; strMonth2 + = ( (int) dataReader1. GetValue (0) ) . T oString () + strSales2 + = ( ( int ) dataReader1. GetValue ( 1 ) + difference ) . T oString () + ’ t’ \ ; ChartSpace chartSpace1 = new ChartSpaceClass () ; / / 在 chartSpace1 绘图空间中新建一个图表 ChChart chart1 = chartSpace1. Charts. Add (0) ; / / 在 chart1 图表中加入两个数据系列 ChSeries chart1Series1 = chart1. SeriesCollection. Add (0) ; ChSeries chart1Series2 = chart1. SeriesCollection. Add (1) ; / / (4) 添加必要的数据系列 ; / / 将数据系列定义成 XY 散点图 ,带连线和数据点标记 chart1Series1. Type ScatterLineMarkers ; chart1Series2. Type ScatterLineMarkers ; = = ChartChartTypeEnum. chChartType2 ChartChartTypeEnum. chChartType2 chDataLiteral , chDataLiteral , chDataLiteral , chDataLiteral ,
/ / 打开数据库连接
myConnection. Open () ;
/ / 获取一月份全国销售量
countryJan = (int) JanSalesCommand. ExecuteScalar () ; / / 从数据库中获取全国销售量信息
dataReader1 = salesCommand. ExecuteReader () ; while ( dataReader1. Read () ) {
/ / 命名数据系列 ( 名称将在图例中显示出来)