Subsets Different Points
1//! Showing use of Jagged Data, subsets with different amounts of Data.2 3// Spoon Fed, See example 143 for Block passed, See example 144 for Block pointer passed //4 5CreateSimpleSGraph(Pesgo1);6 7Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;8Pesgo1.PeData.JaggedData = true; // For now Direct3D does not support JaggedData, only use with Direct2D.9 10// Change Data //11Pesgo1.PeData.Subsets = 4;12Pesgo1.PeData.Points = 1; // When JaggedData = True, when chart calls PeFunction.Reinitialize(), Points property will automatically set to the maximum of any subset13 14Pesgo1.PeString.SubsetLabels[0] = "12000 Points";15Pesgo1.PeString.SubsetLabels[1] = "1200 Points";16Pesgo1.PeString.SubsetLabels[2] = "120 Points";17Pesgo1.PeString.SubsetLabels[3] = "12 Points";18 19Pesgo1.PePlot.Bitmaps.WorkingBitmap = 0;20Pesgo1.PePlot.Bitmaps.Filename = "symbolBlueDot.png"; // Define a blue dot symbol bitmap resource21Pesgo1.PePlot.Bitmaps.Style = ResourceBitmapStyle.SmallCentered; // bitmap symbols plot faster though vector output is not poosible22Pesgo1.PePlot.SubsetPointTypes[0] = (PointType)10001; // set to WorkingBitmap 0, 10001 + Working Bitmap Index23 24Pesgo1.PeUserInterface.Dialog.AllowWmfExport = false;25Pesgo1.PeUserInterface.Dialog.AllowEmfExport = false;26Pesgo1.PeUserInterface.Dialog.Style = false;27 28Pesgo1.PePlot.DataShadows = DataShadows.None;29 30// One method of pre-allocating memory (to bypass overhead of testing range and avoid reallocations while spoon feeding)31// Set the last data point first, address the last expected PointIndex for each SubsetIndex32 33Pesgo1.PeData.X[0, 11999] = 0;34Pesgo1.PeData.Y[0, 11999] = 0;35 36Pesgo1.PeData.X[1, 1199] = 0;37Pesgo1.PeData.Y[1, 1199] = 0;38 39Pesgo1.PeData.X[2, 119] = 0;40Pesgo1.PeData.Y[2, 119] = 0;41 42Pesgo1.PeData.X[3, 11] = 0;43Pesgo1.PeData.Y[3, 11] = 0;44 45// Second method of pre-allocating memory46// New Functions SetJaggedPointsX SetJaggedPointsY47 48Pesgo1.PeData.SetJaggedPointsX(0, 12000);49Pesgo1.PeData.SetJaggedPointsY(0, 12000);50 51Pesgo1.PeData.SetJaggedPointsX(1, 1200);52Pesgo1.PeData.SetJaggedPointsY(1, 1200);53 54Pesgo1.PeData.SetJaggedPointsX(2, 120);55Pesgo1.PeData.SetJaggedPointsY(2, 120);56 57Pesgo1.PeData.SetJaggedPointsX(3, 12);58Pesgo1.PeData.SetJaggedPointsY(3, 12);59 60// Above code has pre-allocated memory for both X and Y Data, note this is not required when using PeData.X Y[s,p]61// but can help for large data sets, but large data are best set with PEvsetEx via a block of memory as in example 143.62 63// If a subset will have very few points, consider plotting this data as a GraphAnnotation (demo example 015)64 65int nSize = Pesgo1.PeData.GetJaggedPointsY(0);66 67// Spoon Feeding data68 69int s = 0;70int nOffset = (int)(Rand_Num.NextDouble() * 250);71for (int p = 0; p < 12000; p++)72{73 Pesgo1.PeData.X[s, p] = (float)((p + 1) * 0.1F);74 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));75}76 77s = 1;78nOffset = (int)(Rand_Num.NextDouble() * 250);79for (int p = 0; p < 1200; p++)80{81 Pesgo1.PeData.X[s, p] = (float)((p + 1) * 1.0F);82 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));83}84 85s = 2;86nOffset = (int)(Rand_Num.NextDouble() * 250);87for (int p = 0; p < 120; p++)88{89 Pesgo1.PeData.X[s, p] = (float)((p + 1) * 10.0F);90 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));91}92 93s = 3;94nOffset = (int)(Rand_Num.NextDouble() * 250);95for (int p = 0; p < 12; p++)96{97 Pesgo1.PeData.X[s, p] = (float)((p + 1) * 100.0F);98 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));99}100 101// Generally call ReinitializeResetImage at end **'102Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;103Pesgo1.PeFunction.ReinitializeResetImage();104Pesgo1.Invalidate();105// Optionally call Pesgo1.Refresh() if you are not seeing changes immediatelyPego1.PeData.Y[s, p]Click underlined properties to view documentation