Example 147: Scientific Graph showing Delaunay Chart

PesgoScientific Graph Objectadvanced

Delaunay Chart

Preview

ProEssentials Pesgo Scientific Graph Object - Scientific Graph showing Delaunay Chart
Click to enlarge

Source Code

Form3.cs
1//! Right button click to show popup menu. //
2//! Double Click to show customization dialog. //
3//! Left-Click and drag to draw zoom box. Use popup memu or 'z' to undo zoom. //
4
5// Delaunay Triangulation works with a single array of points
6Pesgo1.PeData.Subsets = 1;
7Pesgo1.PeData.Points = 70;
8
9int nPointCount = 0;
10
11string[] fileArray = { "", "" };
12try
13{
14 fileArray = File.ReadAllLines("delaunaysample.txt");
15}
16catch
17{
18 System.Windows.Forms.MessageBox.Show("Demo File Not Found?", "Error", System.Windows.Forms.MessageBoxButtons.OK);
19 System.Windows.Forms.Application.Exit();
20}
21
22for (int i = 0; i < fileArray.Length; i++)
23{
24 String line = fileArray[i];
25 if (line.Length < 3) { continue; }
26 var columns = line.Split(' ');
27 String valueX = columns[0];
28 String valueY = columns[1];
29 String valueZ = columns[2];
30
31 float fX = float.Parse(valueX, CultureInfo.InvariantCulture.NumberFormat);
32 float fY = float.Parse(valueY, CultureInfo.InvariantCulture.NumberFormat);
33 float fZ = float.Parse(valueZ, CultureInfo.InvariantCulture.NumberFormat);
34
35 Pesgo1.PeData.X[0, nPointCount] = fX;
36 Pesgo1.PeData.Y[0, nPointCount] = fY;
37 Pesgo1.PeData.Z[0, nPointCount] = fZ;
38
39 Pesgo1.PeAnnotation.Graph.X[nPointCount] = fX;
40 Pesgo1.PeAnnotation.Graph.Y[nPointCount] = fY;
41 Pesgo1.PeAnnotation.Graph.Type[nPointCount] = (int)GraphAnnotationType.SmallDotSolid;
42 Pesgo1.PeAnnotation.Graph.Color[nPointCount] = Color.FromArgb(155, 0, 0, 0); //optional
43 Pesgo1.PeAnnotation.Graph.Text[nPointCount] = String.Format("{0:##0.0}", fZ);
44
45 nPointCount++;
46}
47Pesgo1.PeAnnotation.Graph.X[nPointCount] = 3.75;
48Pesgo1.PeAnnotation.Graph.Y[nPointCount] = .45;
49Pesgo1.PeAnnotation.Graph.Type[nPointCount] = (int)GraphAnnotationType.Pointer;
50Pesgo1.PeAnnotation.Graph.Text[nPointCount] = "Test Spot";
51Pesgo1.PeAnnotation.Graph.Color[nPointCount] = Color.FromArgb(255, 55, 255, 55);
52
53Pesgo1.PeAnnotation.Show = true;
54Pesgo1.PeAnnotation.InFront = true;
55Pesgo1.PeAnnotation.Graph.TextSize = 100;
56Pesgo1.PeAnnotation.Graph.MaxSymbolSize = MinimumPointSize.Medium;
57
58Pesgo1.PeConfigure.ImageAdjustLeft = 100;
59
60Pesgo1.PeString.MainTitle = "Hand Held Sound Meter Readings [dBA]";
61Pesgo1.PeString.SubTitle = "CVHF 1300.31 Impeller Diameter: LTO 40214, DGI=6";
62Pesgo1.PeString.MultiSubTitles[0] = "|Contour of DRS Attribute = [1339]|";
63
64Pesgo1.PeFont.MainTitle.Font = "Arial";
65Pesgo1.PeFont.SubTitle.Font = "Arial";
66
67Pesgo1.PeString.YAxisLabel = "PC";
68Pesgo1.PeString.XAxisLabel = "Q/N";
69
70// to control contour range //
71Pesgo1.PeGrid.Configure.ManualScaleControlZ = ManualScaleControl.MinMax;
72Pesgo1.PeGrid.Configure.ManualMinZ = 80.0F;
73Pesgo1.PeGrid.Configure.ManualMaxZ = 102.0F;
74
75// Create contour colors //
76Pesgo1.PeColor.ContourColors.Clear(6);
77Pesgo1.PeColor.ContourColors[0] = Color.FromArgb(255, 0, 0, 255);
78Pesgo1.PeColor.ContourColors[1] = Color.FromArgb(255, 17, 211, 214);
79Pesgo1.PeColor.ContourColors[2] = Color.FromArgb(255, 0, 255, 0);
80Pesgo1.PeColor.ContourColors[3] = Color.FromArgb(255, 255, 255, 0);
81Pesgo1.PeColor.ContourColors[4] = Color.FromArgb(255, 245, 181, 5);
82Pesgo1.PeColor.ContourColors[5] = Color.FromArgb(255, 255, 0, 0);
83Pesgo1.PeColor.ContourColors[6] = Color.FromArgb(255, 0, 55, 155);
84
85Pesgo1.PeColor.ContourColorBlends = 2;
86Pesgo1.PeColor.ContourColorAlpha = 225;
87Pesgo1.PeColor.ContourColorSet = ContourColorSet.ContourColors;
88
89Pesgo1.PeGrid.Configure.AutoMinMaxPadding = 1;
90Pesgo1.PeGrid.Configure.AutoPadBeyondZeroX = true;
91
92// For when ViewingStyle is monochrome //
93for (int s = 0; s < 30; s++)
94 Pesgo1.PeColor.SubsetShades[s] = Color.FromArgb(255, (byte)(50 + (s * 2)), (byte)(50 + (s * 2)), (byte)(50 + (s * 2)));
95
96// Set Various Other Properties ///
97Pesgo1.PeColor.BitmapGradientMode = true;
98Pesgo1.PeColor.QuickStyle = QuickStyle.MediumNoBorder;
99Pesgo1.PeConfigure.BorderTypes = TABorder.SingleLine;
100
101// Set menu features ///
102Pesgo1.PeUserInterface.Menu.PlotMethod = MenuControl.Hide;
103Pesgo1.PeUserInterface.Menu.DataShadow = MenuControl.Hide;
104Pesgo1.PeUserInterface.Menu.AnnotationControl = true;
105Pesgo1.PeUserInterface.Menu.ShowAnnotationText = MenuControl.Show;
106Pesgo1.PeUserInterface.Menu.ShowAnnotations = MenuControl.Show;
107Pesgo1.PeUserInterface.Menu.MarkDataPoints = MenuControl.Hide;
108Pesgo1.PeUserInterface.Dialog.PlotCustomization = false;
109Pesgo1.PeUserInterface.Dialog.Page2 = false;
110
111// Set the plotting method to Delaunay //
112Pesgo1.PePlot.Method = SGraphPlottingMethod.ContourDelaunay;
113
114Pesgo1.PeLegend.Location = LegendLocation.Right;
115Pesgo1.PeLegend.ContourStyle = true;
116Pesgo1.PeLegend.ContourLegendPrecision = ContourLegendPrecision.ThreeDecimals;
117
118Pesgo1.PeGrid.InFront = true;
119Pesgo1.PeGrid.LineControl = GridLineControl.Both;
120Pesgo1.PeGrid.Style = GridStyle.Dot;
121
122Pesgo1.PeConfigure.PrepareImages = true;
123Pesgo1.PeConfigure.CacheBmp = true;
124
125Pesgo1.PeUserInterface.Scrollbar.ScrollingVertZoom = true;
126Pesgo1.PeUserInterface.Scrollbar.ScrollingHorzZoom = true;
127Pesgo1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not;
128Pesgo1.PeUserInterface.Allow.Zooming = AllowZooming.HorzAndVert;
129Pesgo1.PeUserInterface.Scrollbar.MouseWheelFunction = MouseWheelFunction.HorizontalVerticalZoom;
130Pesgo1.PeUserInterface.Scrollbar.MouseWheelZoomSmoothness = 2;
131Pesgo1.PeUserInterface.Scrollbar.MouseWheelZoomFactor = 1.05F;
132Pesgo1.PeUserInterface.Scrollbar.MouseDraggingX = true;
133Pesgo1.PeUserInterface.Scrollbar.MouseDraggingY = true;
134Pesgo1.PeGrid.GridBands = false;
135
136// Disable other non contour plotting method //
137Pesgo1.PePlot.Allow.ContourLines = false;
138Pesgo1.PePlot.Allow.ContourColors = true;
139Pesgo1.PePlot.Allow.ContourColorsShadows = false;
140Pesgo1.PePlot.Allow.Line = false;
141Pesgo1.PePlot.Allow.Point = false;
142Pesgo1.PePlot.Allow.Bar = false;
143Pesgo1.PePlot.Allow.Area = false;
144Pesgo1.PePlot.Allow.Spline = false;
145Pesgo1.PePlot.Allow.SplineArea = false;
146Pesgo1.PePlot.Allow.PointsPlusLine = false;
147Pesgo1.PePlot.Allow.PointsPlusSpline = false;
148Pesgo1.PePlot.Allow.BestFitCurve = false;
149Pesgo1.PePlot.Allow.BestFitLine = false;
150Pesgo1.PePlot.Allow.Stick = false;
151
152// Set small font size //
153Pesgo1.PeFont.FontSize = FontSize.Large;
154Pesgo1.PeFont.Fixed = true;
155
156// Disable appropriate tabs //
157Pesgo1.PeUserInterface.Dialog.Axis = false;
158Pesgo1.PeUserInterface.Dialog.Style = false;
159Pesgo1.PeUserInterface.Dialog.Subsets = false;
160
161Pesgo1.PeConfigure.TextShadows = TextShadows.BoldText;
162Pesgo1.PeFont.MainTitle.Bold = true;
163Pesgo1.PeFont.SubTitle.Bold = true;
164Pesgo1.PeFont.Label.Bold = true;
165Pesgo1.PeFont.FontSize = FontSize.Medium;
166
167// Set various export defaults //
168Pesgo1.PeSpecial.DpiX = 600;
169Pesgo1.PeSpecial.DpiY = 600;
170
171// default export setting //
172Pesgo1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel;
173Pesgo1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png;
174Pesgo1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard;
175Pesgo1.PeUserInterface.Dialog.ExportUnitXDef = "1280";
176Pesgo1.PeUserInterface.Dialog.ExportUnitYDef = "768";
177Pesgo1.PeUserInterface.Dialog.ExportImageDpi = 300;
178Pesgo1.PeUserInterface.Dialog.AllowEmfExport = false;
179Pesgo1.PeUserInterface.Dialog.AllowWmfExport = false;
180
181Pesgo1.PeUserInterface.HotSpot.Data = false;
182Pesgo1.PeUserInterface.Cursor.PromptTracking = true;
183Pesgo1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.ZValue;
184
185Pesgo1.PeUserInterface.Cursor.TrackingTooltipTitle = "dBA";
186Pesgo1.PeUserInterface.Cursor.PromptLocation = CursorPromptLocation.ToolTip;
187Pesgo1.PeUserInterface.Cursor.TrackingCustomDataText = true; // See PeCustomTrackingDataText event in Form1
188Pesgo1.PeUserInterface.Cursor.Hand = (int)Gigasoft.ProEssentials.Enums.MouseCursorStyles.Arrow;
189Pesgo1.PeUserInterface.Cursor.TrackingTooltipMaxWidth = 300;
190
191Pesgo1.PeConfigure.AntiAliasGraphics = true;
192Pesgo1.PeConfigure.AntiAliasText = true;
193
194Pesgo1.PeConfigure.Composite2D3D = Composite2D3D.Foreground;
195Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct3D;
196
197Pesgo1.PeFunction.Force3dxNewColors = true;
198Pesgo1.PeFunction.Force3dxVerticeRebuild = true;
199
200Pesgo1.PeFunction.ReinitializeResetImage();
201Pesgo1.Invalidate();
Tip: Uses property syntax like Pego1.PeData.Y[s, p]Click underlined properties to view documentation