C# 3D Charting

文章标题:C# 3D Charting
原 作 者:Vincent DUVERNET (No
原 出 处:CodeProject
发 布 者:loose_went
发布类型:翻译
发布日期:2005-10-18
今日浏览:7
总 浏 览:1056
下载代码:

介绍

  首先我要感谢CodeProject提供这么好的例子,还特别感谢代码的作者提供用户定制面板。

背景

如果你知道EBP products,你也许会记得它主界面上那很酷的3D等距图表。现在就让我们来实现它。所有代码均在Microsoft FxCop 1.32下验证过。

写这篇文章有点吃力,不象用法语写那么容易,英文不太好,呵呵。

使用代码

  代码最能说明问题,让我们来看一下:

// Object declaration

Nolme.WinForms.Chart m_chartSample1;
         
         

       
       
        
         
       
       
// Create object
           
           
this.m_chartSample1 = new Nolme.WinForms.Chart(this.components);
         
         
this.m_chartSample1.BackColor = System.Drawing.Color.Silver;
         
         
this.m_chartSample1.BottomMargin = 20;
         
         
this.m_chartSample1.ColumnFont = new System.Drawing.Font("Arial", 8F, 
         
         
                                     System.Drawing.FontStyle.Italic);
         
         
this.m_chartSample1.ColumnTitleFont = new System.Drawing.Font("Arial", 
         
         
                             10F, System.Drawing.FontStyle.Underline);
         
         
this.m_chartSample1.Curvature = 15;
         
         
this.m_chartSample1.DeltaDepth = 10;
         
         
this.m_chartSample1.DisplayHiddenSides = true;
         
         
this.m_chartSample1.DisplayTextOnColumns = true;
         
         
this.m_chartSample1.GradientMode = 
         
         
     System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal;
         
         
this.m_chartSample1.LeftMargin = 50;
         
         
this.m_chartSample1.LegendFont = new System.Drawing.Font("Arial", 
         
         
                                 11F, System.Drawing.FontStyle.Bold);
         
         
this.m_chartSample1.Location = new System.Drawing.Point(8, 8);
         
         
this.m_chartSample1.MainTitle = "Main title";
         
         
this.m_chartSample1.MainTitleFont = new System.Drawing.Font("Arial", 16F, 
         
         
       ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | 
         
         
         System.Drawing.FontStyle.Underline))));
         
         
this.m_chartSample1.MarginBetweenColumn = 20;
         
         
this.m_chartSample1.Name = "m_chartSample1";
         
         
this.m_chartSample1.RightMargin = 20;
         
         
this.m_chartSample1.Size = new System.Drawing.Size(456, 304);
         
         
this.m_chartSample1.TabIndex = 4;
         
         
this.m_chartSample1.TopMargin = 20;
         
         
this.m_chartSample1.VerticalAxisMaxValue = 10000;
         
         
this.m_chartSample1.VerticalAxisStep = 1000;
         
         

增加一列的代码:

ChartColumn column1 = m_chartSample1.AddColumn (1500, 210, 0, 500);
         
         

在一个新列中,每一个数字代表一个次值,如果你有很多个值,你可以通过一个数组来传递。

你可以象这样来设置列的标题:

column1.Title = "January";
         
         

其它象页边距、主标题等属性也可以更改。

关于图表中的图例,有两种选择,第一,我们可以把图例整合到当前的面板中,第二,再建一个独立的对象。主要的意图是当在同一个页面使用多个图表时,能够提供一个集中在一起的图例。

总而言之,一个Chart( CustomPanel继承而来)包含一个或多个CharColumn。一个ChartLegendCharLegendItem组成。在CharColumn中有跟次值同样多的CharLegendItem

