C#中如何将如下数据绑定至MSchart。 用了 chart1.DataBindCrossTable,但一直提示有错。求解! 10
NameYearSalesCommissionsJohn2002$55,676.55$2,699.33Mary2002$44,333.00$2,299.00Andrew2...
Name Year Sales Commissions
John 2002 $55,676.55 $2,699.33
Mary 2002 $44,333.00 $2,299.00
Andrew 2002 $64,455.40 $3,636.00
John 2003 $49,884.00 $2,355.00
Mary 2003 $52,994.00 $2,487.00
John 2004 $62,994.00 $3,593.00
Andrew 2004 $78,993.00 $4,852.00 展开
John 2002 $55,676.55 $2,699.33
Mary 2002 $44,333.00 $2,299.00
Andrew 2002 $64,455.40 $3,636.00
John 2003 $49,884.00 $2,355.00
Mary 2003 $52,994.00 $2,487.00
John 2004 $62,994.00 $3,593.00
Andrew 2004 $78,993.00 $4,852.00 展开
2个回答
展开全部
/// <summary>
/// 绑定图表
/// </summary>
public void BindChart()
{
Chart1.Series.Clear(); //清空chart
Chart1.Legends.Clear();//清空chart
DataTable Tb = GetList(BindSql()).Tables[0];//数据源
Chart1.DataBindCrossTable(
Tb.DefaultView, //数据源
"AreaCode", //以这个字段分组
"GetTime", //这个字段为横坐标
"DataValue", //这个字段为横坐标
"Label=DataValue{C}"//显示具体的DataValue
);
Chart1.Legends.Add("AreaCode");
}
/// 绑定图表
/// </summary>
public void BindChart()
{
Chart1.Series.Clear(); //清空chart
Chart1.Legends.Clear();//清空chart
DataTable Tb = GetList(BindSql()).Tables[0];//数据源
Chart1.DataBindCrossTable(
Tb.DefaultView, //数据源
"AreaCode", //以这个字段分组
"GetTime", //这个字段为横坐标
"DataValue", //这个字段为横坐标
"Label=DataValue{C}"//显示具体的DataValue
);
Chart1.Legends.Add("AreaCode");
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询