Example 135: Scientific Graph showing millisecond date time handling

PesgoScientific Graph Objectintermediate

Millisecond date time handling

Preview

ProEssentials Pesgo Scientific Graph Object - Scientific Graph showing millisecond date time handling
Click to enlarge

Source Code

Form3.cs
1double d, dt;
2int p;
3dt = DateTime.Now.ToOADate();
4
5Pesgo1.PeData.Subsets = 1;
6Pesgo1.PeData.Points = 600;
7
8// v9 features new default CursorPromptLocation = ToolTip
9Pesgo1.PeUserInterface.Cursor.PromptTracking = true;
10Pesgo1.PeUserInterface.Cursor.PromptLocation = CursorPromptLocation.ToolTip;
11Pesgo1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.XYValues;
12
13// Enable double precision which is usually //
14// required for date time handling. //
15// This means we pass x data to XDataII //
16Pesgo1.PeData.UsingXDataii = true;
17
18// Pass XDataII and YData //
19for (p = 0; p <= 599; p++)
20{
21 d = (dt + .5F + ((double)p * 0.0000025F));
22 Pesgo1.PeData.Xii[0, p] = d;
23 Pesgo1.PeData.Y[0, p] = (float)((150 + (Math.Sin(p * 0.034) * 60) + (Rand_Num.NextDouble() * 30) + (p / 2)) - (35 + (Rand_Num.NextDouble() * 20)));
24}
25
26// Enable DateTimeMode //
27Pesgo1.PeData.DateTimeMode = true;
28Pesgo1.PeData.DateTimeShowSeconds = true;
29Pesgo1.PeData.DateTimeMilliSeconds = true;
30
31// Allow zooming and panning //
32Pesgo1.PeUserInterface.Allow.Zooming = AllowZooming.Horizontal;
33Pesgo1.PeUserInterface.Scrollbar.ScrollingHorzZoom = true;
34
35// Cursor prompting in top left corner //
36Pesgo1.PeUserInterface.Cursor.Mode = CursorMode.DataSquare;
37Pesgo1.PeUserInterface.Cursor.PromptStyle = CursorPromptStyle.XYValues;
38Pesgo1.PeFont.SizeCursorPromptCntl = 1.5F;
39Pesgo1.PeUserInterface.HotSpot.Data = true;
40Pesgo1.PeUserInterface.Cursor.MouseCursorControl = true;
41Pesgo1.PeGrid.Configure.AutoMinMaxPaddingX = 1;
42
43// Enable middle mouse dragging //
44Pesgo1.PeUserInterface.Scrollbar.MouseDraggingX = true;
45Pesgo1.PeUserInterface.Scrollbar.MouseDraggingY = true;
46
47// Enable Plotting style gradient and bevel features //
48Pesgo1.PePlot.Option.AreaGradientStyle = PlotGradientStyle.RadialBottomRight;
49Pesgo1.PePlot.Option.AreaBevelStyle = BevelStyle.MediumSmooth;
50Pesgo1.PePlot.Option.SplineGradientStyle = PlotGradientStyle.RadialBottomRight;
51Pesgo1.PePlot.Option.SplineBevelStyle = SplineBevelStyle.MediumSmooth;
52
53// Enable ZoomWindow //
54Pesgo1.PePlot.ZoomWindow.Show = true;
55
56// Set Various Other Properties ///
57Pesgo1.PeColor.BitmapGradientMode = true;
58Pesgo1.PeColor.QuickStyle = QuickStyle.DarkNoBorder;
59Pesgo1.PeUserInterface.Allow.FocalRect = false;
60Pesgo1.PeConfigure.PrepareImages = true;
61Pesgo1.PePlot.MarkDataPoints = true;
62Pesgo1.PeConfigure.CacheBmp = true;
63Pesgo1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not;
64
65// subset colors //
66Pesgo1.PeColor.SubsetColors[0] = Color.FromArgb(100, 40, 210, 200);
67
68Pesgo1.PeConfigure.TextShadows = TextShadows.BoldText;
69Pesgo1.PeFont.MainTitle.Bold = true;
70Pesgo1.PeFont.SubTitle.Bold = true;
71Pesgo1.PeFont.Label.Bold = true;
72Pesgo1.PePlot.Option.LineShadows = true;
73Pesgo1.PeFont.FontSize = FontSize.Large;
74Pesgo1.PeFont.SizeGlobalCntl = 1.4F;
75Pesgo1.PeFont.Fixed = true;
76Pesgo1.PeUserInterface.Scrollbar.ScrollingHorzZoom = true;
77
78Pesgo1.PePlot.Method = SGraphPlottingMethod.Line;
79Pesgo1.PePlot.SubsetLineTypes[0] = LineType.MediumThickSolid;
80Pesgo1.PeString.MainTitle = "";
81Pesgo1.PeString.SubTitle = " ";
82Pesgo1.PeGrid.Style = GridStyle.Dot;
83
84// Set various export defaults //
85Pesgo1.PeSpecial.DpiX = 600;
86Pesgo1.PeSpecial.DpiY = 600;
87
88// default export setting //
89Pesgo1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel;
90Pesgo1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png;
91Pesgo1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard;
92Pesgo1.PeUserInterface.Dialog.ExportUnitXDef = "1280";
93Pesgo1.PeUserInterface.Dialog.ExportUnitYDef = "768";
94Pesgo1.PeUserInterface.Dialog.ExportImageDpi = 300;
95
96Pesgo1.PeConfigure.RenderEngine = RenderEngine.Direct2D;
97Pesgo1.PeConfigure.AntiAliasGraphics = true;
98Pesgo1.PeConfigure.AntiAliasText = true;
99
100// Generally call ReinitializeResetImage at end **'
101Pesgo1.PeFunction.ReinitializeResetImage();
102Pesgo1.Invalidate();
103// 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