如何使用ProEssentials在WPF平台下创建图表应用程序

作者:控件中国网   出处:控件中国网   2015-09-08 09:27:06   阅读:9

ProEssentials是一款支持多种开发平台的工业、金融类图表控件,支持多种2D和3D图表控件,这篇文章主要介绍如何使用ProEssentials在WPF下创建图表应用程序。

1。首选打开Visual Studio 2010,并且创建一个WPF应用程序,并且在VS工具箱里添加引用Gigasoft.ProEssentialsWpf.dll,当添加完成后,工具箱里会出现 Pe3do, Pego, Pepco, Pepso, Pesgo几个图标

WPF-Chart-VS2010.jpg

2.拖拽pegoWpf到应用程序窗口,并添加下面的代码到<Grid></Grid>标签下

WPF-Name-Loaded.jpg

3.在Pego1_Loaded事件里添加下面的代码

using Gigasoft.ProEssentials.Enums;

Pego1.PeString.MainTitle = "Hello World";

Pego1.PeString.SubTitle = "";

Pego1.PeData.Subsets = 2;

Pego1.PeData.Points = 6;

Pego1.PeData.Y[0, 0] = 10; Pego1.PeData.Y[0, 1] = 30;

Pego1.PeData.Y[0, 2] = 20; Pego1.PeData.Y[0, 3] = 40;

Pego1.PeData.Y[0, 4] = 30; Pego1.PeData.Y[0, 5] = 50;

Pego1.PeData.Y[1, 0] = 15; Pego1.PeData.Y[1, 1] = 63;

Pego1.PeData.Y[1, 2] = 74; Pego1.PeData.Y[1, 3] = 54;

Pego1.PeData.Y[1, 4] = 25; Pego1.PeData.Y[1, 5] = 34;

Pego1.PeString.PointLabels[0] = "Jan";

Pego1.PeString.PointLabels[1] = "Feb";

Pego1.PeString.PointLabels[2] = "Mar";

Pego1.PeString.PointLabels[3] = "Apr";

Pego1.PeString.PointLabels[4] = "May";

Pego1.PeString.PointLabels[5] = "June";

Pego1.PeString.SubsetLabels[0] = "For .Net Framework";

Pego1.PeString.SubsetLabels[1] = "or MFC, ActiveX, VCL";

Pego1.PeString.YAxisLabel = "Simple Quality Rendering";

Pego1.PeColor.SubsetColors[0] = Color.FromArgb(60, 0, 180, 0);

Pego1.PeColor.SubsetColors[1] = Color.FromArgb(180, 0, 0, 130);

Pego1.PeColor.BitmapGradientMode = false;

Pego1.PeColor.QuickStyle = Gigasoft.ProEssentials.Enums.QuickStyle.LightShadow;

Pego1.PeTable.Show = Gigasoft.ProEssentials.Enums.GraphPlusTable.Both;

Pego1.PeData.Precision = Gigasoft.ProEssentials.Enums.DataPrecision.NoDecimals;

Pego1.PeFont.Label.Bold = true;

Pego1.PePlot.Method = Gigasoft.ProEssentials.Enums.GraphPlottingMethod.Bar;

Pego1.PePlot.Option.GradientBars = 8;

Pego1.PePlot.Option.BarGlassEffect = true;

Pego1.PeLegend.Location = Gigasoft.ProEssentials.Enums.LegendLocation.Left;

Pego1.PePlot.DataShadows = Gigasoft.ProEssentials.Enums.DataShadows.ThreeDimensional;

Pego1.PeFont.FontSize = Gigasoft.ProEssentials.Enums.FontSize.Large;

Pego1.PeConfigure.RenderEngine = Gigasoft.ProEssentials.Enums.RenderEngine.Direct2D;

Pego1.PeConfigure.AntiAliasGraphics = true;

Pego1.PeConfigure.AntiAliasText = true;

Pego1.PeUserInterface.HotSpot.Data = true;

Pego1.PeFunction.ReinitializeResetImage();

// Pego1.Invalidate(); // optional help for real-time charts or certain update scenarios. 

// Pego1.UpdateLayout(); // optional help for real-time charts or certain update scenarios. 

4. 运行程序会出现下面的效果

WPFChart-Tutorial.png

Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat