Example 026: Graph showing Table Annotations, Simple

PegoGraph Objectintermediate

Table Annotations, Simple

Preview

ProEssentials Pego Graph Object - Graph showing Table Annotations, Simple
Click to enlarge

Source Code

Form2.cs
1// This example builds upon the basic CreateSimpleGraph '000' example chart //
2CreateSimpleGraph(Pego1);
3
4// Construct a simple table annotation //
5Pego1.PeAnnotation.Table.Working = 0;
6Pego1.PeAnnotation.Table.Rows = 4;
7Pego1.PeAnnotation.Table.Columns = 7;
8Pego1.PeAnnotation.Table.TextSize = 95;
9
10// Pass the table text //
11Pego1.PeAnnotation.Table.Text[1, 0] = " 1 ";
12Pego1.PeAnnotation.Table.Text[2, 0] = " 2 ";
13Pego1.PeAnnotation.Table.Text[3, 0] = " 3 ";
14
15Pego1.PeAnnotation.Table.Text[0, 1] = "Try not ";
16Pego1.PeAnnotation.Table.Text[0, 2] = "... ";
17Pego1.PeAnnotation.Table.Text[0, 3] = "Do ";
18Pego1.PeAnnotation.Table.Text[0, 4] = "... ";
19Pego1.PeAnnotation.Table.Text[0, 5] = "or ";
20Pego1.PeAnnotation.Table.Text[0, 6] = "Do not ";
21
22int r, c;
23for(r=1; r<4; r++)
24{
25 for(c=1; c<7; c++)
26 {
27 Pego1.PeAnnotation.Table.Text[r, c] = String.Format( "{0:###0.000}",(System.Math.Sin(0.3 * c + 1) * 500.0) + ((float)(Rand_Num.NextDouble()) * 50));
28 Pego1.PeAnnotation.Table.Color[r, c] = Color.FromArgb(255, 0, 0, 0);
29 }
30}
31
32// Other Table Related Properties ///
33Pego1.PeAnnotation.Table.Show = true;
34Pego1.PeAnnotation.Table.Location = GraphTALocation.InsideTopLeft;
35Pego1.PeAnnotation.Table.BackColor = Color.FromArgb(5, 150, 150, 150);
36Pego1.PeAnnotation.Table.GradientStyle = PlotGradientStyle.VerticalAscent;
37Pego1.PeAnnotation.Table.GradientColor = Color.White;
38Pego1.PeAnnotation.Table.BevelStyle = BevelStyle.ThinSmooth;
39Pego1.PeAnnotation.Table.Border = TABorder.NoBorder;
40
41Pego1.PeAnnotation.Table.HeaderRows = 1;
42Pego1.PeAnnotation.Table.HeaderColumn = true;
43
44// Construct a second simple table annotation //
45Pego1.PeAnnotation.Table.Working = 1;
46Pego1.PeAnnotation.Table.TextSize = 95;
47
48Pego1.PeAnnotation.Table.Rows = 15;
49Pego1.PeAnnotation.Table.Columns = 2;
50
51// Pass the table text //
52Pego1.PeAnnotation.Table.Text[0, 0] = "";
53Pego1.PeAnnotation.Table.Text[0, 1] = "Data";
54Pego1.PeAnnotation.Table.Justification[0, 0] = TAJustification.Center;
55Pego1.PeAnnotation.Table.Justification[0, 1] = TAJustification.Center;
56
57// First Column Text //
58for(r=1; r<=14; r++)
59 Pego1.PeAnnotation.Table.Text[r, 0] = r.ToString();
60
61// Second Column Text //
62for(r=1; r<=14; r++)
63 Pego1.PeAnnotation.Table.Text[r, 1] = String.Format( "{0:###.00}",(System.Math.Sin(0.3 * r + 1) * 500.0) + ((float)(Rand_Num.NextDouble()) * 50) );
64
65// Other Table Related Properties //
66Pego1.PeAnnotation.Table.Show = true;
67Pego1.PeAnnotation.Table.Location = GraphTALocation.LeftCenter;
68Pego1.PeAnnotation.Table.BackColor = Color.FromArgb(50, 155, 155, 155);
69Pego1.PeAnnotation.Table.BevelStyle = BevelStyle.ThinSmooth;
70Pego1.PeAnnotation.Table.Border = TABorder.NoBorder;
71
72Pego1.PeAnnotation.Table.HeaderRows = 1;
73Pego1.PeAnnotation.Table.HeaderColumn = true;
74
75// Done setting Table Annotations ///
76
77// Set Various Other Properties ///
78Pego1.PeColor.BitmapGradientMode = true;
79Pego1.PeColor.QuickStyle = QuickStyle.LightNoBorder;
80Pego1.PeData.Precision = 0;
81Pego1.PeGrid.InFront = true;
82Pego1.PePlot.Method = GraphPlottingMethod.PointsPlusLine;
83
84Pego1.PeFunction.ReinitializeResetImage();
85Pego1.Invalidate();
86// 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