3D Scatter Chart
1//! Double Click to start and stop Auto Rotation. //2//! Click and drag scroll bar thumb tabs to quickly rotate. //3//! Right button click to show popup menu. //4 5Pe3do1.PePlot.Option.DxZoomMax = 20F; // v10 New properties to control max and min, note higher DxFOV means higher Max Min6Pe3do1.PePlot.Option.DxZoomMin = -16F;7 8Pe3do1.PePlot.Option.DxViewportPanFactor = 1.1F; // v10 New properties to control shift/drag and mousewheel sensitivity9Pe3do1.PeUserInterface.Scrollbar.MouseWheelZoomFactor = 1.5F;10 11// Enable smooth rotating and zooming //12Pe3do1.PeUserInterface.Scrollbar.ScrollSmoothness = 2;13Pe3do1.PeUserInterface.Scrollbar.MouseWheelZoomSmoothness = 4;14Pe3do1.PeUserInterface.Scrollbar.PinchZoomSmoothness = 2;15 16// Non-Surface chart, set PolyMode //17Pe3do1.PePlot.PolyMode = PolyMode.Scatter;18 19// Do not auto fit to shape of window //20Pe3do1.PePlot.Option.DxFitControlShape = false;21Pe3do1.PeGrid.Option.GridAspectY = .5F;22Pe3do1.PePlot.PointSize = PointSize.Small;23 24// Set camera position //25Pe3do1.PeUserInterface.Scrollbar.ViewingHeight = 35;26Pe3do1.PeUserInterface.Scrollbar.DegreeOfRotation = 68;27 28// Set eye/camera distance, or Zoom amount //29// v9 feature30Pe3do1.PePlot.Option.DxFOV = 8; // isometric pictural perspective31Pe3do1.PePlot.Option.DxViewportY = 0.0F;32 33// zoom out34Pe3do1.PePlot.Option.DxZoom = -5.0F;35 36// Enable button dragging //37Pe3do1.PeUserInterface.Scrollbar.MouseDraggingX = true;38Pe3do1.PeUserInterface.Scrollbar.MouseDraggingY = true;39 40// Set the amount of data //41Pe3do1.PeData.Subsets = 10;42Pe3do1.PeData.Points = 500;43 44Pe3do1.PeData.X[9, 499] = 0.0F; // tip to pre allocate memory if not using FastCopyFrom45Pe3do1.PeData.Y[9, 499] = 0.0F; // set last point first46Pe3do1.PeData.Z[9, 499] = 0.0F; // helps with spoon feeding large amounts, we recommend FastCopyFrom47 48float f;49int s, p;50// Pass data, First two subsets //51for (s = 0; s <= 1; s++)52{53 for (p = 0; p <= 499; p++)54 {55 f = 5000.0F + (float)(5.0F * Math.Cos(p * 0.24)); f = f * (p + 1);56 Pe3do1.PeData.X[s, p] = f;57 if (s == 0)58 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.22)) + (10.0F * Math.Sin((s * 0.1) * 0.94)));59 else60 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.08)) + (10.0F * Math.Cos((s * 0.25) * 0.6)));61 f += 100;62 Pe3do1.PeData.Y[s, p] = f;63 Pe3do1.PeData.Z[s, p] = 5000.0F + (float)(5.0F * (Math.Sin(p * 0.08)));64 }65}66 67for (s = 2; s <= 3; s++)68{69 for (p = 0; p <= 499; p++)70 {71 f = 5000.0F + (float)(5.0F * Math.Cos(p * 0.14)); f = f * (p + 1);72 Pe3do1.PeData.X[s, p] = f;73 if (s == 2)74 f = 5000.0F + (float)((35.0 * Math.Cos(p * 0.2)) + (10.0F * Math.Sin((s * 0.1) * 0.74)));75 else76 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.1)) + (10.0F * Math.Cos((s * 0.25) * 0.74)));77 f += 220;78 Pe3do1.PeData.Y[s, p] = f;79 80 f = 5000.0F + (float)(5.0F * (Math.Sin(p * 0.16))); f = f + 20;81 Pe3do1.PeData.Z[s, p] = f;82 }83}84 85// Pass more data, Third two subsets //86for (s = 4; s <= 5; s++)87{88 for (p = 0; p <= 499; p++)89 {90 f = 5000.0F + (float)(5.0F * Math.Cos(p * 0.07)); f = f * (p + 1);91 Pe3do1.PeData.X[s, p] = f;92 if (s == 4)93 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.08)) + (10.0 * Math.Sin((s * 0.07) * 0.64)));94 else95 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.2)) + (10.0F * Math.Cos((s * 0.15) * 1.94)));96 Pe3do1.PeData.Y[s, p] = f;97 98 f = 5000.0F + (float)(5.0F * (Math.Sin(p * 0.09))); f = f + 20;99 Pe3do1.PeData.Z[s, p] = f;100 }101}102 103// Pass more data, Fourth two subsets //104for (s = 6; s <= 7; s++)105{106 for (p = 0; p <= 499; p++)107 {108 f = 5000.0F + (float)(5.0F * Math.Cos(p * 0.12)); f = f * (p + 1);109 Pe3do1.PeData.X[s, p] = f;110 if (s == 6)111 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.3)) + (10.0F * Math.Sin((s * 0.08) * 1.74)));112 else113 f = 5000.0F + (float)((35.0F * Math.Cos(p * 0.2)) + (10.0F * Math.Cos((s * 0.75) * 0.77)));114 f += 220;115 Pe3do1.PeData.Y[s, p] = f;116 117 f = 5000.0F + (float)(5.0F * (Math.Sin(p * 0.36))); f = f - 20;118 Pe3do1.PeData.Z[s, p] = f;119 }120}121 122// Pass more data, Fifth two subsets //123for (s = 8; s <= 9; s++)124{125 for (p = 0; p <= 499; p++)126 {127 f = 5000.0F + (float)(5.0F * Math.Cos(p * 0.14)); f = f + 20.0F;128 Pe3do1.PeData.X[s, p] = f;129 if (s == 8)130 f = 5000.0F + (float)((25.0F * Math.Cos(p * 0.1)) + (10.0F * Math.Sin((s * 0.02) * 3.74)));131 else132 f = 5000.0F + (float)((55.0F * Math.Cos(p * 0.2)) + (10.0F * Math.Cos((s * 0.05) * 5.74)));133 f += 40;134 Pe3do1.PeData.Y[s, p] = f;135 136 f = 5000.0F + (float)(5.0F * (Math.Sin(p * 0.16))); f = f - 20;137 Pe3do1.PeData.Z[s, p] = f;138 }139}140 141Pe3do1.PeGrid.Configure.XAxisScaleControl = Gigasoft.ProEssentials.Enums.ScaleControl.Log;142Pe3do1.PeGrid.Configure.YAxisScaleControl = Gigasoft.ProEssentials.Enums.ScaleControl.Log;143Pe3do1.PeGrid.Configure.ZAxisScaleControl = Gigasoft.ProEssentials.Enums.ScaleControl.Log;145Pe3do1.PeFont.Fixed = true;146Pe3do1.PeString.MainTitle = "LOG + Isometric Perspective";147Pe3do1.PeConfigure.RenderEngine = RenderEngine.Direct3D;148Pe3do1.PeColor.BitmapGradientMode = true;149Pe3do1.PeColor.QuickStyle = QuickStyle.DarkShadow;150Pe3do1.PeColor.GraphForeground = Color.White;151Pe3do1.PeColor.XZBackColor = Color.FromArgb(255, 85, 85, 85);152Pe3do1.PeColor.YBackColor = Color.FromArgb(255, 85, 85, 85);153 154// Set Various Other Properties //155 156Pe3do1.PeColor.SubsetColors[0] = Color.FromArgb(255, 198, 198, 0);157Pe3do1.PeColor.SubsetColors[1] = Color.FromArgb(255, 0, 198, 198);158Pe3do1.PeColor.SubsetColors[2] = Color.FromArgb(255, 0, 198, 0);159Pe3do1.PeColor.SubsetColors[3] = Color.FromArgb(255, 198, 0, 0);160Pe3do1.PeColor.SubsetColors[4] = Color.FromArgb(255, 0, 0, 198);161Pe3do1.PeColor.SubsetColors[5] = Color.FromArgb(255, 192, 192, 192);162Pe3do1.PeColor.SubsetColors[6] = Color.FromArgb(255, 198, 0, 198);163Pe3do1.PeColor.SubsetColors[7] = Color.FromArgb(255, 200, 198, 150);164Pe3do1.PeColor.SubsetColors[8] = Color.FromArgb(255, 150, 150, 140);165Pe3do1.PeColor.SubsetColors[9] = Color.FromArgb(255, 0, 206, 210);166 167Pe3do1.PePlot.SubsetPointTypes[0] = PointType.DotSolid;168Pe3do1.PePlot.SubsetPointTypes[1] = PointType.DotSolid;169Pe3do1.PePlot.SubsetPointTypes[2] = PointType.DotSolid;170Pe3do1.PePlot.SubsetPointTypes[3] = PointType.DotSolid;171Pe3do1.PePlot.SubsetPointTypes[4] = PointType.DotSolid;172Pe3do1.PePlot.SubsetPointTypes[5] = PointType.DotSolid;173Pe3do1.PePlot.SubsetPointTypes[6] = PointType.DotSolid;174Pe3do1.PePlot.SubsetPointTypes[7] = PointType.DotSolid;175Pe3do1.PePlot.SubsetPointTypes[8] = PointType.DotSolid;176Pe3do1.PePlot.SubsetPointTypes[9] = PointType.DotSolid;177 178Pe3do1.PePlot.SubsetLineTypes[0] = LineType.MediumThinSolid; // v9.5179Pe3do1.PePlot.SubsetLineTypes[1] = LineType.MediumThinSolid;180Pe3do1.PePlot.SubsetLineTypes[2] = LineType.MediumThinSolid;181Pe3do1.PePlot.SubsetLineTypes[3] = LineType.MediumThinSolid;182Pe3do1.PePlot.SubsetLineTypes[4] = LineType.MediumThinSolid;183Pe3do1.PePlot.SubsetLineTypes[5] = LineType.MediumThinSolid;184Pe3do1.PePlot.SubsetLineTypes[6] = LineType.MediumThinSolid;185Pe3do1.PePlot.SubsetLineTypes[7] = LineType.MediumThinSolid;186Pe3do1.PePlot.SubsetLineTypes[8] = LineType.MediumThinSolid;187Pe3do1.PePlot.SubsetLineTypes[9] = LineType.MediumThinSolid;188Pe3do1.PePlot.LinesOrTubes = LinesOrTubes.AllLines;189 190Pe3do1.PeUserInterface.Menu.AnnotationControl = true;191Pe3do1.PeUserInterface.Menu.ShowAnnotationText = MenuControl.Show;192Pe3do1.PeUserInterface.Menu.AnnotationTextFixedSize = MenuControl.Show;193 194// Add some random graph annotations //195int aCnt = 0;196for (int annot = 0; annot < 10; annot++)197{198 int nRndRow = (int)(Rand_Num.NextDouble() * (float)9);199 int nRndCol = (int)(Rand_Num.NextDouble() * (float)499);203 Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.LargeDotSolid;204 Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";205 Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);206 MainWindow.m_nAnnotationStartIndices[annot] = aCnt;207 aCnt++;211 Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.Pointer;212 Pe3do1.PeAnnotation.Graph.Text[aCnt] = "|lAnnotation " + annot.ToString();213 Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);214 aCnt++;215}216 217Pe3do1.PeAnnotation.Graph.X[aCnt] = 50000;218Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5000F;219Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5000F;220Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.ThickSolidLine;221Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";222Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);223aCnt++;224Pe3do1.PeAnnotation.Graph.X[aCnt] = 50100;225Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5011F;226Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5011F;227Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.ArrowLarge;228Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";229Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);230aCnt++;231 232Pe3do1.PeAnnotation.Graph.X[aCnt] = 70000;233Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5000F;234Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5000F;235Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.MediumThinSolid;236Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";237Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);238aCnt++;239 240Pe3do1.PeAnnotation.Graph.X[aCnt] = 70200;241Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5012F;242Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5012F;243Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.ArrowMedium;244Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";245Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);246aCnt++;247 248Pe3do1.PeAnnotation.Graph.X[aCnt] = 90000;249Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5005F;250Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5005F;251Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.ThinSolidLine;252Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";253Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);254aCnt++;255 256Pe3do1.PeAnnotation.Graph.X[aCnt] = 90300;257Pe3do1.PeAnnotation.Graph.Z[aCnt] = 5014F;258Pe3do1.PeAnnotation.Graph.Y[aCnt] = 5014F;259Pe3do1.PeAnnotation.Graph.Type[aCnt] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.ArrowSmall;260Pe3do1.PeAnnotation.Graph.Text[aCnt] = "";261Pe3do1.PeAnnotation.Graph.Color[aCnt] = Color.FromArgb(255, 0, 255, 0);262aCnt++;263 264Pe3do1.PePlot.LinesOrTubes = LinesOrTubes.MediumThickTubes;265 266Pe3do1.PeUserInterface.HotSpot.Title = true;267Pe3do1.PeUserInterface.HotSpot.Subset = true;268Pe3do1.PeUserInterface.HotSpot.MultiSubTitle = true;269Pe3do1.PeUserInterface.HotSpot.GridNumberY = true;270Pe3do1.PeUserInterface.HotSpot.GridNumberX = true;271Pe3do1.PeUserInterface.HotSpot.GridNumberZ = true;272 273Pe3do1.PeAnnotation.Show = true;274Pe3do1.PeAnnotation.Graph.Show = true;275Pe3do1.PeAnnotation.Graph.LeftJustificationOutside = true;276Pe3do1.PeAnnotation.Graph.SymbolObstacles = true;277Pe3do1.PeFont.GraphAnnotationTextSize = 86;278Pe3do1.PeUserInterface.HotSpot.GraphAnnotation = true;279Pe3do1.PePlot.Option.DegreePrompting = true;280 281Pe3do1.PeAnnotation.Graph.SubsetObstacles[0] = true;282Pe3do1.PeAnnotation.Graph.SubsetObstacles[1] = true;283Pe3do1.PeAnnotation.Graph.SubsetObstacles[2] = true;284Pe3do1.PeAnnotation.Graph.SubsetObstacles[3] = true;285Pe3do1.PeAnnotation.Graph.SubsetObstacles[4] = true;286Pe3do1.PeAnnotation.Graph.SubsetObstacles[5] = true;287Pe3do1.PeAnnotation.Graph.SubsetObstacles[6] = true;288Pe3do1.PeAnnotation.Graph.SubsetObstacles[7] = true;289Pe3do1.PeAnnotation.Graph.SubsetObstacles[8] = true;290Pe3do1.PeAnnotation.Graph.SubsetObstacles[9] = true;291 292Pe3do1.PeUserInterface.Menu.ShowAnnotations = MenuControl.Show;293Pe3do1.PeUserInterface.Menu.AnnotationControl = true;294 295Pe3do1.PeUserInterface.Menu.CustomMenuText[0] = "Zoom Rotate on Center ";296Pe3do1.PeUserInterface.Menu.CustomMenuState[0, 0] = CustomMenuState.Checked;297Pe3do1.PeUserInterface.Menu.CustomMenuLocation[0] = CustomMenuLocation.AboveSeparator;298Pe3do1.PeString.MultiSubTitles[1] = "Key 0-9 rotates/zooms at annotation| |Popup Menu size/hide annotation text.";299 300// Set a default ViewingAt location.301float x, y, z;302x = (float)Pe3do1.PeAnnotation.Graph.X[0];303y = (float)Pe3do1.PeAnnotation.Graph.Y[0];304z = (float)Pe3do1.PeAnnotation.Graph.Z[0];305Pe3do1.PeFunction.SetViewingAt(x, y, z);306 307// Set subset labels and titles //308Pe3do1.PeString.SubsetLabels[0] = "Data 1";309Pe3do1.PeString.SubsetLabels[1] = "Data 2";310Pe3do1.PeString.SubsetLabels[2] = "Data 3";311Pe3do1.PeString.SubsetLabels[3] = "Data 4";312Pe3do1.PeString.SubsetLabels[4] = "Data 5";313Pe3do1.PeString.SubsetLabels[5] = "Data 6";314Pe3do1.PeString.SubsetLabels[6] = "Data 7";315Pe3do1.PeString.SubsetLabels[7] = "Data 8";316Pe3do1.PeString.SubsetLabels[8] = "Data 9";317Pe3do1.PeString.SubsetLabels[9] = "Data 10";318 319Pe3do1.PeString.SubTitle = "||Mouse Wheel zooms. Mouse Drag rotates. Mouse Drag+SHIFT shifts image. ";320Pe3do1.PeString.MultiSubTitles[0] = "||Double Click start/stop Rotation. Mouse Drag+MIDDLE rotates light. ";321 322// Set Plotting methods //323Pe3do1.PePlot.Method = 0; // Points324 325// Set legend location //326Pe3do1.PeLegend.Location = LegendLocation.Right;327Pe3do1.PeLegend.Show = true;328Pe3do1.PeUserInterface.Menu.LegendLocation = MenuControl.Show;329 330// Prepare images in memory //331Pe3do1.PeConfigure.CacheBmp = true;332Pe3do1.PeConfigure.PrepareImages = true;333Pe3do1.PeUserInterface.Allow.FocalRect = false;334 335Pe3do1.PeConfigure.TextShadows = TextShadows.BoldText;336Pe3do1.PeFont.Label.Bold = true;337Pe3do1.PeColor.GraphForeground = Color.FromArgb(255, 229, 229, 229);338 339// Set various export defaults //340Pe3do1.PeSpecial.DpiX = 600;341Pe3do1.PeSpecial.DpiY = 600;342 343// default export setting //344Pe3do1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel;345Pe3do1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png;346Pe3do1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard;347Pe3do1.PeUserInterface.Dialog.ExportUnitXDef = "1280";348Pe3do1.PeUserInterface.Dialog.ExportUnitYDef = "768";349Pe3do1.PeUserInterface.Dialog.ExportImageDpi = 300;350Pe3do1.PeUserInterface.Dialog.AllowEmfExport = false;351Pe3do1.PeUserInterface.Dialog.AllowWmfExport = false;352 353Pe3do1.PeConfigure.AntiAliasGraphics = false; // for non 3dx354Pe3do1.PeConfigure.AntiAliasText = true;355 356Pe3do1.PeUserInterface.Menu.DataShadow = MenuControl.Show;357Pe3do1.PeUserInterface.Cursor.PromptTracking = true;358Pe3do1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.XYZValues;359 360Pe3do1.PePlot.Option.LightStrength = .65F;361Pe3do1.PeUserInterface.Cursor.HighlightColor = Color.FromArgb(255, 255, 0, 0);362 363Pe3do1.PeConfigure.RenderEngine = RenderEngine.Direct3D;364 365Pe3do1.PeFunction.Force3dxVerticeRebuild = true;366Pe3do1.PeFunction.Force3dxAnnotVerticeRebuild = true;367 368Pe3do1.PeFunction.ReinitializeResetImage();369Pe3do1.Invalidate();370Pe3do1.Refresh();371 372/*373/////////////////////////////374// MouseMove event handler //375/////////////////////////////376private void Pe3do1_MouseMove(object sender, MouseEventArgs e)377{378 Gigasoft.ProEssentials.Structs.HotSpotData ds = Pe3do1.PeFunction.GetHotSpot();379 380 // get ydata value at hot spot //381 if (ds.Type == HotSpotType.DataPoint)382 {383 this.Text = "DataPoint value " + Pe3do1.PeData.Y[ds.Data1, ds.Data2].ToString() + " s=" + ds.Data1.ToString() + " p=" + ds.Data2.ToString();384 // or to get the interpolated value under the mouse385 //this.Text = "DataPoint value " + Pe3do1.PeUserInterface.Cursor.CursorValueY.ToString() + " s=" + ds.Data1.ToString() + " p=" + ds.Data2.ToString();386 }387}388*/Pego1.PeData.Y[s, p]Click underlined properties to view documentation