摘要:Microsoft Chart Controls codeing
微軟送大禮囉 好用的圖表程式 免費開放
但是 範例沒有 重頭到尾都是用codeing 的方式產生
來練習一下 但是 title 沒有搞定
如果有高手 有更好的範例 希望一起放上來
一開始要加上
html 的部分 就是
<asp:PlaceHolder ID="ichart" runat ="server" />
using System.Web.UI.DataVisualization.Charting;
Chart test = new Chart() ;

double[] yValues = {20,10,25,20};
//<asp:CHART id="Chart1" runat="server" Width="412px" Height="296px"
//ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" Palette="BrightPastel"
//BackColor="#F3DFC1" BorderColor="181, 64, 1" BorderDashStyle="Solid"
//BackGradientStyle="TopBottom" BorderWidth="2">
test.ImageType = ChartImageType.Png;
test.Width = 412;
test.Height = 296;
test.Palette = ChartColorPalette.Fire ;
test.BackColor = System.Drawing.Color.Pink ;
test.BorderColor = System.Drawing.Color.Gray;
//背景底圖的特效
test.BackGradientStyle = GradientStyle.Center ;
test.BorderWidth = 2;
//<borderskin skinstyle="Emboss"></borderskin>
//整張圖的特效 崁入 或是 陰影
test.BorderSkin.SkinStyle = BorderSkinStyle.Sunken;
//title 失敗中
//test.Titles.Add("tt");
//test.Titles["tt"].ShadowColor = System.Drawing.Color.Gray;
//test.Titles["tt"].ShadowOffset = 3;
//<series>
//<asp:Series MarkerBorderColor="64, 64, 64" MarkerSize="9" Name="Series1" ChartType="Radar"
//BorderColor="180, 26, 59, 105" Color="220, 65, 140, 240" ShadowOffset="1"></asp:Series>
//</series>
test.Series.Add("中文");
test.Series["中文"].Points.DataBindXY(xValues, yValues);
test.Series["中文"].MarkerBorderColor = System.Drawing .Color .Gray ;
test.Series["中文"].MarkerSize = 9;
test.Series["中文"].BorderColor = Color.Empty;
//test.Series["中文"].BorderColor = System.Drawing.Color.Gray;
test.Series["中文"].BorderWidth = 2;
test.Series["中文"].ShadowOffset = 1;
test.Series["中文"].ChartType = SeriesChartType.Radar;
test.Series["中文"]["RadarDrawingStyle"] = "line";
test.Series["中文"].Color = Color.FromArgb(200, 1, 100);
test.Series["中文"]["AreaDrawingStyle"] = "Polygon";
//<legends>
//<asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent"
//Font="Trebuchet MS, 8.25pt, style=Bold" Alignment="Far">
//<position y="74.08253" height="14.23021" width="19.34047" x="74.73474"></position>
//</asp:Legend>
//</legends>
//標示線形的小圖 ---國文 ----英文
//test.Legends.Add("aa");
//test.Legends["aa"].Position.X = 80;
//test.Legends["aa"].Position.Y = 70;
//test.Legends["aa"].Position.Width = 10;
//test.Legends["aa"].Position.Height = 10;
test.ChartAreas.Add("ChartArea1");
//裡面的圖
//<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="White"
//BackColor="OldLace" ShadowColor="Transparent">
test.ChartAreas["ChartArea1"].BorderColor = System.Drawing.Color.Silver ;
test.ChartAreas["ChartArea1"].BackSecondaryColor = System.Drawing.Color.White;
test.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.OldLace;
test.ChartAreas["ChartArea1"].ShadowColor = System.Drawing.Color.Transparent;
test.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor = System.Drawing.Color.Silver;
test.ChartAreas["ChartArea1"].AxisX.LineColor = System.Drawing.Color.Silver;
test.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver;
test.ChartAreas["ChartArea1"].AxisY.LineColor = System.Drawing.Color.Silver;
test.ChartAreas["ChartArea1"].AxisY.MinorTickMark.Size = 1;
test.ChartAreas["ChartArea1"].AxisY.Minimum = 0;
test.ChartAreas["ChartArea1"].AxisY.Maximum = 25;
test.ChartAreas["ChartArea1"].Position.X = 5;
test.ChartAreas["ChartArea1"].Position.Y = 15;
//Position.Width and Height 範圍是 0-100
test.ChartAreas["ChartArea1"].Position.Width = 88;
test.ChartAreas["ChartArea1"].Position.Height = 95;
//<area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False"
//wallwidth="0" IsClustered="False" />
test.ChartAreas["ChartArea1"].Area3DStyle.Rotation = 10;
test.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 15;
test.ChartAreas["ChartArea1"].Area3DStyle.IsRightAngleAxes = false;
test.ChartAreas["ChartArea1"].Area3DStyle.WallWidth = 0;
test.ChartAreas["ChartArea1"].Area3DStyle.IsClustered = false;
ichart.Controls.Add(test);
double[] yValues =
string[] xValues =