asp.net 怎么使用web chart的控件
1个回答
展开全部
在ASP.NET中引用WebChart控件
使用WebControl创建图表, 支持渲染图片类型为(png, jpg, gif, etc). 控件支持:
Line Charts
Smooth Line Charts
Column Charts
Area Charts
Scattered Charts
Stacked Column Charts
Pie Charts
Stacked Area Charts
使用方法如下:
下载后将Webchar.dll复制到项目bin目录中,并添加到工具箱中,控件名称为ChartControl。
将控件添加页面,下面是我项目中使用柱形图的例子:
this.vehicle = (Vehicle)Session["vehicle"];
DataTable table = vService.GetVehicleCountByType(tableName, vehicle);
ChartPointCollection chart = new
ChartPointCollection();
Chart c = new StackedColumnChart(chart,
Color.White);
//填充
chart = c.Data;
c.Fill.Color =
Color.Red;
c.Fill.Type = InteriorType.Solid;
c.Shadow.Color = Color.Red;
//显示数字
c.DataLabels.Visible = true;
ColumnChart column = new
ColumnChart(chart, Color.Red);
column.MaxColumnWidth =
20;
column.DataSource = table.DefaultView;
column.DataXValueField = "vinfo5";
column.DataYValueField =
"vinfo5Count";
column.DataLabels.Visible = true;
column.Fill.Color = Color.Red;
column.DataBind();
this.ChartControl1.Charts.Add(column);
this.ChartControl1.XTitle.Text = "车辆类型";
this.ChartControl1.YTitle.Text = "数量";
this.ChartControl1.ChartTitle.Text = this.Page.Title + "统计图";
this.ChartControl1.BorderStyle = BorderStyle.None;
this.ChartControl1.RedrawChart();
使用WebControl创建图表, 支持渲染图片类型为(png, jpg, gif, etc). 控件支持:
Line Charts
Smooth Line Charts
Column Charts
Area Charts
Scattered Charts
Stacked Column Charts
Pie Charts
Stacked Area Charts
使用方法如下:
下载后将Webchar.dll复制到项目bin目录中,并添加到工具箱中,控件名称为ChartControl。
将控件添加页面,下面是我项目中使用柱形图的例子:
this.vehicle = (Vehicle)Session["vehicle"];
DataTable table = vService.GetVehicleCountByType(tableName, vehicle);
ChartPointCollection chart = new
ChartPointCollection();
Chart c = new StackedColumnChart(chart,
Color.White);
//填充
chart = c.Data;
c.Fill.Color =
Color.Red;
c.Fill.Type = InteriorType.Solid;
c.Shadow.Color = Color.Red;
//显示数字
c.DataLabels.Visible = true;
ColumnChart column = new
ColumnChart(chart, Color.Red);
column.MaxColumnWidth =
20;
column.DataSource = table.DefaultView;
column.DataXValueField = "vinfo5";
column.DataYValueField =
"vinfo5Count";
column.DataLabels.Visible = true;
column.Fill.Color = Color.Red;
column.DataBind();
this.ChartControl1.Charts.Add(column);
this.ChartControl1.XTitle.Text = "车辆类型";
this.ChartControl1.YTitle.Text = "数量";
this.ChartControl1.ChartTitle.Text = this.Page.Title + "统计图";
this.ChartControl1.BorderStyle = BorderStyle.None;
this.ChartControl1.RedrawChart();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询