Example 101: Scientific Graph showing line annotations

PesgoScientific Graph Objectintermediate

Line annotations

Preview

ProEssentials Pesgo Scientific Graph Object - Scientific Graph showing line annotations
Click to enlarge

Source Code

Form3.cs
1//! Right button click to show popup menu. //
2//! Double Click to show customization dialog. //
3
4// This example builds upon the basic CreateSimpleSGraph '100' example chart //
5CreateSimpleSGraph(Pesgo1);
6
7// Create MultiAxes //
8Pesgo1.PeGrid.MultiAxesSubsets[0] = 2;
9Pesgo1.PeGrid.MultiAxesSubsets[1] = 2;
10Pesgo1.PeUserInterface.Allow.MultiAxesSizing = true;
11
12Pesgo1.PeGrid.WorkingAxis = 0; // Set first y axis parameters
13Pesgo1.PeString.YAxisLabel = "";
14Pesgo1.PePlot.Method = SGraphPlottingMethod.Bar;
15Pesgo1.PePlot.ComparisonSubsets = 1;
16Pesgo1.PePlot.MethodII = SGraphPlottingMethodII.PointsPlusSpline;
17
18// Plot last subset on right //
19Pesgo1.PeGrid.WorkingAxis = 1; // Set second y axis parameters
20Pesgo1.PeString.YAxisLabel = "";
21Pesgo1.PeString.RYAxisLabel = "";
22Pesgo1.PePlot.Method = SGraphPlottingMethod.Area;
23Pesgo1.PePlot.RYAxisComparisonSubsets = 1;
24Pesgo1.PeColor.RYAxis = Pesgo1.PeColor.SubsetColors[3];
25Pesgo1.PeGrid.WorkingAxis = 0;
26
27// v9.5
28Pesgo1.PeUserInterface.Menu.AnnotationControl = true;
29Pesgo1.PeUserInterface.Menu.ShowAnnotationText = MenuControl.Show;
30Pesgo1.PeAnnotation.ShowAnnotationText = true;
31
32Pesgo1.PeAnnotation.InFront = false;
33Pesgo1.PeAnnotation.Line.TextSize = 110;
34Pesgo1.PeAnnotation.Show = true;
35
36/////////////////////////////////
37// Horizontal Line Annotations //
38/////////////////////////////////
39Pesgo1.PeAnnotation.Line.YAxis[0] = 820;
40Pesgo1.PeAnnotation.Line.YAxisType[0] = LineAnnotationType.MediumDash;
41Pesgo1.PeAnnotation.Line.YAxisColor[0] = Color.FromArgb(255, 198, 0, 0);
42Pesgo1.PeAnnotation.Line.YAxisText[0] = "";
43Pesgo1.PeAnnotation.Line.YAxisAxis[0] = 0;
44Pesgo1.PeAnnotation.Line.YAxisInFront[0] = AnnotationInFront.InFront;
45
46Pesgo1.PeAnnotation.Line.YAxis[1] = 780;
47Pesgo1.PeAnnotation.Line.YAxisType[1] = LineAnnotationType.Dash;
48Pesgo1.PeAnnotation.Line.YAxisColor[1] = Color.FromArgb(255, 0, 198, 0);
49Pesgo1.PeAnnotation.Line.YAxisText[1] = "";
50Pesgo1.PeAnnotation.Line.YAxisAxis[1] = 0;
51
52Pesgo1.PeAnnotation.Line.YAxis[2] = 740;
53Pesgo1.PeAnnotation.Line.YAxisType[2] = LineAnnotationType.Dot;
54Pesgo1.PeAnnotation.Line.YAxisColor[2] = Color.FromArgb(255, 0, 0, 198);
55Pesgo1.PeAnnotation.Line.YAxisText[2] = "";
56Pesgo1.PeAnnotation.Line.YAxisAxis[2] = 0;
57
58Pesgo1.PeAnnotation.Line.YAxis[3] = 700;
59Pesgo1.PeAnnotation.Line.YAxisType[3] = LineAnnotationType.MediumThickSolid;
60Pesgo1.PeAnnotation.Line.YAxisColor[3] = Color.FromArgb(255, 198, 0, 198);
61Pesgo1.PeAnnotation.Line.YAxisText[3] = "";
62Pesgo1.PeAnnotation.Line.YAxisAxis[3] = 0;
63
64Pesgo1.PeAnnotation.Line.YAxis[4] = 760;
65Pesgo1.PeAnnotation.Line.YAxisType[4] = LineAnnotationType.ThickSolid;
66Pesgo1.PeAnnotation.Line.YAxisColor[4] = Color.FromArgb(255, 0, 198, 198);
67Pesgo1.PeAnnotation.Line.YAxisText[4] = "";
68Pesgo1.PeAnnotation.Line.YAxisAxis[4] = 0;
69
70// Set right margin to the longest string on right //
71Pesgo1.PeAnnotation.Line.RightMargin = "String ";
72
73Pesgo1.PeAnnotation.Line.YAxis[5] = 720;
74Pesgo1.PeAnnotation.Line.YAxisType[5] = LineAnnotationType.ThickSolid;
75Pesgo1.PeAnnotation.Line.YAxisColor[5] = Color.FromArgb(255, 198, 0, 0);
76Pesgo1.PeAnnotation.Line.YAxisText[5] = "|RTest" + '\n' + "String";
77Pesgo1.PeAnnotation.Line.YAxisAxis[5] = 0;
78
79// Line annotations on bottom axis //
80Pesgo1.PeAnnotation.Line.YAxis[6] = 535;
81Pesgo1.PeAnnotation.Line.YAxisType[6] = LineAnnotationType.ThinSolid;
82Pesgo1.PeAnnotation.Line.YAxisColor[6] = Color.FromArgb(255, 198, 0, 198);
83Pesgo1.PeAnnotation.Line.YAxisText[6] = "Bottom multi-axis with respect to left y axis";
84Pesgo1.PeAnnotation.Line.YAxisAxis[6] = 1;
85
86// Line annotation with respect to right y axis //
87Pesgo1.PeAnnotation.Line.YAxis[7] = 475;
88Pesgo1.PeAnnotation.Line.YAxisType[7] = LineAnnotationType.ThickSolid + 1000;
89Pesgo1.PeAnnotation.Line.YAxisColor[7] = Color.FromArgb(255, 0, 198, 198);
90Pesgo1.PeAnnotation.Line.YAxisText[7] = "|rBottom multi-axis with respect to right y axis";
91Pesgo1.PeAnnotation.Line.YAxisAxis[7] = 1;
92
93///////////////////////////////
94// Vertical Line Annotations //
95///////////////////////////////
96
97Pesgo1.PeAnnotation.Line.XAxis[0] = 8200;
98Pesgo1.PeAnnotation.Line.XAxisType[0] = LineAnnotationType.MediumDash;
99Pesgo1.PeAnnotation.Line.XAxisColor[0] = Color.FromArgb(255, 198, 0, 0);
100Pesgo1.PeAnnotation.Line.XAxisText[0] = "";
101Pesgo1.PeAnnotation.Line.XAxisInFront[0] = AnnotationInFront.InFront;
102
103Pesgo1.PeAnnotation.Line.XAxis[1] = 7800;
104Pesgo1.PeAnnotation.Line.XAxisType[1] = LineAnnotationType.Dash;
105Pesgo1.PeAnnotation.Line.XAxisColor[1] = Color.FromArgb(255, 0, 198, 0);
106Pesgo1.PeAnnotation.Line.XAxisText[1] = "";
107
108Pesgo1.PeAnnotation.Line.XAxis[2] = 7400;
109Pesgo1.PeAnnotation.Line.XAxisType[2] = LineAnnotationType.Dot;
110Pesgo1.PeAnnotation.Line.XAxisColor[2] = Color.FromArgb(255, 0, 0, 198);
111Pesgo1.PeAnnotation.Line.XAxisText[2] = "";
112
113Pesgo1.PeAnnotation.Line.XAxis[3] = 7000;
114Pesgo1.PeAnnotation.Line.XAxisType[3] = LineAnnotationType.MediumThickSolid;
115Pesgo1.PeAnnotation.Line.XAxisColor[3] = Color.FromArgb(255, 198, 0, 198);
116Pesgo1.PeAnnotation.Line.XAxisText[3] = "";
117
118Pesgo1.PeAnnotation.Line.XAxis[4] = 7600;
119Pesgo1.PeAnnotation.Line.XAxisType[4] = LineAnnotationType.ThickSolid;
120Pesgo1.PeAnnotation.Line.XAxisColor[4] = Color.FromArgb(255, 0, 198, 198);
121Pesgo1.PeAnnotation.Line.XAxisText[4] = "";
122
123// Set top margin to the longest annotation string on top //
124Pesgo1.PeAnnotation.Line.TopMargin = " XX";
125
126Pesgo1.PeAnnotation.Line.XAxis[5] = 7200;
127Pesgo1.PeAnnotation.Line.XAxisType[5] = LineAnnotationType.ThickSolid;
128Pesgo1.PeAnnotation.Line.XAxisColor[5] = Color.FromArgb(255, 198, 0, 0);
129Pesgo1.PeAnnotation.Line.XAxisText[5] = "|HTest" + '\n' + "String";
130
131// Line annotations with top justified text //
132Pesgo1.PeAnnotation.Line.XAxis[6] = 5350;
133Pesgo1.PeAnnotation.Line.XAxisType[6] = LineAnnotationType.ThinSolid;
134Pesgo1.PeAnnotation.Line.XAxisColor[6] = Color.FromArgb(255, 198, 0, 198);
135Pesgo1.PeAnnotation.Line.XAxisText[6] = "|t Top Inside ";
136
137// Line annotation with bottom justified text //
138Pesgo1.PeAnnotation.Line.XAxis[7] = 5750;
139Pesgo1.PeAnnotation.Line.XAxisType[7] = LineAnnotationType.ThickSolid;
140Pesgo1.PeAnnotation.Line.XAxisColor[7] = Color.FromArgb(255, 0, 198, 198);
141Pesgo1.PeAnnotation.Line.XAxisText[7] = "|b Bottom Inside ";
142
143// New region annotations, define a top, and bottom graph annotation type and then rect fill //
144Pesgo1.PeAnnotation.Graph.X[0] = 0; // ignored for this type
145Pesgo1.PeAnnotation.Graph.Y[0] = 1.0+20; // some value in outer space
146Pesgo1.PeAnnotation.Graph.Type[0] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.Top;
147
148Pesgo1.PeAnnotation.Graph.X[1] = 0; // ignored for this type
149Pesgo1.PeAnnotation.Graph.Y[1] = 850;
150Pesgo1.PeAnnotation.Graph.Type[1] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.Bottom;
151
152Pesgo1.PeAnnotation.Graph.X[2] = 8500; // if text define, located here
153Pesgo1.PeAnnotation.Graph.Y[2] = 850;
154Pesgo1.PeAnnotation.Graph.Type[2] = (int)Gigasoft.ProEssentials.Enums.GraphAnnotationType.RectFill;
155Pesgo1.PeAnnotation.Graph.Color[2] = Color.FromArgb(155, 234, 123, 53);
156Pesgo1.PeAnnotation.Graph.Text[2] = "";
157Pesgo1.PeAnnotation.Graph.Show = true;
158
159// Set Various Other Properties //
160Pesgo1.PeColor.SubsetColors[0] = MainWindow.DemoColors[0];
161Pesgo1.PeColor.SubsetColors[1] = MainWindow.DemoColors[1];
162Pesgo1.PeColor.SubsetColors[2] = MainWindow.DemoColors[2];
163
164Pesgo1.PeGrid.LineControl = GridLineControl.None;
165
166Pesgo1.PeColor.BitmapGradientMode = true;
167Pesgo1.PeColor.QuickStyle = QuickStyle.DarkNoBorder;
168Pesgo1.PeLegend.Style = LegendStyle.OneLineLeftOfAxis;
169
170// Generally call ReinitializeResetImage at end **'
171Pesgo1.PeFunction.ReinitializeResetImage();
172Pesgo1.Invalidate();
173// Optionally call Pego1.Refresh() if you are not seeing changes immediately
Tip: Uses property syntax like Pego1.PeData.Y[s, p]Click underlined properties to view documentation