Example 100: Simple Scientific Graph

PesgoScientific Graph Objectintermediate

Simple Scientific Graph

Preview

ProEssentials Pesgo Scientific Graph Object - Simple Scientific Graph
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// Simple example show the basics of a scientific graph object. //
6// Scientific Graph's contain both YData and XData and thus data
7// is not plotted equally spaced as the graph object does.
8
9Pesgo1.PeUserInterface.Cursor.PromptTracking = true;
10Pesgo1.PeUserInterface.Cursor.PromptLocation = CursorPromptLocation.ToolTip;
11Pesgo1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.XYValues;
12
13// Enable Bar Glass Effect //
14Pesgo1.PePlot.Option.BarGlassEffect = true;
15
16// Enable Plotting style gradient and bevel features //
17Pesgo1.PePlot.Option.AreaGradientStyle = PlotGradientStyle.VerticalAscentInverse;
18Pesgo1.PePlot.Option.AreaBevelStyle = BevelStyle.MediumSmooth;
19Pesgo1.PePlot.Option.SplineGradientStyle = PlotGradientStyle.VerticalAscentInverse;
20Pesgo1.PePlot.Option.SplineBevelStyle = SplineBevelStyle.MediumSmooth;
21
22Pesgo1.PePlot.Option.PointGradientStyle = PlotGradientStyle.VerticalAscentInverse;
23Pesgo1.PeColor.PointBorderColor = Color.FromArgb(100, 0, 0, 0);
24Pesgo1.PePlot.Option.LineSymbolThickness = 3;
25Pesgo1.PePlot.Option.AreaBorder = 1;
26
27// Prepare images in memory //
28Pesgo1.PeConfigure.PrepareImages = true;
29
30// Pass Data //
31Pesgo1.PeData.Subsets = 4;
32Pesgo1.PeData.Points = 120;
33
34for (int s = 0; s <= 3; s++)
35{
36 int nOffset = (int)(Rand_Num.NextDouble() * 250);
37 for (int p = 0; p <= 119; p++)
38 {
39 Pesgo1.PeData.X[s, p] = (float)((p + 1) * 100.0F);
40 Pesgo1.PeData.Y[s, p] = (float)((p + 1) * 1 + (Rand_Num.NextDouble() * 250)) + (float)(Math.Sin(((double)(nOffset + p)) * .03F) * 700.0F) - ((s * 140.0F));
41 }
42}
43
44// Set DataShadows to show 3D //
45Pesgo1.PePlot.DataShadows = DataShadows.Shadows;
46
47Pesgo1.PeUserInterface.Allow.FocalRect = false;
48Pesgo1.PePlot.Method = SGraphPlottingMethod.PointsPlusSpline;
49Pesgo1.PeGrid.LineControl = GridLineControl.Both;
50Pesgo1.PeGrid.Style = GridStyle.Dot;
51Pesgo1.PeUserInterface.Allow.Zooming = AllowZooming.HorzAndVert;
52Pesgo1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not;
53
54// Enable middle mouse dragging //
55Pesgo1.PeUserInterface.Scrollbar.MouseDraggingX = true;
56Pesgo1.PeUserInterface.Scrollbar.MouseDraggingY = true;
57
58Pesgo1.PeString.MainTitle = "Test Results";
59Pesgo1.PeString.SubTitle = "";
60Pesgo1.PeString.YAxisLabel = "Performance";
61Pesgo1.PeString.XAxisLabel = "Duration";
62
63// subset labels //
64Pesgo1.PeString.SubsetLabels[0] = "Horsepower";
65Pesgo1.PeString.SubsetLabels[1] = "Torque";
66Pesgo1.PeString.SubsetLabels[2] = "Temperature";
67Pesgo1.PeString.SubsetLabels[3] = "Pressure";
68
69// subset colors //
70Pesgo1.PeColor.SubsetColors[0] = MainWindow.DemoColors[0];
71Pesgo1.PeColor.SubsetColors[1] = MainWindow.DemoColors[1];
72Pesgo1.PeColor.SubsetColors[2] = MainWindow.DemoColors[2];
73Pesgo1.PeColor.SubsetColors[3] = MainWindow.DemoColors[3];
74
75// subset line types
76Pesgo1.PeLegend.SubsetLineTypes[0] = LineType.MediumSolid;
77Pesgo1.PeLegend.SubsetLineTypes[1] = LineType.MediumSolid;
78Pesgo1.PeLegend.SubsetLineTypes[2] = LineType.MediumSolid;
79Pesgo1.PeLegend.SubsetLineTypes[3] = LineType.MediumSolid;
80
81// subset point types
82Pesgo1.PeLegend.SubsetPointTypes[0] = PointType.DotSolid;
83Pesgo1.PeLegend.SubsetPointTypes[1] = PointType.UpTriangleSolid;
84Pesgo1.PeLegend.SubsetPointTypes[2] = PointType.SquareSolid;
85Pesgo1.PeLegend.SubsetPointTypes[3] = PointType.DownTriangleSolid;
86Pesgo1.PeLegend.SubsetPointTypes[4] = PointType.DotSolid;
87Pesgo1.PeLegend.SubsetPointTypes[5] = PointType.SquareSolid;
88Pesgo1.PeLegend.SubsetPointTypes[6] = PointType.DiamondSolid;
89Pesgo1.PeLegend.SubsetPointTypes[7] = PointType.UpTriangleSolid;
90
91Pesgo1.PeLegend.SimplePoint = true;
92Pesgo1.PeLegend.SimpleLine = true;
93Pesgo1.PeLegend.Style = LegendStyle.OneLine;
94Pesgo1.PeGrid.Option.MultiAxisStyle = MultiAxisStyle.SeparateAxes;
95
96Pesgo1.PePlot.Option.GradientBars = 8;
97Pesgo1.PeConfigure.TextShadows = TextShadows.BoldText;
98Pesgo1.PeFont.MainTitle.Bold = true;
99Pesgo1.PeFont.SubTitle.Bold = true;
100Pesgo1.PeFont.Label.Bold = true;
101Pesgo1.PePlot.Option.LineShadows = true;
102Pesgo1.PeFont.FontSize = FontSize.Large;
103Pesgo1.PeUserInterface.Scrollbar.ScrollingHorzZoom = true;
104Pesgo1.PeData.Precision = DataPrecision.OneDecimal;
105
106// Various other features //
107Pesgo1.PeFont.Fixed = true;
108Pesgo1.PeColor.BitmapGradientMode = false;
109Pesgo1.PeColor.QuickStyle = QuickStyle.DarkNoBorder;
110
111Pesgo1.PeGrid.Configure.AutoMinMaxPadding = 1;
112
113Pesgo1.PeConfigure.ImageAdjustLeft = 20;
114Pesgo1.PeConfigure.ImageAdjustRight = 20;
115Pesgo1.PeConfigure.ImageAdjustTop = 10;
116
117// Set various export defaults //
118Pesgo1.PeSpecial.DpiX = 600;
119Pesgo1.PeSpecial.DpiY = 600;
120
121// default export setting //
122Pesgo1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel;
123Pesgo1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png;
124Pesgo1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard;
125Pesgo1.PeUserInterface.Dialog.ExportUnitXDef = "1280";
126Pesgo1.PeUserInterface.Dialog.ExportUnitYDef = "768";
127Pesgo1.PeUserInterface.Dialog.ExportImageDpi = 300;
128
129Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;
130Pesgo1.PeConfigure.AntiAliasGraphics = true;
131Pesgo1.PeConfigure.AntiAliasText = true;
132
133// Generally call ReinitializeResetImage at end **'
134Pesgo1.PeFunction.ReinitializeResetImage();
135Pesgo1.Invalidate();
136// Optionally call Pego1.Refresh() if you are not seeing changes immediately
Tip: Uses property syntax like Pego1.PeData.Y[s, p]Click underlined properties to view documentation