# Copyright (c) 2025-2026 Gigasoft, Inc. All rights reserved. === ProEssentials Pesgo (knowledge rev 4.5) (Scientific Graph Object) Patterns === Pesgo is the Scientific Graph Object for continuous numeric X-axis charts. Scatter, line, spline, bubble, contour, and more. ALWAYS query pe_query.py for exact paths -- this file provides conceptual understanding only. CRITICAL -- PLOTTING METHOD ENUM: Pesgo uses SGraphPlottingMethod (NOT GraphPlottingMethod or others). Pesgo1.PePlot.Method = SGraphPlottingMethod.PointsPlusSpline; The enum has 26 values including: Line(0), Point(1), Stick(2), PointsPlusBestFitLine(3), PointsPlusBestFitCurve(4), PointsPlusSpline(5), Spline(6), Bubble(7), PointsPlusLine(8), Area(9), Bar(10), SpecificPlotMode(11), Step(12), Ribbon(13), ContourLines(14), ContourColors(15), AreaStacked(16), SplineArea(22), SplineRibbon(23), ContourColorsShadows(24), ContourDelaunay(25). Query: pe_query.py enum "SGraphPlottingMethod" WARNING: Integer values differ from GraphPlottingMethod. For example, Point=1 in SGraphPlottingMethod but Point=2 in GraphPlottingMethod. Using the wrong enum produces silent runtime bugs. X-AXIS DATA MODEL: Pesgo X-axis is continuous numeric -- requires explicit PeData.X[s,p] values. Both PeData.X[subset, point] and PeData.Y[subset, point] must be populated. X-axis labels are auto-generated from numeric scale (not PointLabels). BUBBLE CHART (SGraphPlottingMethod.Bubble): Bubble charts add a third dimension via PeData.Z[s,p] which controls bubble radius. X positions horizontally, Y positions vertically, Z sizes. Key pattern: PePlot.Method = SGraphPlottingMethod.Bubble; PeData.Z[s, p] = sizeValue; // larger Z = larger bubble Optional bubble-specific properties (defaults are usually fine): PePlot.Option.BubbleSize -- Small/Medium/Large (controls max size) PePlot.Option.BubbleGradientStyle -- None/Radial/Beveled PePlot.Option.BubbleSizeFormulaArea -- true=area-based, false=diameter IMPORTANT -- Allow.* method restrictions for bubble/scatter charts: PePlot.Allow.Bubble = true; // enable Bubble in right-click menu Disable methods that look wrong with scatter data: PePlot.Allow.Spline = false; PePlot.Allow.PointsPlusSpline = false; PePlot.Allow.BestFitLine = false; PePlot.Allow.BestFitCurve = false; PePlot.Allow.Area = false; PePlot.Allow.SplineArea = false; HotSpot sizing: Use PeUserInterface.HotSpot.Size = HotSpotSize.Large for bubble charts -- variable bubble sizes need larger click targets. See Example 126. PROGRAMMATIC ZOOMING (common customer pattern): Customers frequently need to programmatically focus on a data region -- e.g., most recent time window, anomaly region, or smart UX that auto- navigates to interesting data. Use ZoomMode = true with ZoomMinX/ZoomMaxX. When using MultiAxesSubsets, AllowZooming MUST be Horizontal (not HorzAndVert) because ZoomMinY/ZoomMaxY can't address multiple Y scales. Enable PePlot.ZoomWindow.Show = true for an overview navigation strip. See pe-zoom knowledge file for full details and code pattern. See Example 124. LARGE DATASET HANDLING: For 10K+ points, use FastCopyFrom with flat arrays for bulk data transfer: float[] yData = new float[subsets * points]; // fill array... Pesgo1.PeData.Y.FastCopyFrom(yData, subsets * points); Same pattern for PeData.X.FastCopyFrom. CONTOUR DATA MODEL (X, Y, Z -- three arrays): Contour plotting methods (ContourLines, ContourColors, ContourColorsShadows, ContourDelaunay) use a DIFFERENT data model from standard scatter/line: PeData.X[s,p] = spatial X coordinate PeData.Y[s,p] = spatial Y coordinate PeData.Z[s,p] = contour value (elevation, temperature, etc.) Subsets = grid rows, Points = grid columns. Z holds the values being contoured. Do NOT confuse with standard Pesgo where Y holds the data values. Key contour config: PeLegend.ContourStyle = true -- continuous color legend PeLegend.ContourLegendPrecision -- decimal control PeColor.ContourColorBlends -- number of color transitions PeColor.ContourColorSet -- predefined color palette enum PeColor.SubsetShades -- controls contour line colors PeGrid.Configure.AutoMinMaxPadding = 0 -- contour extends to grid edges Contour charts should disable non-contour Allow.* plotting methods via PePlot.Allow.Line = false, Allow.Point = false, Allow.Bar = false, etc. when UI menus are enabled, since XYZ data renders poorly as line/area/etc. RenderEngine: GdiPlus, Direct2D, and Direct3D all support contour lines. DIRECT3D CONTOUR GOTCHA: When using RenderEngine.Direct3D for contour performance, Pesgo needs the same 3D rebuild flags as Pe3do: Force3dxVerticeRebuild = true and Force3dxNewColors = true before ReinitializeResetImage(). Without these, contour colors and geometry may not update after data or color changes. See Example 121 (ContourLines) and Example 120 (ContourColors). COMPUTESHADER (Direct3D GPU rendering -- expanded in v10): PeData.ComputeShader = true enables GPU-side construction when RenderEngine = Direct3D. Default false (CPU-side construction). Most beneficial for real-time / high-density data, but also improves general rendering quality across all supported modes. Supported plotting methods on Pesgo Direct3D + ComputeShader: Line (now supports dash and dot of varying thickness) Area Point (max 4 vertices, 6 indices per symbol; ResourceBitmaps fully supported) Bar (best with one bar per axis) ContourColors ContourLines Pego also supports ComputeShader (Direct3D, dash/dot lines, etc.). Less commonly used because Pego has no X data array, but valuable for large Y-only datasets (e.g., 500K+ points). HOTSPOTS / REAL-TIME TRADE-OFF: The hotspot octree is still built CPU-side on a separate thread after the GPU render (250-500ms on large charts). For maximum real-time throughput, disable the properties that trigger hotspot construction. On Pesgo (and Pego), these are: PeUserInterface.HotSpot.Data = false; PeUserInterface.Cursor.PromptTracking = false; (HighlightColor is the third trigger but applies only to Pe3do -- see pe-pe3do-patterns.) If any of these is active, ComputeShader still runs but the hotspot CPU build runs in parallel. FILTER2D3D (very large datasets): PeData.Filter2D3D -- companion property recommended for ComputeShader datasets of roughly 1M+ points. Reduces vertex load via GPU-side filtering. DIRECT3D LINE TYPE CONSTRAINT (Pesgo and Pego): RenderEngine.Direct3D restricts SubsetLineTypes: ComputeShader = false -- solid styles only. ComputeShader = true -- solid + Dash + Dot of varying thickness. NEVER on Direct3D -- DashDot, DashDotDot. Setting an unsupported style under Direct3D silently falls back to solid -- a common "compiles fine, looks wrong" gotcha. For DashDot patterns, use RenderEngine.Hybrid or RenderEngine.GdiPlus. See Example 115 for dash/dot lines via Direct3D + ComputeShader. LOG SCALE SUPPORT: PeGrid.Configure.XAxisScaleControl = ScaleControl.Log; PeGrid.Configure.YAxisScaleControl = ScaleControl.Log; PeGrid.Option.LogScaleExpLabels = true; // exponent notation (10^3, 10^4) Pesgo handles log-log, log-linear, and linear-log combinations. SUBSET VISIBILITY AND DRAW ORDER: PeData.SubsetsToShow[subsetIndex] = priority (0--9): 0 = hidden, 1--9 = visible, higher values drawn first (behind). Simpler than RandomSubsetsToGraph for basic show/hide. PeData.RandomSubsetsToGraph -- lists explicit subset indices to include. Order of indices controls draw order. PeLegend.SubsetsToLegend -- independently controls legend order/visibility. PeGrid.SubsetAxes[subsetIndex] = axisIndex -- overrides default sequential axis assignment from MultiAxesSubsets. See Example 013. See pe-legends knowledge file for legend ordering details. PESGO BASE (Example 100) PROVIDES: 4 subsets x 120 points, PointsPlusSpline method, sine wave data, DarkNoBorder QuickStyle (no BitmapGradient), Large fonts, bold text, dotted grid lines, SeparateAxes multi-axis, AutoMinMaxPadding=1, scrolling horz zoom, tooltip cursor with XY values, HorzAndVert zoom, mouse dragging, Direct2D render. KEY: Always query exact paths: pe_query.py enum "SGraphPlottingMethod" pe_query.py props "XAxisScaleControl,YAxisScaleControl" pe_query.py enum "ScaleControl" pe_query.py props "BubbleSize,BubbleGradientStyle,BubbleSizeFormulaArea"