Example 014: Graph showing use of PEgethotspot

PegoGraph Objectadvanced

Use of PEgethotspot

Preview

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

Source Code

Form2.cs
1//! Move mouse over subset legends, point labels, or data points
2//! and watch title bar.
3
4// This example builds upon the basic CreateSimpleGraph '000' example chart //
5CreateSimpleGraph(Pego1);
6
7// Enable some various hot spots //
8Pego1.PeUserInterface.HotSpot.Data = true;
9Pego1.PeUserInterface.HotSpot.Subset = true;
10Pego1.PeUserInterface.HotSpot.Point = true;
11Pego1.PeUserInterface.HotSpot.Size = HotSpotSize.Large;
12
13Pego1.PePlot.Method = GraphPlottingMethod.PointsPlusSpline;
14Pego1.PePlot.ComparisonSubsets = 2;
15Pego1.PePlot.MethodII = GraphPlottingMethodII.PointsPlusLine;
16Pego1.PePlot.MarkDataPoints = false;
17
18Pego1.PeUserInterface.Cursor.PromptTracking = true;
19Pego1.PeUserInterface.Cursor.TrackingCustomDataText = true;
20
21// Generally call ReinitializeResetImage at end **'
22Pego1.PeFunction.ReinitializeResetImage();
23Pego1.Invalidate();
24// Optionally call Pego1.Refresh() if you are not seeing changes immediately
25
26/*///////////////////////////////////////////////
27// Example MouseMove event handler //
28/////////////////////////////////////
29
30void Pego1_MouseMove(object sender, MouseEventArgs e)
31{
32 Gigasoft.ProEssentials.Structs.HotSpotData ds = Pego1.PeFunction.GetHotSpot();
33
34 if (ds.Type == HotSpotType.DataPoint)
35 this.Title = "DataPoint value " + Pego1.PeData.Y[extra1, extra2].ToString();
36 else if (ds.Type == HotSpotType.Subset)
37 this.Title = "Subset Legend is " + Pego1.PeString.SubsetLabels[extra1];
38 else if (ds.Type == HotSpotType.Point)
39 this.Title = "Point Label is " + Pego1.PeString.PointLabels[extra1];
40 else
41 {
42 System.Drawing.Point pt = Pego1.PeUserInterface.Cursor.LastMouseMove;
43 System.Drawing.Point p = Pego1.PeFunction.SearchSubsetPointIndex(pt.X, pt.Y);
44 if (p.X >= 0)
45 {
46 string s = String.Format("Closest Subset Point s={0}", p.X);
47 s += String.Format(", p={0}", p.Y);
48 this.Text = s;
49 }
50 else
51 this.Text = "No Hot Spot";
52 }
53}
54
55*/
Tip: Uses property syntax like Pego1.PeData.Y[s, p]Click underlined properties to view documentation