有趣的地方

  我已经使代码尽量简单,以便每个人都能读懂并升级它。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ComponentOne Studio for WinForms 2012 v3 1/5 一共有 5 个压缩文件,请全部下载后解压 ComponentOne Studio WinForms 2012 v3 Smart and Powerful WinForms Controls for Rapid UI Development Over 65 .NET Windows Forms controls, including the ones you can't get anywhere else. ComponentOne Studio® for WinForms controls come packed with smart, code-free designers, endless built-in features, superior flexibility, and the outstanding assurance that these controls will stand the test of time. What's Inside? Chart FlexGrid GanttView Reports Ribbon True DBGrid Why Choose Studio for WinForms? Best Selling Grids in the Market Since 1991 ComponentOne has been offering two award-winning grids for creating Windows Client applications: FlexGrid and True DBGrid. Each is designed to give you the best performance and features for different types of applications. Both grids offer many out-of-the-box features like filtering, hierarchical data-binding, grouping, printing, and exporting to Microsoft Excel without any additional coding required. See a comparison. All-in-one Reporting Solution With a rich object model for generating reports, several UI controls for previewing, and a report designer for creating and designing reports, Reports for WinForms is your all-in-one reporting solution. Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. Mimic Popular Microsoft UIs and Layouts Replicate popular interfaces as seen in Microsoft Office and other programs using Studio for WinForms controls. For example, provide a docking UI similar to Visual Studio using DockingTab, create an appointments calendar similar to Outlook with Scheduler, and deliver a complete Office 2010 menu system using Ribbon. These customizable controls can be easily modified to perfectly fit your application. Advanced Charting Made Easy Chart for WinForms comes packed with all the charting functionality you need. You get over 80 chart types, designers for code-free development, flexible and customizable charting elements, visual effects, end-user interaction, advanced mouse-tracking capabilities, built-in analysis features and more. ComponentOne is also the only vendor to provide real 3D surface and contour charts. Smarter Design-time Technology ComponentOne SmartDesigner® technology allows you to set the components most common properties and features without leaving the design surface. Set up your entire interface using the design-time wizards, property dialogs, smart tags, and context-sensitive toolbars provided by our SmartDesigner technology. 300+ Unique Samples Studio for WinForms stands out from the pack with over 300 unique samples. These samples (C# and VB.NET), which install alongside the controls, show how to do all of the common tasks associated with each control to ease the learning curve.
ComponentOne Studio for WinForms 2012 v3 1/5 一共有 5 个压缩文件,请全部下载后解压 ComponentOne Studio WinForms 2012 v3 Smart and Powerful WinForms Controls for Rapid UI Development Over 65 .NET Windows Forms controls, including the ones you can't get anywhere else. ComponentOne Studio® for WinForms controls come packed with smart, code-free designers, endless built-in features, superior flexibility, and the outstanding assurance that these controls will stand the test of time. What's Inside? Chart FlexGrid GanttView Reports Ribbon True DBGrid Why Choose Studio for WinForms? Best Selling Grids in the Market Since 1991 ComponentOne has been offering two award-winning grids for creating Windows Client applications: FlexGrid and True DBGrid. Each is designed to give you the best performance and features for different types of applications. Both grids offer many out-of-the-box features like filtering, hierarchical data-binding, grouping, printing, and exporting to Microsoft Excel without any additional coding required. See a comparison. All-in-one Reporting Solution With a rich object model for generating reports, several UI controls for previewing, and a report designer for creating and designing reports, Reports for WinForms is your all-in-one reporting solution. Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. Mimic Popular Microsoft UIs and Layouts Replicate popular interfaces as seen in Microsoft Office and other programs using Studio for WinForms controls. For example, provide a docking UI similar to Visual Studio using DockingTab, create an appointments calendar similar to Outlook with Scheduler, and deliver a complete Office 2010 menu system using Ribbon. These customizable controls can be easily modified to perfectly fit your application. Advanced Charting Made Easy Chart for WinForms comes packed with all the charting functionality you need. You get over 80 chart types, designers for code-free development, flexible and customizable charting elements, visual effects, end-user interaction, advanced mouse-tracking capabilities, built-in analysis features and more. ComponentOne is also the only vendor to provide real 3D surface and contour charts. Smarter Design-time Technology ComponentOne SmartDesigner® technology allows you to set the components most common properties and features without leaving the design surface. Set up your entire interface using the design-time wizards, property dialogs, smart tags, and context-sensitive toolbars provided by our SmartDesigner technology. 300+ Unique Samples Studio for WinForms stands out from the pack with over 300 unique samples. These samples (C# and VB.NET), which install alongside the controls, show how to do all of the common tasks associated with each control to ease the learning curve.
ComponentOne Studio for WinForms 2012 v3 1/5 一共有 5 个压缩文件,请全部下载后解压 ComponentOne Studio WinForms 2012 v3 Smart and Powerful WinForms Controls for Rapid UI Development Over 65 .NET Windows Forms controls, including the ones you can't get anywhere else. ComponentOne Studio® for WinForms controls come packed with smart, code-free designers, endless built-in features, superior flexibility, and the outstanding assurance that these controls will stand the test of time. What's Inside? Chart FlexGrid GanttView Reports Ribbon True DBGrid Why Choose Studio for WinForms? Best Selling Grids in the Market Since 1991 ComponentOne has been offering two award-winning grids for creating Windows Client applications: FlexGrid and True DBGrid. Each is designed to give you the best performance and features for different types of applications. Both grids offer many out-of-the-box features like filtering, hierarchical data-binding, grouping, printing, and exporting to Microsoft Excel without any additional coding required. See a comparison. All-in-one Reporting Solution With a rich object model for generating reports, several UI controls for previewing, and a report designer for creating and designing reports, Reports for WinForms is your all-in-one reporting solution. Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. Mimic Popular Microsoft UIs and Layouts Replicate popular interfaces as seen in Microsoft Office and other programs using Studio for WinForms controls. For example, provide a docking UI similar to Visual Studio using DockingTab, create an appointments calendar similar to Outlook with Scheduler, and deliver a complete Office 2010 menu system using Ribbon. These customizable controls can be easily modified to perfectly fit your application. Advanced Charting Made Easy Chart for WinForms comes packed with all the charting functionality you need. You get over 80 chart types, designers for code-free development, flexible and customizable charting elements, visual effects, end-user interaction, advanced mouse-tracking capabilities, built-in analysis features and more. ComponentOne is also the only vendor to provide real 3D surface and contour charts. Smarter Design-time Technology ComponentOne SmartDesigner® technology allows you to set the components most common properties and features without leaving the design surface. Set up your entire interface using the design-time wizards, property dialogs, smart tags, and context-sensitive toolbars provided by our SmartDesigner technology. 300+ Unique Samples Studio for WinForms stands out from the pack with over 300 unique samples. These samples (C# and VB.NET), which install alongside the controls, show how to do all of the common tasks associated with each control to ease the learning curve.
ComponentOne Studio for WinForms 2012 v3 1/5 一共有 5 个压缩文件,请全部下载后解压 Smart and Powerful WinForms Controls for Rapid UI Development Over 65 .NET Windows Forms controls, including the ones you can't get anywhere else. ComponentOne Studio® for WinForms controls come packed with smart, code-free designers, endless built-in features, superior flexibility, and the outstanding assurance that these controls will stand the test of time. What's Inside? Chart FlexGrid GanttView Reports Ribbon True DBGrid Why Choose Studio for WinForms? Best Selling Grids in the Market Since 1991 ComponentOne has been offering two award-winning grids for creating Windows Client applications: FlexGrid and True DBGrid. Each is designed to give you the best performance and features for different types of applications. Both grids offer many out-of-the-box features like filtering, hierarchical data-binding, grouping, printing, and exporting to Microsoft Excel without any additional coding required. See a comparison. All-in-one Reporting Solution With a rich object model for generating reports, several UI controls for previewing, and a report designer for creating and designing reports, Reports for WinForms is your all-in-one reporting solution. Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. Mimic Popular Microsoft UIs and Layouts Replicate popular interfaces as seen in Microsoft Office and other programs using Studio for WinForms controls. For example, provide a docking UI similar to Visual Studio using DockingTab, create an appointments calendar similar to Outlook with Scheduler, and deliver a complete Office 2010 menu system using Ribbon. These customizable controls can be easily modified to perfectly fit your application. Advanced Charting Made Easy Chart for WinForms comes packed with all the charting functionality you need. You get over 80 chart types, designers for code-free development, flexible and customizable charting elements, visual effects, end-user interaction, advanced mouse-tracking capabilities, built-in analysis features and more. ComponentOne is also the only vendor to provide real 3D surface and contour charts. Smarter Design-time Technology ComponentOne SmartDesigner® technology allows you to set the components most common properties and features without leaving the design surface. Set up your entire interface using the design-time wizards, property dialogs, smart tags, and context-sensitive toolbars provided by our SmartDesigner technology. 300+ Unique Samples Studio for WinForms stands out from the pack with over 300 unique samples. These samples (C# and VB.NET), which install alongside the controls, show how to do all of the common tasks associated with each control to ease the learning curve.

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值