Dundas Chart控件的使用总结

前段时间因为工作需要接触到Dundas Chart 控件,研究了2周时间,大体能实现需要的功能,现在对其做个大体的总结,希望能把自己理解到的地方都能够总结到位,一是方便大家上手,而来也是提高一下自身的学习到总结再到学习的一个循环学习方法吧,再次提高下本人的表达水平,不多说了,进入课题。 

1.首先要拖拽一个Chart控件到设计区,在代码编写区加上引用命名空间using Dundas.Charting.WebControl;
2.每个Chart分为ChartArea区域,Sieres,Legend,Axis几个部分,都可以设置相应的属性,可以在属性编辑框中修改,也可以通过修改代码来实现;
3.绑定数据部分,可以通过Points.DataBindXY(X[],y[]);
代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Dundas.Charting.WebControl;
using System.Drawing;
public partial class TestChart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
     {
         databindXY();
         ControlSet();
        //databindXY();
     }
    private void ControlSet()
     {
        //设置Chart1的相关属性
         Chart1.BackGradientEndColor = Color.White;
         Chart1.BorderLineColor = Color.White;
         Chart1.BorderLineWidth = 0;
         Chart1.BorderSkin.FrameBackColor = Color.MediumTurquoise;
         Chart1.BorderSkin.FrameBackGradientEndColor = Color.Teal;
         Chart1.Palette = ChartColorPalette.SemiTransparent;
         Chart1.Width = 545;
         Chart1.Height = 215;
         Chart1.ImageType = ChartImageType.Jpeg;
         Chart1.AntiAliasing = AntiAliasing.All;
         Chart1.Titles.Add("Default");
         Chart1.Titles[0].Text = "Dundas Chart Demo演示";
         Chart1.Titles[0].Alignment = ContentAlignment.TopCenter;
         Chart1.Titles[0].Font = new Font("黑体", 12, FontStyle.Bold);
         Chart1.Titles[0].Color = Color.FromArgb(72, 72, 72);
        //设置相应Series属性
         Chart1.Series["Default"].Type = SeriesChartType.Line;//设置为折现风格
         Chart1.Series["Default"].BorderColor = Color.White;
         Chart1.Series["Default"].BackGradientType = GradientType.VerticalCenter;
         Chart1.Series["Default"].BackGradientEndColor = Color.Khaki;
         Chart1.Series["Default"].Color = Color.FromArgb(255, 128, 0);//设置折现的颜色
         Chart1.Series["Default"]["PointWidth"] = "0.7";
         Chart1.Series["Default"].BorderStyle = ChartDashStyle.Dash;      
        for(int i =0;i<Chart1.Series["Default"].Points.Count;i++)
         {
             Chart1.Series["Default"].Points[i].MarkerStyle = MarkerStyle.Diamond;//设置折点的风格
             Chart1.Series["Default"].Points[i].MarkerColor = Color.Red;//设置seires中折点的颜色
         }
        //设置相应的Legend
         Chart1.Legends[0].Enabled = true; //设置Legends的为可见
         Chart1.Legends[0].Alignment = StringAlignment.Near ;//设置在上方
         Chart1.Legends[0].Docking = LegendDocking.Right;//设置Legends的位置在右
         Chart1.Legends[0].AutoFitText = true;//自动适应名称的长度,不然会出现..的情况
        //设置X轴
         Chart1.ChartAreas["Default"].AxisX.Title = "时间";
         Chart1.ChartAreas["Default"].AxisX.TitleAlignment = StringAlignment.Far;//设置X轴标题的名称所在位置位远
         Chart1.ChartAreas["Default"].AxisX.Interval = 1;//设置X轴显示间隔为2 ,对于X轴数据比较多的时候比较有用
         Chart1.ChartAreas["Default"].AxisX.Arrows = ArrowsType.Lines;//设置X轴前面家箭头
        //设置Y轴
         Chart1.ChartAreas["Default"].AxisY.Title = "常量";
         Chart1.ChartAreas["Default"].AxisY.TitleAlignment = StringAlignment.Far;//设置Y轴标题的名称所在位置位远
         Chart1.ChartAreas["Default"].AxisY.Arrows = ArrowsType.SharpTriangle;//设置Y轴前面加粗箭头
     }
    private void   databindXY()
     {
        string[] xValues = new string[7]  { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
        double[] yValues = new double[7]  { 50,70,40,30,20,80,10};
         Chart1.Series["Default"].Points.DataBindXY(xValues,yValues);
     }
}

当然了这些属性都可以像设置其它空间一样在属性窗口中进行设置,更多的就不一一实现了,这里主要实现的一些是在项目中用得比较多的,作用比较大一些的实现。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Add advanced charting to your ASP.NET applications. Dundas Chart ASP.NET Enterprise Edition is a fully managed, CLR (Common Language Runtime) compliant charting component designed for ASP.NET development. Included is support for all standard and many advanced chart types, drilldown functionality, full Visual Studio Integrated help, a variety of different image formats and intuitive samples and examples to speed up development time. Graphics take full advantage of GDI+ and the use of transparency, anti-aliasing, gradients and more. Dundas Chart for ASP.NET Enterprise Edition includes many advanced features including: formula support, data grouping, data filtering and advanced chart types. Dundas Chart for .NET is the industry leader in .NET Charting Solutions. Providing you with the most comprehensive features, the most complete sample framework, and the best live technical support available. From start to finish, our team is dedicated to providing what you need to make your project successful. Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced, award-winning technology and advanced results to get the most out of data What’s new in Dundas Chart for ASP.NET? Now supports Visual Studio 2010 What’s new in Dundas Chart V7.1? - V7.1 fixes these issues: AlwaysRecreateHotregions="True" in WinForms templates or templates generated by Chart Builder causes the Exception Can't deserialize property. Unknown property name "AlwaysRecreateHotregions" in object Dundas.Charting.WebControl.Chart" when de-serialized in ASP.NET Chart. This property only exists in the WinForms Chart. The ASP.NET Chart ignores this property by default now. Chart .NET: Stacked Column + 3D throws an Index was out of range exception when series have a different number of data points The accumulation distribution formula is incorrect; if open and close are the same it will divide by zero. A friendlier exception message is th

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值