您的位置:首页 > Web前端 > CSS

MSChart<2> 柱状图绘制及其样式

2011-12-12 15:37 197 查看
微软Chart控件的安装及其使用,参考:微软图表控件MsChart使用初探,这篇文章写得相当详细,入门使用全是她的功劳~

以下,是分享的一个柱状图的好看的样式, 先预览一下:

HTML

<asp:Chart ID="Chart2" runat="server" BorderlineDashStyle="Solid" BorderlineColor="Gray" Width="768px" BackGradientStyle="DiagonalLeft" BackSecondaryColor="AliceBlue"
BackColor="WhiteSmoke">
<Legends>
<asp:Legend Name="ExpLgd" BackColor="Transparent" Docking="Top"></asp:Legend>
</Legends>
<Series>
<asp:Series Name="Series1" IsValueShownAsLabel="true" Color="#0066FF" CustomProperties="DrawingStyle=Cylinder, MinPixelPointWidth=20, MaxPixelPointWidth=35, PointWidth=0.3"
IsXValueIndexed="False" ShadowOffset="1" Legend="ExpLgd" ChartArea="ChartArea1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BackColor="WhiteSmoke" BackSecondaryColor="Silver"
BackGradientStyle="DiagonalLeft" ShadowOffset="2">
<AxisY>
<MajorGrid LineColor="LightSlateGray" LineDashStyle="Dash" />
</AxisY>
<AxisX>
<MajorGrid Enabled="False" />
<LabelStyle Font="Microsoft Sans Serif, 8pt" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>


后台代码: 绑定Chart

private void BindScoreTrend()
{
Report1BLL reportBLL = new Report1BLL();
DataTable dt = null;
dt = reportBLL.GetScoreTrend(testID);

Chart2.Series["Series1"].Points.DataBind(dt.DefaultView, "SWVersion", "TotalScore", "LegendText=SWVersion,YValues=TotalScore,ToolTip=TotalScore");
Chart2.Series["Series1"].ChartType = SeriesChartType.Column;
Chart2.Series["Series1"].Name = " Total Score";  //ddlActivity.SelectedItem.Text;
Chart2.DataBind();
}


另外还有线性图,饼状图,和雷达图,都是最初步的应用,一次项目的总结。如果你也遇到这个问题,请参考。

大牛们,如果你们看到有什么错误,还望不吝赐教。

谢谢~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: