asp.net生成多条折线对比的问题WebChart

tjbus2008 2009-04-22 03:29:27
以下是我的代码:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using C1.Win.C1Chart;
using C1.Web.C1WebChart;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBindOne();
}
public void DataBindOne()
{


//string sqltext1 = "select 线路,sum(公里)as gl,日期 from b where 线路='632'group by 线路,日期";
string sqltext1 = "select 日期,公里,线路 from b where 线路='632' and 日期 between '2009-1-1'and '2009-1-3'order by 日期 compute sum(公里)";
string sqltext2 = "select 日期,公里,线路 from b where 线路='632' and 日期 between '2009-2-1'and '2009-2-3'order by 日期 compute sum(公里)";
SqlConnection con = Dataclass.CreateCon();
SqlDataAdapter sda = new SqlDataAdapter();
SqlDataAdapter sda2 = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand(sqltext1, con);
sda2.SelectCommand = new SqlCommand(sqltext2, con);
DataSet ds = new DataSet();
con.Open();
sda.Fill(ds, "b");
sda2.Fill(ds, "b");
this.C1WebChart1.DataSource = ds.Tables["b"];
this.C1WebChart1.DataBind();
ChartDataSeriesCollection dsc = C1WebChart1.ChartGroups[0].ChartData.SeriesList;
//ChartDataSeriesCollection dsc1 = C1WebChart1.ChartGroups[1].ChartData.SeriesList;
dsc.Clear();
//dsc1.Clear();
ChartDataSeries dsone = dsc.AddNewSeries();
//ChartDataSeries dstwo = dsc1.AddNewSeries();
dsone.X.DataField = "日期";
dsone.Y.DataField = "公里";
dsone = dsc.AddNewSeries();
//dstwo = dsc1.AddNewSeries();
dsone.X.DataField = "日期";
dsone.Y.DataField = "公里";
this.C1WebChart1.Header.Text = "公里";
this.C1WebChart1.Footer.Text = "对比";
C1WebChart1.ChartArea.AxisX.Text = "日期";
C1WebChart1.ChartArea.AxisY.Text = "公里";
C1WebChart1.ChartGroups[0].ChartData.SeriesList[0].Label = "当月";
//C1WebChart1.ChartGroups[1].ChartData.SeriesList[0].Label = "上月";
}

}

数据库表结构为:


这个是以上代码生成的图例:

而我想生成1月份1日,2日,3日和2月份1日,2日,3日的对比图形,望高手帮助小弟解决.不甚感激!
...全文
85 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tjbus2008 2009-04-23
  • 打赏
  • 举报
回复
没有人帮忙吗
蓝海D鱼 2009-04-22
  • 打赏
  • 举报
回复
up
tjbus2008 2009-04-22
  • 打赏
  • 举报
回复
这是我生成的图,不过我是我想要的,我想要的是对比图(而我想生成1月份1日,2日,3日和2月份1日,2日,3日的对比图形)
http://b14.photo.store.qq.com/http_imgload.cgi?/rurl4_b=aa2e8910414cc460923ad6e0b6bc537894fcebe10a14866706af2c9cb4cd9d462e71c1484fa8fdedd4ae08a616b510df6874de1706445b56591672e1005ebc642aad073362669fbe4c9797818498f103886872d1
tjbus2008 2009-04-22
  • 打赏
  • 举报
回复
这个是以上代码生成的图例:

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