Example 144: Scientific Graph showing Subsets Different Points 3

PesgoScientific Graph Objectintermediate

Subsets Different Points 3

Preview

ProEssentials Pesgo Scientific Graph Object - Scientific Graph showing Subsets Different Points 3
Click to enlarge

Source Code

Form3.cs
1//! Showing use of Jagged Data, subsets with different amounts of Data.
2//! Showing use of XDataPtr and YDataPtr and using local memory instead of passing data to chart.
3
4CreateSimpleSGraph(Pesgo1);
5
6Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;
7Pesgo1.PeData.JaggedData = true; // For now Direct3D does not support JaggedData, only use with Direct2D.
8
9Pesgo1.PeData.Subsets = 4;
10Pesgo1.PeData.Points = 1;
11
12Random rn = new Random();
13int i = rn.Next(4500); // randomize the start of waveform data to produce variation
14Array.Copy(MainWindow.tmpYData, i, MainWindow.wavedata, 0, 10000);
15Array.Copy(MainWindow.tmpYData, i + 125000, MainWindow.wavedata2, 0, 10000);
16Array.Copy(MainWindow.tmpYData, i + 250000, MainWindow.wavedata3, 0, 10000);
17Array.Copy(MainWindow.tmpYData, i + 375000, MainWindow.wavedata4, 0, 10000);
18
19// Note below we set one pointer for x data, and 4 pointers for y data (1 for each subset)
20
21// This examples uses one large array of memory for Y Data, but one may
22// use multiple arrays, one for each subset of y data.
23
24Pesgo1.PeData.DuplicateDataX = DuplicateData.PointIncrement;
25
26Pesgo1.PeData.X.UseJaggedDataAtLocation(MainWindow.wavedatax, 0); // only one subset because using DuplicateDataX = PointIncrement
27
28Pesgo1.PeData.Y.UseJaggedDataAtLocation(MainWindow.wavedata, 0); // plots based off local array, data not copied or transferred.
29Pesgo1.PeData.Y.UseJaggedDataAtLocation(MainWindow.wavedata2, 1);
30Pesgo1.PeData.Y.UseJaggedDataAtLocation(MainWindow.wavedata3, 2);
31Pesgo1.PeData.Y.UseJaggedDataAtLocation(MainWindow.wavedata4, 3);
32
33Pesgo1.PePlot.Bitmaps.WorkingBitmap = 0;
34Pesgo1.PePlot.Bitmaps.Filename = "symbolBlueDot.png"; // Define a blue dot symbol bitmap resource
35Pesgo1.PePlot.Bitmaps.Style = ResourceBitmapStyle.SmallCentered; // bitmap symbols plot faster though vector output is not poosible
36Pesgo1.PePlot.SubsetPointTypes[3] = (PointType)10001; // 4th subset, set to WorkingBitmap 0, 10001 + Working Bitmap Index
37Pesgo1.PePlot.Bitmaps.WorkingBitmap = 1;
38Pesgo1.PePlot.Bitmaps.Filename = "symbolRedDot.png"; // Define a blue dot symbol bitmap resource
39Pesgo1.PePlot.Bitmaps.Style = ResourceBitmapStyle.SmallCentered; // bitmap symbols plot faster though vector output is not poosible
40Pesgo1.PePlot.SubsetPointTypes[0] = (PointType)10001 + 1; // 1st subset, set to WorkingBitmap 0, 10001 + Working Bitmap Index
41Pesgo1.PePlot.Bitmaps.WorkingBitmap = 2;
42Pesgo1.PePlot.Bitmaps.Filename = "symbolPurpleDot.png"; // Define a blue dot symbol bitmap resource
43Pesgo1.PePlot.Bitmaps.Style = ResourceBitmapStyle.SmallCentered; // bitmap symbols plot faster though vector output is not poosible
44Pesgo1.PePlot.SubsetPointTypes[1] = (PointType)10001 + 2; // 2nd subset, set to WorkingBitmap 0, 10001 + Working Bitmap Index
45Pesgo1.PePlot.Bitmaps.WorkingBitmap = 3;
46Pesgo1.PePlot.Bitmaps.Filename = "symbolGreenDot.png"; // Define a blue dot symbol bitmap resource
47Pesgo1.PePlot.Bitmaps.Style = ResourceBitmapStyle.SmallCentered; // bitmap symbols plot faster though vector output is not poosible
48Pesgo1.PePlot.SubsetPointTypes[2] = (PointType)10001 + 3; // 3rd subset, set to WorkingBitmap 0, 10001 + Working Bitmap Index
49
50Pesgo1.PeUserInterface.Dialog.AllowWmfExport = false;
51Pesgo1.PeUserInterface.Dialog.AllowEmfExport = false;
52Pesgo1.PeUserInterface.Dialog.Style = false;
53
54Pesgo1.PePlot.DataShadows = DataShadows.None;
55
56Pesgo1.PePlot.Method = SGraphPlottingMethod.Line;
57
58// Generally call ReinitializeResetImage at end **'
59Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;
60Pesgo1.PeFunction.ReinitializeResetImage();
61Pesgo1.Invalidate();
62// Optionally call Pesgo1.Refresh() if you are not seeing changes immediately
Tip: Uses property syntax like Pego1.PeData.Y[s, p]Click underlined properties to view documentation