使用Dundas Chart控件制作一个模拟的逼真图

 

使用Dundas Chart 组件开发如上图,以下代码是在VS2003开发环境中运行的。在页面中加一个Dundas Chart 组件,并在Page_Load中调用SetChart1()函数即可(参数在0-10之间赋值)。

调用代码:

private void Page_Load(object sender, System.EventArgs e)
  {
   if(!Page.IsPostBack)
   {    
    SetChart1(1.5,2.5,3,8);
    SetChart2(1.5,8,3);
    SetChart3(4.2,3.8,7,9,9.9);
    SetChart4(10,6.3,2);
   }
  }

各函数:

/// <summary>
  /// 计划管理技能
  /// </summary>
  /// <param name="par1">时间管理</param>
  /// <param name="par2">规划安排</param>
  /// <param name="par3">目标设置</param>
  /// <param name="par4">战略制定</param>
  private void SetChart1(double par1,double par2,double par3,double par4)
  {
   //图的类型、颜色、粗细
   Chart1.Height = Unit.Parse("368px");
   Chart1.Height = Unit.Parse("450px");
   Chart1.Series["Series1"].Type = SeriesChartType.Line;
   Chart1.Series["Series1"].BorderColor = Color.DarkOrange;
   Chart1.Series["Series1"].Color= Color.DarkOrange;
   Chart1.Series["Series1"].BorderWidth = 3;
   Chart1.Series["Series1"].BorderStyle = ChartDashStyle.Solid;
   //出图类型
   Chart1.ImageType = ChartImageType.Jpeg;

   Chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle;
   Chart1.Series["Series1"].MarkerSize = 8;

   //邦定数据
   Chart1.Series["Series1"].Points.AddXY(par1,5);
   Chart1.Series["Series1"].Points.AddXY(par2,25);
   Chart1.Series["Series1"].Points.AddXY(par3,45);
   Chart1.Series["Series1"].Points.AddXY(par4,65);

   //设置Y1值
   Font myFont2 = new Font("楷体",10);
   Chart1.ChartAreas["Default"].AxisY.LabelStyle.Font = myFont2;
   int elementY = Chart1.ChartAreas["Default"].AxisY.CustomLabels.Add(1,10,"时间管理");
   elementY = Chart1.ChartAreas["Default"].AxisY.CustomLabels.Add(20,30,"规划安排");
   elementY = Chart1.ChartAreas["Default"].AxisY.CustomLabels.Add(40,50,"目标设置");
   elementY = Chart1.ChartAreas["Default"].AxisY.CustomLabels.Add(60,70,"战略制定");


   //
   Chart1.ChartAreas["Default"].BackColor = Color.Green;
   Chart1.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false;

   Chart1.ChartAreas["Default"].AxisX.Minimum = 1;
   Chart1.ChartAreas["Default"].AxisX.Maximum = 10;
   Chart1.ChartAreas["Default"].AxisX.Interval = 1;

   // Set Grid lines and tick marks interval  设置虚线及其样式的代码
   Chart1.ChartAreas["Default"].AxisX.MajorGrid.Interval = 3;
   Chart1.ChartAreas["Default"].AxisX.MajorGrid.LineColor = Color.White;
   Chart1.ChartAreas["Default"].AxisX.MajorGrid.LineWidth = 2;
   // Set Line Style
   Chart1.ChartAreas["Default"].AxisX.MajorGrid.LineStyle = ChartDashStyle.Dot;

   Chart1.ChartAreas["Default"].AxisX.LineColor = Color.Black;
   Chart1.ChartAreas["Default"].AxisX.LineWidth = 3;

   Chart1.ChartAreas["Default"].AxisX2.LabelsAutoFit = false;
   Chart1.ChartAreas["Default"].AxisX2.Minimum = 1;
   Chart1.ChartAreas["Default"].AxisX2.Maximum = 10;
   Chart1.ChartAreas["Default"].AxisX2.MajorGrid.LineStyle = ChartDashStyle.NotSet;  //取消X2的竖线
   Font myFont1 = new Font("楷体",10);
   Chart1.ChartAreas["Default"].AxisX2.LabelStyle.Font = myFont1;
   Chart1.ChartAreas["Default"].AxisX2.CustomLabels.Add(2,3,"较低");
   Chart1.ChartAreas["Default"].AxisX2.CustomLabels.Add(5,6,"中等");
   Chart1.ChartAreas["Default"].AxisX2.CustomLabels.Add(8,9,"较高");

   Chart1.ChartAreas["Default"].AxisX2.Enabled = AxisEnabled.True;
   Chart1.ChartAreas["Default"].AxisX2.LineColor = Color.Black;
   Chart1.ChartAreas["Default"].AxisX2.LineWidth = 3;

   Chart1.ChartAreas["Default"].Axis

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值