Example 141: Scientific Graph showing Second Contour Legend

PesgoScientific Graph Objectintermediate

Second Contour Legend

Preview

ProEssentials Pesgo Scientific Graph Object - Scientific Graph showing Second Contour Legend
Click to enlarge

Source Code

Form3.cs
1//! Showing a secondary contour legend to show color range for 3rd dimension of data or annotation.
2
3CreateSimpleSGraph(Pesgo1);
4
5int nColor = 0;
6for (int i = 0; i < Pesgo1.PeData.Points; i++)
7{
8 nColor = nColor + 4;
9 if (nColor > 200) { nColor = 0; }
10
11 Pesgo1.PePlot.PointColors[0, i] = MainWindow.MyColors[nColor];
12}
13
14Pesgo1.PePlot.PointSize = PointSize.Small;
15Pesgo1.PePlot.Option.MinimumPointSize = (MinimumPointSize)4;
16Pesgo1.PePlot.Option.MaximumPointSize = (MinimumPointSize)8;
17
18Pesgo1.PePlot.SubsetPointTypes[0] = PointType.SquareSolid;
19Pesgo1.PePlot.SubsetPointTypes[1] = PointType.SquareSolid;
20Pesgo1.PePlot.SubsetPointTypes[2] = PointType.SquareSolid;
21Pesgo1.PePlot.SubsetPointTypes[3] = PointType.SquareSolid;
22
23Pesgo1.PePlot.Method = SGraphPlottingMethod.PointsPlusLine;
24Pesgo1.PeColor.PointColorPoints = PointsAndOrLines.LinesColored; // v10
25Pesgo1.PePlot.Option.PointGradientStyle = PlotGradientStyle.NoGradient;
26
27// v10 New secondary contour legend properties //
28
29Pesgo1.PeLegend.ContourLegendII.ManualContourScaleControl = ManualScaleControl.MinMax;
30Pesgo1.PeLegend.ContourLegendII.ManualContourMin = 100;
31Pesgo1.PeLegend.ContourLegendII.ManualContourMax = 600;
32
33Pesgo1.PeLegend.ContourLegendII.SubsetColors.Clear();
34for (int i = 0; i < 100; i++)
35{
36 Pesgo1.PeLegend.ContourLegendII.SubsetColors[i] = MainWindow.MyColors[i * 2];
37}
38
39Pesgo1.PeLegend.ContourLegendII.ContourLegendPrecision = ContourLegendPrecision.ZeroDecimals;
40Pesgo1.PeLegend.ContourLegendII.ShowContourLegend = ShowContourLegendII.SecondPlusFirst;
41Pesgo1.PeLegend.Location = LegendLocation.Left;
42
43Pesgo1.PeLegend.ContourLegendII.ContourLegendTitle = "3rd Dimension";
44
45Pesgo1.PeLegend.ContourLegendII.ManualContourLine = 5; // may help to define a frequency or common denominator for contour legend labels.
46
47// Generally call ReinitializeResetImage at end **'
48Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;
49Pesgo1.PeFunction.ReinitializeResetImage();
50Pesgo1.Invalidate();
51// 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