# Copyright (c) 2025-2026 Gigasoft, Inc. All rights reserved. // === ProEssentials Base Examples (knowledge rev 4) (000, 100, 200, 300, 400) === // // When a test example says "CreateSimpleGraph(Pego1)" or "CreateSimpleSGraph(Pesgo1)" // etc., these base configurations are ALREADY SET. Only write code that the test // ADDS ON TOP of the base. Understanding what's "already there" prevents confusion // between base features and test-specific features. // RANDOM DATA HELPER (used by AI when generating test data): // Assumes: Random Rand_Num = new Random(); // Pego pattern (4 subsets, 12 points, upward trend, subset-separated): for (int s = 0; s <= 3; s++) for (int p = 0; p < 12; p++) Pego1.PeData.Y[s, p] = ((p + 1) * 50) + ((float)(Rand_Num.NextDouble()) * 250) + 700.0F - (s * 140.0F); // Pesgo pattern (4 subsets, 120 points, sine wave with offset): for (int s = 0; s <= 3; s++) { int nOffset = (int)(Rand_Num.NextDouble() * 250); for (int p = 0; p <= 119; p++) { Pesgo1.PeData.X[s, p] = (float)((p + 1) * 100.0F); 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); } } // DEMO COLORS: MainWindow.DemoColors[0..12] is the app's shared palette. When // writing test code, use SubsetColors[i] = Color.FromArgb(...) for explicit colors, // or just note "uses DemoColors" if matching the base. // // EXAMPLE 000 -- CreateSimpleGraph(Pego1) -- Pego Base // // DATA SETUP: Pego1.PeData.Subsets = 4; Pego1.PeData.Points = 12; // Y data: random upward-trending pattern (see helper above) // Pego1.PeString.SubsetLabels[0..3] = "Texas", "Florida", "Washington", "California"; // Pego1.PeString.PointLabels[0..11] = "January" through "December"; // Pego1.PeColor.SubsetColors[0..3] = DemoColors[0..3]; // PLOTTING: Pego1.PePlot.Method = GraphPlottingMethod.Area; Pego1.PePlot.DataShadows = DataShadows.Shadows; Pego1.PePlot.MarkDataPoints = false; Pego1.PePlot.Allow.StackedData = true; // enables menu option, not default method Pego1.PePlot.Allow.Ribbon = true; // PLOT STYLE ENHANCEMENTS (pre-set for all method switches): Pego1.PePlot.Option.BarGlassEffect = true; Pego1.PePlot.Option.AreaGradientStyle = PlotGradientStyle.RadialBottomRight; Pego1.PePlot.Option.AreaBevelStyle = BevelStyle.MediumSmooth; Pego1.PePlot.Option.SplineGradientStyle = PlotGradientStyle.RadialBottomRight; Pego1.PePlot.Option.SplineBevelStyle = SplineBevelStyle.MediumSmooth; Pego1.PePlot.Option.PointGradientStyle = PlotGradientStyle.VerticalAscentInverse; Pego1.PePlot.Option.GradientBars = 8; Pego1.PePlot.Option.LineShadows = true; Pego1.PePlot.Option.LineSymbolThickness = 3; Pego1.PePlot.Option.AreaBorder = 1; Pego1.PeColor.PointBorderColor = Color.FromArgb(100, 0, 0, 0); // THEME & FONTS: Pego1.PeColor.BitmapGradientMode = true; Pego1.PeColor.QuickStyle = QuickStyle.DarkNoBorder; Pego1.PeFont.Fixed = true; Pego1.PeFont.FontSize = FontSize.Large; Pego1.PeFont.MainTitle.Bold = true; Pego1.PeFont.SubTitle.Bold = true; Pego1.PeFont.Label.Bold = true; Pego1.PeConfigure.TextShadows = TextShadows.BoldText; // GRID: Pego1.PeGrid.LineControl = GridLineControl.Both; Pego1.PeGrid.Style = GridStyle.Dot; // TABLE: Pego1.PeTable.Show = GraphPlusTable.Both; Pego1.PeData.Precision = DataPrecision.OneDecimal; // LEGEND: // Pego1.PeLegend.SubsetLineTypes[0..7] = LineType.MediumSolid; // Pego1.PeLegend.SubsetPointTypes[0..7] = DotSolid, UpTriangleSolid, SquareSolid, // DownTriangleSolid, Dot, UpTriangle, Square, DownTriangle; Pego1.PeLegend.SimplePoint = true; Pego1.PeLegend.SimpleLine = true; Pego1.PeLegend.Style = LegendStyle.OneLine; Pego1.PeLegend.AllowLargerLegendWidth = 250; // INTERACTION: Pego1.PeUserInterface.Cursor.PromptTracking = true; Pego1.PeUserInterface.Allow.FocalRect = false; Pego1.PeUserInterface.Allow.Zooming = AllowZooming.HorzAndVert; Pego1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not; Pego1.PeUserInterface.Scrollbar.MouseDraggingX = true; Pego1.PeUserInterface.Scrollbar.MouseDraggingY = true; // TITLES: Pego1.PeString.MainTitle = "Units Sold per Month"; Pego1.PeString.SubTitle = ""; Pego1.PeString.YAxisLabel = "Units Sold"; Pego1.PeString.XAxisLabel = "Month"; // RENDERING & EXPORT: Pego1.PeConfigure.PrepareImages = true; Pego1.PeConfigure.RenderEngine = RenderEngine.Direct2D; Pego1.PeConfigure.AntiAliasGraphics = true; Pego1.PeConfigure.AntiAliasText = true; Pego1.PeConfigure.ImageAdjustLeft = 20; Pego1.PeConfigure.ImageAdjustRight = 20; Pego1.PeConfigure.ImageAdjustTop = 10; Pego1.PeSpecial.DpiX = 600; Pego1.PeSpecial.DpiY = 600; Pego1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel; Pego1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png; Pego1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard; Pego1.PeUserInterface.Dialog.ExportUnitXDef = "1280"; Pego1.PeUserInterface.Dialog.ExportUnitYDef = "768"; Pego1.PeUserInterface.Dialog.ExportImageDpi = 300; // FINALIZE: Pego1.PeFunction.ReinitializeResetImage(); Pego1.Invalidate(); // // EXAMPLE 100 -- CreateSimpleSGraph(Pesgo1) -- Pesgo Base // // DIFFERENCES FROM 000 (everything else same pattern as 000 but with Pesgo1. prefix): // DATA SETUP: Pesgo1.PeData.Subsets = 4; Pesgo1.PeData.Points = 120; // Data: X and Y arrays, sine wave pattern (see helper above) // Pesgo1.PeString.SubsetLabels[0..3] = "Horsepower", "Torque", "Temperature", "Pressure"; // Pesgo1.PeColor.SubsetColors[0..3] = DemoColors[0..3]; // PLOTTING: Pesgo1.PePlot.Method = SGraphPlottingMethod.PointsPlusSpline; Pesgo1.PeColor.BitmapGradientMode = false; // NOTE: false unlike Pego base // TITLES: Pesgo1.PeString.MainTitle = "Test Results"; Pesgo1.PeString.SubTitle = ""; Pesgo1.PeString.YAxisLabel = "Performance"; Pesgo1.PeString.XAxisLabel = "Duration"; // ADDITIONAL PESGO-SPECIFIC: Pesgo1.PeGrid.Option.MultiAxisStyle = MultiAxisStyle.SeparateAxes; Pesgo1.PeGrid.Configure.AutoMinMaxPadding = 1; Pesgo1.PeUserInterface.Scrollbar.ScrollingHorzZoom = true; Pesgo1.PeUserInterface.Cursor.PromptLocation = CursorPromptLocation.ToolTip; Pesgo1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.XYValues; Pesgo1.PeData.Precision = DataPrecision.OneDecimal; // NOT IN 100 BASE (present in 000 but absent here): // NO PeTable.Show (no data table by default) // NO PePlot.MarkDataPoints setting // NO PePlot.Allow.StackedData / Allow.Ribbon // // EXAMPLE 200 -- CreateSimplePolar(Pepso1) -- Pepso Base // // DATA SETUP: Pepso1.PeData.Subsets = 2; Pepso1.PeData.Points = 360; // Data: Pepso1.PeData.X[s,p] = p (degrees), Pepso1.PeData.Y[s,p] = 150 * sin(p * factor) // Pepso1.PeString.SubsetLabels[0..1] = "Signal #1", "Signal #2"; // Pepso1.PeColor.SubsetColors[0..1] = DemoColors[0..1]; Pepso1.PeData.NullDataValueX = -99999; Pepso1.PeData.NullDataValue = -99999; // PLOTTING: Pepso1.PePlot.Method = PSGraphPlottingMethod.PointsPlusLine; Pepso1.PePlot.DataShadows = DataShadows.Shadows; Pepso1.PePlot.PointSize = PointSize.Small; // THEME & FONTS: Pepso1.PeColor.BitmapGradientMode = true; Pepso1.PeColor.QuickStyle = QuickStyle.DarkNoBorder; Pepso1.PeFont.Fixed = true; Pepso1.PeFont.FontSize = FontSize.Medium; Pepso1.PeFont.SizeLegendCntl = 0.9F; Pepso1.PeFont.SizeGridNumberCntl = 1.2F; Pepso1.PeFont.MainTitle.Bold = true; Pepso1.PeFont.SubTitle.Bold = true; Pepso1.PeFont.Label.Bold = true; Pepso1.PeConfigure.TextShadows = TextShadows.BoldText; // TITLES: Pepso1.PeString.MainTitle = "Polar Chart"; Pepso1.PeString.SubTitle = ""; // LEGEND: // Pepso1.PeLegend.SubsetLineTypes[0..1] = LineType.MediumSolid; // Pepso1.PeLegend.SubsetPointTypes[0..1] = PointType.DotSolid; Pepso1.PeLegend.SimplePoint = true; Pepso1.PeLegend.SimpleLine = true; Pepso1.PeLegend.Style = SimpleLegendStyle.OneLine; // INTERACTION: Pepso1.PeUserInterface.Allow.FocalRect = false; Pepso1.PeUserInterface.Allow.Zooming = AllowZooming.HorzAndVert; Pepso1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not; // RENDERING: Pepso1.PeConfigure.PrepareImages = true; Pepso1.PeConfigure.CacheBmp = true; Pepso1.PeConfigure.RenderEngine = RenderEngine.Direct2D; Pepso1.PeConfigure.AntiAliasGraphics = true; Pepso1.PeConfigure.AntiAliasText = true; Pepso1.PeConfigure.ImageAdjustBottom = 100; Pepso1.PePlot.Option.PointGradientStyle = PlotGradientStyle.VerticalAscentInverse; Pepso1.PeColor.PointBorderColor = Color.FromArgb(100, 0, 0, 0); Pepso1.PePlot.Option.LineSymbolThickness = 3; Pepso1.PePlot.Option.LineShadows = true; // Export defaults same as 000 but with Pepso1. prefix. // NOT IN 200 BASE: NO PeTable.Show, NO grid line settings, NO mouse dragging // // EXAMPLE 300 -- CreateSimplePie(Pepco1) -- Pepco Base // // DATA SETUP: Pepco1.PeData.Subsets = 5; Pepco1.PeData.Points = 12; // Data: Pepco1.PeData.X[s,p] = random * 5 + random (slice values use X not Y) // Pepco1.PeString.SubsetLabels[0..4] = "Apples","Oranges","Pears","Plums","Peaches"; // Pepco1.PeString.PointLabels[0..11] = "Texas","Oklahoma","Kansas","New Mexico", // "Colorado","Wyoming","Utah","Arizona","Nebraska","South Dakota","North Dakota","Iowa"; // Pepco1.PeColor.SubsetColors[0..12] = DemoColors[0..12]; // PLOTTING: Pepco1.PePlot.GroupingPercent = GroupingPercent.FourPercent; Pepco1.PePlot.DataShadows = DataShadows.ThreeDimensional; Pepco1.PePlot.Show3DShadow = true; Pepco1.PeUserInterface.AutoExplode = AutoExplode.AllSubsets; // THEME & FONTS: Pepco1.PeColor.BitmapGradientMode = true; Pepco1.PeColor.QuickStyle = QuickStyle.DarkNoBorder; Pepco1.PeFont.Fixed = true; Pepco1.PeFont.FontSize = FontSize.Large; Pepco1.PeFont.MainTitle.Bold = true; Pepco1.PeFont.SubTitle.Bold = true; Pepco1.PeFont.Label.Bold = true; Pepco1.PeConfigure.TextShadows = TextShadows.BoldText; // TITLES: Pepco1.PeString.MainTitle = "Produce by State"; Pepco1.PeString.SubTitle = ""; // OTHER: Pepco1.PeData.Precision = DataPrecision.OneDecimal; Pepco1.PeUserInterface.Allow.FocalRect = false; Pepco1.PeConfigure.PrepareImages = true; Pepco1.PeConfigure.CacheBmp = true; Pepco1.PeConfigure.RenderEngine = RenderEngine.Direct2D; Pepco1.PeConfigure.AntiAliasGraphics = true; Pepco1.PeConfigure.AntiAliasText = true; // Export defaults same as 000 but with Pepco1. prefix. // NOT IN 300 BASE: NO PePlot.Method (pie has no method enum), NO grid, NO table, // NO axis labels, NO zoom, NO mouse dragging // // EXAMPLE 400 -- CreateSimple3D(Pe3do1) -- Pe3do Base (Simplified) // // NOTE: The actual demo 400 loads terrain data from a binary file and includes // graph annotations and rotation-around-annotation code. This simplified base // captures only the essential Pe3do setup pattern. // DATA SETUP: Pe3do1.PeFunction.Reset(); // always start Pe3do with Reset Pe3do1.PeData.Subsets = 10; Pe3do1.PeData.Points = 10; // Simple random surface data: for (int s = 0; s < 10; s++) for (int p = 0; p < 10; p++) { Pe3do1.PeData.X[s, p] = (float)(p + 1); Pe3do1.PeData.Z[s, p] = (float)(s + 1); Pe3do1.PeData.Y[s, p] = (float)(Math.Sin(s * 0.5) * Math.Cos(p * 0.5) * 500 + (Rand_Num.NextDouble() * 100)); } // PLOTTING: Pe3do1.PePlot.Method = ThreeDGraphPlottingMethod.Zero; Pe3do1.PePlot.Allow.SurfaceContour = true; Pe3do1.PePlot.Option.ShowWireFrame = true; Pe3do1.PePlot.Option.ShowContour = ShowContour.BottomColors; // 3D VIEWING: Pe3do1.PePlot.Option.DxZoom = -1.20F; Pe3do1.PePlot.Option.DxZoomMax = 4F; Pe3do1.PePlot.Option.DxZoomMin = -4F; Pe3do1.PePlot.Option.DxFitControlShape = false; Pe3do1.PePlot.Option.DxViewportY = 0.7F; Pe3do1.PePlot.Option.DxViewportPanFactor = 1.1F; Pe3do1.PePlot.Option.DegreePrompting = true; Pe3do1.PeGrid.Option.GridAspectX = 2.0F; Pe3do1.PeGrid.Option.GridAspectZ = 2.0F; Pe3do1.PeUserInterface.Scrollbar.ViewingHeight = 16; Pe3do1.PeUserInterface.Scrollbar.DegreeOfRotation = 196; Pe3do1.PeFunction.SetLight(0, -2.2F, -7.30F, 8.3F); // SMOOTHNESS & INTERACTION: Pe3do1.PeUserInterface.Scrollbar.ScrollSmoothness = 3; Pe3do1.PeUserInterface.Scrollbar.MouseWheelZoomSmoothness = 3; Pe3do1.PeUserInterface.Scrollbar.PinchZoomSmoothness = 2; Pe3do1.PeUserInterface.Scrollbar.MouseWheelZoomFactor = 3.5F; Pe3do1.PeUserInterface.Scrollbar.MouseDraggingX = true; Pe3do1.PeUserInterface.Scrollbar.MouseDraggingY = true; Pe3do1.PeUserInterface.HotSpot.Data = true; Pe3do1.PeUserInterface.Cursor.PromptTracking = true; Pe3do1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.YValue; Pe3do1.PeUserInterface.Cursor.HighlightColor = Color.FromArgb(255, 255, 0, 0); Pe3do1.PeUserInterface.Menu.DataShadow = MenuControl.Show; // SURFACE COLORS: Pe3do1.PeColor.SubsetColors[(int)(SurfaceColors.WireFrame)] = Color.FromArgb(255, 225, 225, 225); Pe3do1.PeColor.SubsetColors[(int)(SurfaceColors.SolidSurface)] = Color.FromArgb(255, 159, 159, 159); Pe3do1.PeColor.ContourColorSet = ContourColorSet.BlueCyanGreenYellowBrownWhite; Pe3do1.PeLegend.Location = LegendLocation.Left; Pe3do1.PeLegend.ContourStyle = true; Pe3do1.PeLegend.ContourLegendPrecision = ContourLegendPrecision.ZeroDecimals; // THEME & RENDERING: Pe3do1.PeConfigure.RenderEngine = RenderEngine.Direct3D; // NOTE: Direct3D not Direct2D Pe3do1.PeColor.BitmapGradientMode = true; Pe3do1.PeColor.QuickStyle = QuickStyle.DarkNoBorder; // set AFTER RenderEngine for 3DX Pe3do1.PeData.ComputeShader = true; Pe3do1.PeFont.Fixed = true; Pe3do1.PeFont.FontSize = FontSize.Medium; Pe3do1.PeFont.Label.Bold = true; Pe3do1.PeConfigure.TextShadows = TextShadows.BoldText; Pe3do1.PeConfigure.PrepareImages = true; Pe3do1.PeConfigure.CacheBmp = true; Pe3do1.PeConfigure.AntiAliasGraphics = true; Pe3do1.PeConfigure.AntiAliasText = true; Pe3do1.PeUserInterface.Allow.FocalRect = false; Pe3do1.PeData.Precision = DataPrecision.TwoDecimals; Pe3do1.PeConfigure.ImageAdjustLeft = 100; Pe3do1.PeConfigure.ImageAdjustRight = 100; Pe3do1.PeConfigure.ImageAdjustTop = 50; Pe3do1.PeConfigure.ImageAdjustBottom = 50; // Export defaults same as 000 but with Pe3do1. prefix. // FINALIZE: Pe3do1.PeFunction.Force3dxVerticeRebuild = true; Pe3do1.PeFunction.Force3dxAnnotVerticeRebuild = true; Pe3do1.PeFunction.ReinitializeResetImage(); Pe3do1.Invalidate(); Pe3do1.Refresh(); // // QUICK REFERENCE: Which base does each test range use? // // Examples 000-099 --> Example 000 base (Pego) via CreateSimpleGraph() // Examples 100-199 --> Example 100 base (Pesgo) via CreateSimpleSGraph() // Examples 200-299 --> Example 200 base (Pepso) via CreateSimplePolar() // Examples 300-399 --> Example 300 base (Pepco) via CreateSimplePie() // Examples 400-499 --> Example 400 base (Pe3do) via CreateSimple3D()