Example 008: Graph showing use of PointColors

PegoGraph Objectintermediate

Use of PointColors

Preview

ProEssentials Pego Graph Object - Graph showing use of PointColors
Click to enlarge

Source Code

Form2.cs
1//! Right button click to show popup menu. //
2//! Double Click to show customization dialog. //
3//! Vertical scroll bar revolves through subsets. //
4
5// This example builds upon the basic CreateSimpleGraph '000' example chart //
6CreateSimpleGraph(Pego1);
7
8// Now to control color on per point basis, we use the
9// PointColors property array to assign a color to each piece of YData.
10int s, p;
11for( s = 0; s <= 3; s++)
12{
13 for( p = 0; p <= 11; p++)
14 {
15 if (s == 0)
16 Pego1.PePlot.PointColors[s, p] = Color.FromArgb(55, (byte) (15 + ((p + 1) * 20)), 0, 0);
17 else if (s == 1)
18 Pego1.PePlot.PointColors[s, p] = Color.FromArgb(55, 0, (byte) (15 + ((p + 1) * 20)), 0);
19 else if (s == 2)
20 Pego1.PePlot.PointColors[s, p] = Color.FromArgb(55, 0, 0, (byte) (15 + ((p + 1) * 20)));
21 else if(s == 3)
22 Pego1.PePlot.PointColors[s, p] = Color.FromArgb(55, 0, (byte) (15 + ((p + 1) * 20)), (byte) (15 + ((p + 1) * 20)));
23 }
24}
25
26// Set SubsetColor to match brightest PointColor for each subset //
27Pego1.PeColor.SubsetColors[0] = MainWindow.DemoColors[0];
28Pego1.PeColor.SubsetColors[1] = MainWindow.DemoColors[1];
29Pego1.PeColor.SubsetColors[2] = MainWindow.DemoColors[2];
30Pego1.PeColor.SubsetColors[3] = MainWindow.DemoColors[3];
31
32// Show 1 subset at a time //
33Pego1.PeUserInterface.Scrollbar.ScrollingSubsets = 1;
34
35Pego1.PeTable.What = TableWhat.AllSubsets;
36Pego1.PeFont.FontSize = FontSize.Medium;
37
38// Add a table //
39Pego1.PeTable.Show = GraphPlusTable.Both;
40Pego1.PeData.Precision = 0;
41
42// Slant the Point Labels //
43Pego1.PeGrid.ForceVerticalPoints = ForceVerticalPoints.Slanted;
44
45Pego1.PePlot.Method = GraphPlottingMethod.Bar;
46Pego1.PePlot.DataShadows = DataShadows.ThreeDimensional;
47Pego1.PePlot.Option.BarBevelStyle = BevelStyle.ThickSmooth;
48
49Pego1.PeColor.BitmapGradientMode = true;
50Pego1.PeColor.QuickStyle = QuickStyle.DarkInset;
51
52// Generally call ReinitializeResetImage at end **'
53Pego1.PeFunction.ReinitializeResetImage();
54Pego1.Invalidate();
55// 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