当前位置: 代码迷 >> ASP.NET >> 求VS2010中Chart控件的用法?该怎么处理
  详细解决方案

求VS2010中Chart控件的用法?该怎么处理

热度:6065   发布时间:2013-02-25 00:00:00.0
求VS2010中Chart控件的用法?
HTML code
 <asp:Chart ID="Chart1" runat="server">            <Series>                <asp:Series Name="Series1">                </asp:Series>            </Series>                        <ChartAreas>                <asp:ChartArea Name="ChartArea1">                </asp:ChartArea>            </ChartAreas>        </asp:Chart>    </div>


城市 3月 4月 5月
上海 500 800 300
武汉 1800 500 1200
北京 600 300 100

在vs2010中,用Chart控件做报表,连接数据库中的数据,如上表中的数据,显示相应的报表,没用过呢,现在有急用,怎么用呢,有谁有例子,提供一下,谢谢了!

------解决方案--------------------------------------------------------
http://jian23523.blog.163.com/blog/static/10896181201133954020/

http://msdn.microsoft.com/zh-cn/library/system.web.ui.datavisualization.charting.chart.aspx
------解决方案--------------------------------------------------------

下载
------解决方案--------------------------------------------------------
前台:
<asp:Chart ID="Chart1" runat="server" BackGradientStyle="TopBottom" 
BackSecondaryColor="LightSteelBlue" BorderlineWidth="0">
<Series>
<asp:Series ChartArea="ChartArea1" CustomProperties="DrawingStyle=Cylinder" 
Legend="Legend1" Name="实际值">
</asp:Series>
<asp:Series CustomProperties="DrawingStyle=Cylinder" Legend="Legend1" 
Name="预测值">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea AlignmentOrientation="Horizontal" BackColor="LightSteelBlue" 
BackGradientStyle="DiagonalRight" Name="ChartArea1">
<Area3DStyle Rotation="0" WallWidth="0" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="Legend1">
</asp:Legend>
</Legends>
</asp:Chart>


后台绑定:
 public void chartbind()
{
Chart1.DataSource = _ComputerSrv.SelectTable("select departments, sum(price)as price,sum(price)+300 as num from parts group by departments having departments='销售部' or departments='财务部'");
Chart1.Series[0].YValueMembers = "num";
Chart1.Series[1].YValueMembers = "price";
Chart1.Series[0].XValueMember = "departments";
Chart1.DataBind();
}
  相关解决方案