📄 frmfailuregp.cs
字号:
// of x axis changes as you zoom //
Pego1.PeUserInterface.Allow.Zooming = AllowZooming.Horizontal;
// Set various properties //
Pego1.PeConfigure.PrepareImages = true;
Pego1.PeColor.SubsetColors[0] = Color.Black;
Pego1.PePlot.DataShadows = DataShadows.None;
Pego1.PeGrid.LineControl = GridLineControl.None;
Pego1.PeUserInterface.Allow.FocalRect = false;
Pego1.PeFont.Fixed = true;
Pego1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not;
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.LightShadow;
Pego1.PePlot.Option.GradientBars = 8;
Pego1.PePlot.Option.LineShadows = true;
Pego1.PeFont.MainTitle.Bold = true;
Pego1.PeFont.SubTitle.Bold = true;
Pego1.PeFont.Label.Bold = true;
Pego1.PeConfigure.TextShadows = TextShadows.BoldText;
Pego1.PeFont.FontSize = FontSize.Large;
Pego1.PeUserInterface.Scrollbar.ScrollingScaleControl = true;
}
else if(m_nChart == 17)
{
//*********************************************************************'
//*********************************************************************'
//017 Graph showing real-time data handling
// No Flicker //
Pego1.PeConfigure.PrepareImages = true;
Pego1.PeConfigure.CacheBmp = true;
// Set Subsets and Points //
Pego1.PeData.Subsets = 2; // set number of subsets
Pego1.PeData.Points = 200; // number of data points
Pego1.PeUserInterface.Scrollbar.PointsToGraph = 20;
Pego1.PeUserInterface.Scrollbar.PointsToGraphInit = PointsToGraphInit.Last;
Pego1.PePlot.Method = GraphPlottingMethod.PointsPlusLine;
// Main Title
Pego1.PeString.MainTitle = "Graph Real Time Example";
Pego1.PeString.SubTitle = ""; // no subtitle
// Manually configure scales //
Pego1.PeGrid.Configure.ManualScaleControlY = ManualScaleControl.MinMax;
Pego1.PeGrid.Configure.ManualMinY = 1.0;
Pego1.PeGrid.Configure.ManualMaxY = 100.0;
Pego1.PeGrid.Configure.ManualMinY = 1.0;
Pego1.PeGrid.Configure.ManualMaxDataString = "000.000";
Pego1.PeGrid.Configure.ManualMaxPointLabel = "00:00:00xx";
Pego1.PePlot.Allow.StackedData = false;
Pego1.PeUserInterface.Dialog.PointsToGraph = false;
Pego1.PePlot.Allow.Histogram = false;
Pego1.PeUserInterface.Allow.FocalRect = false;
Pego1.PeGrid.LineControl = GridLineControl.None;
Pego1.PeData.Precision = DataPrecision.OneDecimal;
// Needed to allocate point labels so append logic works //
// Set last point label, Points - 1 //
Pego1.PeString.PointLabels[199] = "";
// Reset first four default data points
Pego1.PeData.Y[0, 0] = 0;
Pego1.PeData.Y[0, 1] = 0;
Pego1.PeData.Y[0, 2] = 0;
Pego1.PeData.Y[0, 3] = 0;
Pego1.PeColor.BitmapGradientMode = false;
Pego1.PeColor.QuickStyle = QuickStyle.LightShadow;
Pego1.PeFont.Fixed = true;
Pego1.PeFont.MainTitle.Bold = true;
Pego1.PeFont.SubTitle.Bold = true;
Pego1.PeFont.Label.Bold = true;
Pego1.PeConfigure.TextShadows = TextShadows.BoldText;
Pego1.PeFont.FontSize = FontSize.Large;
Timer1.Interval = 250;
Timer1.Enabled = true;
/*///////////////////////////////////////////////////////
// the following code can be found in the Timer Event //
////////////////////////////////////////////////////////
String CurrentTime;
// new point label //
CurrentTime = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
// new YData //
float[] NewData = new float[2];
NewData[0] = ((float)(Rand_Num.NextDouble()) * 20) + 2;
NewData[1] = ((float)(Rand_Num.NextDouble()) * 40) + 60;
// transfer new point label //
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.AppendPointLabelData, CurrentTime, 1);
// transfer new YData //
// this will also update and view new image //
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.AppendYData, NewData, 1);
*/
}
else if(m_nChart == 18)
{
//*********************************************************************'
//*********************************************************************'
//018 Graph showing use of PEvset
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Repass the data, this time with PEvset call //
float[] MyYData = new float[48]; // 4 * 12 = 48
Int32 o, p, s;
for(s=0; s<4; s++)
{
for(p=0; p<12; p++)
{
o = (s * 12) + p; // 12 = Points property
MyYData[o] = 5 + ((float)(Rand_Num.NextDouble()) * 10);
}
}
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.YData, MyYData, 48);
}
else if(m_nChart == 19)
{
//*********************************************************************'
//*********************************************************************'
//019 Graph showing large quantity of data
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Repass the data, this time with PEvset call //
Pego1.PeData.Subsets = 1;
Pego1.PeData.Points = 100000;
// Prepare data in temp array, make sure it is Single (4 byte floats) **'
float[] MyYData = new float[100000];
Int32 j, k;
for(j = 0; j < 100000; j++)
MyYData[j] = (float)(System.Math.Sin(0.0003 * j) * 500.0);
// Change some of the data so we can see some //'
// variations in data //'
for(j = 0; j < 100000; j+=10000)
{
for(k = 0; k <= 100; k++)
MyYData[j + k] = MyYData[j + k] - 50 + ((float)(Rand_Num.NextDouble()) * 100);
}
// Perform the actual transfer of data //'
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.YData, MyYData, 100000);
// This empties PointLabels array and invokes virtual point labels //'
// which are the point number.
Pego1.PeString.PointLabels[-1] = "0";
// Set plotting method to line and allow zooming //'
Pego1.PePlot.Method = GraphPlottingMethod.Line;
Pego1.PeUserInterface.Allow.Zooming = AllowZooming.Horizontal;
Pego1.PeUserInterface.Dialog.PlotCustomization = false;
// This allows plotting of zero values //'
Pego1.PeData.NullDataValue = -99999;
Pego1.PeLegend.SubsetLineTypes[0] = LineType.ThinSolid;
}
else if(m_nChart == 20)
{
//*********************************************************************'
//*********************************************************************'
//020 Graph showing Real-Time PEpartialresetimage
//! This example demonstrates the PEpartialresetimage feature.
//! This example uses a large data set of 30000 data values
//! within a real-time implementation and uses only 2% or less of the CPU.
//! Without a PEpartialresetimage feature, CPU usage would be 100% and
//! the operating system wouldn't be able to handle other tasks smoothly.
// No Flicker //
Pego1.PeConfigure.PrepareImages = true;
Pego1.PeConfigure.CacheBmp = true; //! Important for PartialResetImage to work.
Pego1.PeSpecial.AutoImageReset = false; //! Also important for this type of real-time
Pego1.PeData.SpeedBoost = 0;
Pego1.PeUserInterface.Cursor.HourGlassThreshold = 40000;
// Set Subsets and Points //
Pego1.PeData.Subsets = 2;
Pego1.PeData.Points = 15000;
// Pass 80% of the data, first one subset, then next subset //
float[] MyYData = new float[12000];
Int32 p;
for(p=0; p<12000; p++)
MyYData[p] = (float)((System.Math.Sin(0.003 * p) * 500.0) + ((Rand_Num.NextDouble()) * 50));
// Perform the actual transfer of data, first subset //
float dat = 0;
Gigasoft.ProEssentials.Api.PEvsetEx(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.YData, 0, 12000, MyYData, ref dat);
Random New_Rand = new Random(unchecked((int)DateTime.Now.Ticks));
for(p=0; p<12000; p++ )
MyYData[p] = (float)((System.Math.Cos(0.003 * p) * 500.0) + ((float)(New_Rand.NextDouble()) * 50));
// Perform the actual transfer of data, second subset //
Gigasoft.ProEssentials.Api.PEvsetEx(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.YData, 15000, 12000, MyYData, ref dat);
// Setting last point label first allocates memory and speeds up subsequent logic //'
Pego1.PeString.PointLabels[11999] = " ";
for(p=0; p<12000; p++)
Pego1.PeString.PointLabels[p] = "Test" + System.Convert.ToString(p + 1);
// Set up two axes, just because it's easy ///
Pego1.PeGrid.MultiAxesSubsets[0] = 1;
Pego1.PeGrid.MultiAxesSubsets[1] = 1;
Pego1.PeGrid.Option.MultiAxisStyle = MultiAxisStyle.SeparateAxes;
// Manually configure top scale scale //
Pego1.PeGrid.WorkingAxis = 0;
Pego1.PeGrid.Configure.ManualScaleControlY = ManualScaleControl.MinMax;
Pego1.PeGrid.Configure.ManualMinY = -600;
Pego1.PeGrid.Configure.ManualMaxY = 600;
// Manually configure bottom scale scale //
Pego1.PeGrid.WorkingAxis = 1;
Pego1.PeGrid.Configure.ManualScaleControlY = ManualScaleControl.MinMax;
Pego1.PeGrid.Configure.ManualMinY = -600;
Pego1.PeGrid.Configure.ManualMaxY = 600;
// Real-Time related properties for Graph Objects //
Pego1.PeGrid.Configure.ManualMaxPointLabel = "Test XXXXXXX";
Pego1.PeGrid.Configure.ManualMaxDataString = "12345";
// Set Various Other Properties //
Pego1.PeString.MainTitle = "Graph Real Time Example";
Pego1.PeString.SubTitle = ""; // no subtitle
Pego1.PePlot.Method = GraphPlottingMethod.Line;
Pego1.PeUserInterface.Menu.PlotMethod = MenuControl.Hide;
Pego1.PeUserInterface.Dialog.PlotCustomization = false;
Pego1.PeUserInterface.Allow.FocalRect = false;
Pego1.PeData.Precision = DataPrecision.OneDecimal;
Pego1.PeFont.Fixed = true;
Pego1.PeFont.FontSize = FontSize.Large;
Pego1.PeLegend.SubsetLineTypes[0] = LineType.ThinSolid;
Pego1.PeLegend.SubsetLineTypes[1] = LineType.ThinSolid;
Pego1.PeUserInterface.Allow.Zooming = AllowZooming.HorzAndVert;
Pego1.PeUserInterface.Allow.ZoomStyle = ZoomStyle.Ro2Not;
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.DarkNoBorder;
Pego1.PeColor.SubsetColors[0] = Color.FromArgb(0, 198, 0);
Pego1.PeColor.SubsetColors[1] = Color.FromArgb(198, 0, 198);
Pego1.PeLegend.Style = LegendStyle.OneLineInsideAxis;
Pego1.PeGrid.LineControl = GridLineControl.YAxis;
Pego1.PeUserInterface.Allow.MultiAxesSizing = true;
Pego1.PeConfigure.BorderTypes = TABorder.Inset;
m_nRealTimeCounter = 12000;
m_nSinCounter = 12000;
Timer1.Interval = 50;
Timer1.Enabled = true;
/*///////////////////////////////////////////////////////
// the following code can be found in the Timer Event //
////////////////////////////////////////////////////////
// Graph Real Time Feed using PEpartialresetimage //
if( m_nRealTimeCounter >= 15000)
{
// When we reach the end of our data, we shift 20% to the
// left and make room for another 3000 quick updates.
float[] dat = new float[6000];
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.AppendPointLabelData, dat, 3000);
Gigasoft.ProEssentials.Api.PEvset(Pego1.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.AppendYData, dat, 3000);
// We need to perform a complete image update here.
Pego1.PeFunction.ResetImage(0, 0);
Pego1.Invalidate();
Pego1.Update();
m_nRealTimeCounter = 12000;
}
// First Subset //
Pego1.PeData.Y[0, m_nRealTimeCounter] = (float)((System.Math.Sin(0.003 * m_nSinCounter) * 500.0));
// Second Subset //
Pego1.PeData.Y[1, m_nRealTimeCounter] = (float)((System.Math.Cos(0.003 * m_nSinCounter) * 500.0));
// Set an example string associated with data //
Pego1.PeString.PointLabels[m_nRealTimeCounter] = "Test" + System.Convert.ToString(m_nSinCounter);
// This call performs a quick partial draw to an internal cached bmp //'
Pego1.PeFunction.PartialResetImage(m_nRealTimeCounter, 1);
// Invalidate control, only invalidate vertical charting area and
// approximate horizontal location of new data added.
Int32 nA, nX=0, nY=0, nTop, nLeft, nRight, nBottom;
Double fX, fY;
System.Drawing.Rectangle rc;
System.Drawing.Rectangle rect;
nA = 0; // Initialize axis, non-zero only if using MultiAxesSubsets
fX = m_nRealTimeCounter - 5.0; // Approximate horizontal location
fY = 0; // not important, we will user vertical extents from PEP_rectGRAPH
// This call finds pixel location for fX and fY graph coordinates //'
Pego1.PeFunction.ConvPixelToGraph(ref nA,ref nX,ref nY,ref fX,ref fY, false, false, true);
// get vertical extents of charting area //'
rect = Pego1.PeFunction.GetRectGraph();
nTop = rect.Top;
nLeft = rect.Left;
nRight = rect.Right;
nBottom = rect.Bottom;
nLeft = nX;
nRight = nX + 50; // 50 pixels close to new data location
// For comparison purposes, you can uncomment the line below //
// Calling PEresetimage with each timer event causes CPU usage to go to 100%
// PEpartialresetimage allows the same visual output while using 2% or less of the CPU
//--- Pego1.PeFunction.ResetImage(0, 0)
rc = new System.Drawing.Rectangle(nLeft, nTop, nBottom, nRight);
Pe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -