微软Chart控件的安装及其使用,参考:微软图表控件MsChart使用初探,这篇文章写得相当详细,入门使用全是她的功劳~
以下,是分享的一个柱状图的好看的样式, 先预览一下:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <asp:Chart ID="Chart2" runat="server" BorderlineDashStyle="Solid" BorderlineColor="Gray" Width="768px" BackGradientStyle="DiagonalLeft" BackSecondaryColor="AliceBlue"
2 BackColor="WhiteSmoke">
3 <Legends>
4 <asp:Legend Name="ExpLgd" BackColor="Transparent" Docking="Top"></asp:Legend>
5 </Legends>
6 <Series>
7 <asp:Series Name="Series1" IsValueShownAsLabel="true" Color="#0066FF" CustomProperties="DrawingStyle=Cylinder, MinPixelPointWidth=20, MaxPixelPointWidth=35, PointWidth=0.3"
8 IsXValueIndexed="False" ShadowOffset="1" Legend="ExpLgd" ChartArea="ChartArea1">
9 </asp:Series>
10 </Series>
11 <ChartAreas>
12 <asp:ChartArea Name="ChartArea1" BackColor="WhiteSmoke" BackSecondaryColor="Silver"
13 BackGradientStyle="DiagonalLeft" ShadowOffset="2">
14 <AxisY>
15 <MajorGrid LineColor="LightSlateGray" LineDashStyle="Dash" />
16 </AxisY>
17 <AxisX>
18 <MajorGrid Enabled="False" />
19 <LabelStyle Font="Microsoft Sans Serif, 8pt" />
20 </AxisX>
21 </asp:ChartArea>
22 </ChartAreas>
23 </asp:Chart>
后台代码: 绑定Chart
1 private void BindScoreTrend()
2 {
3 Report1BLL reportBLL = new Report1BLL();
4 DataTable dt = null;
5 dt = reportBLL.GetScoreTrend(testID);
6
7 Chart2.Series["Series1"].Points.DataBind(dt.DefaultView, "SWVersion", "TotalScore", "LegendText=SWVersion,YValues=TotalScore,ToolTip=TotalScore");
8 Chart2.Series["Series1"].ChartType = SeriesChartType.Column;
9 Chart2.Series["Series1"].Name = " Total Score"; //ddlActivity.SelectedItem.Text;
10 Chart2.DataBind();
11 }
另外还有线性图,饼状图,和雷达图,都是最初步的应用,一次项目的总结。如果你也遇到这个问题,请参考。
大牛们,如果你们看到有什么错误,还望不吝赐教。
谢谢~