关于MSChart的简单学习与使用

欢迎访问:http://121.18.78.216 适易查询分析、工作流、内容管理及项目管理演示平台

Chart Chart1 = new Chart();
Chart1.Width = 612;
Chart1.Height = 296;
Chart1.RenderType = RenderType.ImageTag;

Chart1.Palette = ChartColorPalette.SemiTransparent;
Title t = new Title("No Code Behind Page", Docking.Top, new System.Drawing.Font("宋体", 14, System.Drawing.FontStyle.Strikeout), System.Drawing.Color.FromArgb(Convert.ToInt32("00", 16), Convert.ToInt32("FF", 16), Convert.ToInt32("00", 16)));
Chart1.Titles.Add(t);

Chart1.ChartAreas.Add("Areas 1");
// Show as 3D
Chart1.ChartAreas["Areas 1"].Area3DStyle.Enable3D = false;
// Enable X axis labels automatic fitting
Chart1.ChartAreas["Areas 1"].AxisX.IsLabelAutoFit = true;
Chart1.ChartAreas["Areas 1"].AxisY.LabelStyle.Format = "{0:C}";
// Set X axis automatic fitting style
Chart1.ChartAreas["Areas 1"].AxisX.LabelAutoFitStyle =
LabelAutoFitStyles.DecreaseFont | LabelAutoFitStyles.IncreaseFont | LabelAutoFitStyles.WordWrap;

// create a couple of series
//Chart1.Series.Add("Series 1");
//Chart1.Series["Series 1"].ChartType = SeriesChartType.Column;
//Chart1.Series["Series 1"].ChartArea = "Areas 1";
//Chart1.Series["Series 1"].IsValueShownAsLabel = true;
//Chart1.Series["Series 1"].LabelFormat = "{0:C}";

Draw as 3D Cylinder
//Chart1.Series["Series 1"]["DrawingStyle"] = "Cylinder";


//Chart1.Series.Add("Series 2");
//Chart1.Series["Series 2"].ChartType = SeriesChartType.Line;
//Chart1.Series["Series 2"].ChartArea = "Areas 1";

DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("数学", typeof(int));
dt.Columns.Add("语文", typeof(int));
dt.Rows.Add(new object[] { "jiashiyi", 100, 150 });
dt.Rows.Add(new object[] { "jiazichen", 150, 100 });

Chart1.DataBindTable(dt.DefaultView, "name");
Chart1.Series["数学"].ChartType = SeriesChartType.Line;
//Chart1.Series["Series 1"].Points.DataBindY(myReader, "GrossSales");

// add points to series 1
//Chart1.Series["Series 1"].Points.AddY(5);
//Chart1.Series["Series 1"].Points.AddY(8);
//Chart1.Series["Series 1"].Points.AddY(12);
//Chart1.Series["Series 1"].Points.AddY(6);
//Chart1.Series["Series 1"].Points.AddY(9);
//Chart1.Series["Series 1"].Points.AddY(4);

//Chart1.Series["Series 1"].Points[0].AxisLabel = "jiashiyi";
Chart1.Series["Series 1"].Points[0].Label = "jiashiyi";
add points to series 2
//Chart1.Series["Series 2"].Points.AddY(2);
//Chart1.Series["Series 2"].Points.AddY(6);
//Chart1.Series["Series 2"].Points.AddY(18);
//Chart1.Series["Series 2"].Points.AddY(16);
//Chart1.Series["Series 2"].Points.AddY(21);
//Chart1.Series["Series 2"].Points.AddY(14);

Chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
Chart1.BorderColor = System.Drawing.Color.FromArgb(26, 59, 105);
Chart1.BorderlineDashStyle = ChartDashStyle.Solid;
Chart1.BorderWidth = 2;

Chart1.Legends.Add("Legend1");
//Chart1.Series["Series 1"].Legend = "Legend1";
// show legend based on check box value
Chart1.Legends["Legend1"].Enabled = true;
Chart1.Page = Page;
ph.Controls.Add(Chart1);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值