📄 frmfailuregp.cs
字号:
Pego1.PeData.Subsets = 3; // set number of subsets
Pego1.PeData.Points = 12; // number of data points
// Pass YData, Line Start, Line End, and Close Value //
Int32 s, p;
for(s = 0; s <= 2; s++)
{
for(p = 0; p <= 11; p++)
{
if(s == 0)
Pego1.PeData.Y[s, p] = ((p + 1) * 10 + ((float)(Rand_Num.NextDouble()) * 25));
else if(s == 1)
Pego1.PeData.Y[s, p] = ((p + 1) * 40 + ((float)(Rand_Num.NextDouble()) * 25));
else if( s == 2)
Pego1.PeData.Y[s, p] = ((p + 1) * 20 + ((float)(Rand_Num.NextDouble()) * 25));
}
}
}
else if(m_nChart == 5)
{
//*********************************************************************'
//*********************************************************************'
//005 Graph With Custom Y Axis
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Disable default scale //
Pego1.PeGrid.Option.ShowYAxis = ShowAxis.Empty;
// Generally, a custom y axis will need manual range control //
Pego1.PeGrid.Configure.ManualScaleControlY = ManualScaleControl.MinMax;
Pego1.PeGrid.Configure.ManualMinY = 0.0;
Pego1.PeGrid.Configure.ManualMaxY = 1000.0;
// Create custom grid lines with HorzLineAnnotations //
// Note that GridLineControl will control these annotations //
Pego1.PeAnnotation.Line.YAxis[0] = 200;
Pego1.PeAnnotation.Line.YAxisType[0] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[0] = "|LLow Value";
Pego1.PeAnnotation.Line.YAxis[1] = 500;
Pego1.PeAnnotation.Line.YAxisType[1] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[1] = "|LMedium Value";
Pego1.PeAnnotation.Line.YAxis[2] = 800;
Pego1.PeAnnotation.Line.YAxisType[2] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[2] = "|LHigh Value";
Pego1.PeAnnotation.Line.YAxis[3] = 350;
Pego1.PeAnnotation.Line.YAxisType[3] = LineAnnotationType.GridTick;
Pego1.PeAnnotation.Line.YAxisText[3] = "";
Pego1.PeAnnotation.Line.YAxis[4] = 650;
Pego1.PeAnnotation.Line.YAxisType[4] = LineAnnotationType.GridTick;
Pego1.PeAnnotation.Line.YAxisText[4] = "";
// Set LeftMargin to allocate space for line annotation text //
// Use the longest string used in annotations.
Pego1.PeAnnotation.Line.LeftMargin = "Medium Value ";
// Set this to see annotations //
Pego1.PeAnnotation.Show = true;
// Increase line annotation text size //
Pego1.PeFont.LineAnnotationTextSize = 100;
// Put Grid In Front of Bars //
Pego1.PeGrid.InFront = true;
// Other various properties //
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.LightInset;
}
else if(m_nChart == 6)
{
//*********************************************************************'
//*********************************************************************'
//006 Graph showing use of Null Data Gaps
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Change Null Data Value //
// Note that Scientific Graph has NullDataValueX and NullDataValueY //
Pego1.PeData.NullDataValue = -9999.0;
// Change to two subsets and set a few data points to nulls //
Pego1.PeData.Subsets = 2;
Pego1.PeData.Y[0, 3] = -9999;
Pego1.PeData.Y[0, 4] = -9999;
Pego1.PeData.Y[0, 5] = -9999;
Pego1.PeData.Y[1, 5] = -9999; //! Note that (1,6) and (1,8) are valid points
Pego1.PeData.Y[1, 7] = -9999; //! You will see symbols for these points because
Pego1.PeData.Y[1, 9] = -9999; //! they are surrounded by nulls.
// Set line Plotting Method //
Pego1.PePlot.Method = GraphPlottingMethod.Line;
// Enable Null Data Gaps //
// Using NullDataGaps, the subset's line will stop before null data values //
// If this line is commented out, then line will extend to next non-null //
Pego1.PePlot.Option.NullDataGaps = true;
// Other various properties //
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.MediumInset;
Pego1.PePlot.MarkDataPoints = true;
}
else if(m_nChart == 7)
{
//*********************************************************************'
//*********************************************************************'
//007 Graph showing use of PEconvpixeltograph
//! Look at TitleBar for the chart's window. As you
//! move the mouse, you will see the coordinates of the
//! mouse in the titlebar.
//! Right button click to show popup menu. //
//! Double Click to show customization dialog. //
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Other various properties //
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.LightShadow;
Pego1.PePlot.MarkDataPoints = true;
/*////////////////////////////////////////
// From MouseMove event of Pego control //
//////////////////////////////////////////
private void Pego1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
Int32 nA;
Int32 nX;
Int32 nY;
Double fX = 0;
Double fY = 0;
Int32 nLeft;
Int32 nTop;
Int32 nRight;
Int32 nBottom;
Int32 pX;
Int32 pY;
System.Drawing.Point pt;
System.Drawing.Rectangle rect;
// get last mouse location within control //'
pt = Pego1.PeUserInterface.Cursor.LastMouseMove;
pX = pt.X;
pY = pt.Y;
// test to see if this is within grid area //'
rect = Pego1.PeFunction.GetRectGraph();
nTop = rect.Top;
nLeft = rect.Left;
nRight = rect.Right;
nBottom = rect.Bottom;
if( pX > nLeft && pX < nRight && pY > nTop && pY < nBottom)
{
nA = 0; // Initialize axis if using OverlapMultiAxes, else this function will
// return the axis if MultiAxesSubsets is used without OverlapMultiAxes
nX = pX; // Initialize nX and nY with mouse location
nY = pY;
Pego1.PeFunction.ConvPixelToGraph(ref nA,ref nX,ref nY,ref fX,ref fY, false, false, false);
this.Text = fX.ToString() + " - " + fY.ToString();
}
else
this.Text = "Outside Grid";
}
*///////////////////////////////////////////////////////
}
else if(m_nChart == 8)
{
//*********************************************************************'
//*********************************************************************'
//008 Graph showing use of PointColors
//! Right button click to show popup menu. //
//! Double Click to show customization dialog. //
//! Vertical scroll bar revolves through subsets. //
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Now to control color on per point basis, we use the
// PointColors property array to assign a color to each
// piece of YData.
Int32 s, p;
for( s = 0; s <= 3; s++)
{
for( p = 0; p <= 11; p++)
{
if (s == 0)
Pego1.PeColor.PointColors[s, p] = Color.FromArgb(15 + ((p + 1) * 20), 0, 0);
else if (s == 1)
Pego1.PeColor.PointColors[s, p] = Color.FromArgb(0, 15 + ((p + 1) * 20), 0);
else if (s == 2)
Pego1.PeColor.PointColors[s, p] = Color.FromArgb(0, 0, 15 + ((p + 1) * 20));
else if(s == 3)
Pego1.PeColor.PointColors[s, p] = Color.FromArgb(0, 15 + ((p + 1) * 20), 15 + ((p + 1) * 20));
}
}
// Set SubsetColor to match brightest PointColor for each subset //
Pego1.PeColor.SubsetColors[0] = Color.FromArgb(198, 0, 0);
Pego1.PeColor.SubsetColors[1] = Color.FromArgb(0, 198, 0);
Pego1.PeColor.SubsetColors[2] = Color.FromArgb(0, 0, 198);
Pego1.PeColor.SubsetColors[3] = Color.FromArgb(0, 198, 198);
// Show 1 subset at a time //
Pego1.PeUserInterface.Scrollbar.ScrollingSubsets = 1;
Pego1.PeTable.What = TableWhat.AllSubsets;
Pego1.PeFont.FontSize = FontSize.Large;
// Change some colors //
Pego1.PeColor.GraphBackground = Color.Empty;
Pego1.PeColor.GraphGradientStyle = 0;
Pego1.PeColor.Shadow = Color.Black;
// Or, to get rid of legend, un-comment this code //'
// Pego1.SubsetsToLegend[0] = -1;
// Add a table //
Pego1.PeTable.Show = GraphPlusTable.Both;
Pego1.PeData.Precision = 0;
// Slant the Point Labels //
Pego1.PeGrid.ForceVerticalPoints = ForceVerticalPoints.Slanted;
Pego1.PePlot.Method = GraphPlottingMethod.Bar;
Pego1.PeConfigure.BorderTypes = TABorder.NoBorder;
}
else if(m_nChart == 9)
{
//*********************************************************************'
//*********************************************************************'
//009 Graph showing use of BestFitCoeffs
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Reduce to just two subsets //
Pego1.PeData.Subsets = 2;
// Set BestFitDegree and Plotting Method //
Pego1.PePlot.Option.BestFitDegree = BestFitDegree.Third;
Pego1.PePlot.Method = GraphPlottingMethod.PointsPlusBestFitCurve;
// Call PEreinitialize and PEresetimage //
Pego1.PeFunction.Reinitialize(); // Reinitialize can be used to read ManualMaxY, etc
Pego1.PeFunction.ResetImage(0, 0); // ResetImage is needed to calculate coeffs.
// Now add annotations that represents coefficients //
//** First subset's coeffs. **'
String t;
t = "Texas y = " + String.Format( "{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[0, 3]) + "x^3 ";
if(Pego1.PePlot.Option.BestFitCoeffs[0, 2] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[0, 2]) + "x^2 ";
if(Pego1.PePlot.Option.BestFitCoeffs[0, 1] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[0, 1]) + "x ";
if(Pego1.PePlot.Option.BestFitCoeffs[0, 0] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[0, 0]);
t = t + '\n'; // Line feed
// Second subset's coeffs. //
t = t + "Florida y = " + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[1, 3]) + "x^3 ";
if(Pego1.PePlot.Option.BestFitCoeffs[1, 2] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[1, 2]) + "x^2 ";
if(Pego1.PePlot.Option.BestFitCoeffs[1, 1] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[1, 1]) + "x ";
if(Pego1.PePlot.Option.BestFitCoeffs[1, 0] >= 0)
t = t + "+ ";
t = t + String.Format("{0:#.##}", Pego1.PePlot.Option.BestFitCoeffs[1, 0]);
// Put text into a line annotations //'
Pego1.PeAnnotation.Line.YAxis[0] = Pego1.PeGrid.Configure.ManualMaxY - 1;
//Pego1.PeAnnotation.Line.HorizontalType[0] = -1; // no line, just text
Pego1.PeAnnotation.Line.YAxisText[0] = t;
// Increases line annotation text size to max
Pego1.PeFont.LineAnnotationTextSize = 100;
Pego1.PeAnnotation.Show = true;
}
else if(m_nChart == 10)
{
//*********************************************************************'
//*********************************************************************'
//010 Graph showing Stacked Bar
//! Try this... Right Click chart and change the Plotting Method to Horizontal Bar Stacked. //
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
// Enable Stacked type charts //
Pego1.PePlot.Allow.StackedData = true;
Pego1.PePlot.Allow.HorzBarStacked = true;
// Set plotting method //
Pego1.PePlot.Method = GraphPlottingMethod.BarStacked;
// Add a table //
Pego1.PeTable.Show = GraphPlusTable.Both;
Pego1.PeData.Precision = DataPrecision.TwoDecimals;
}
else if(m_nChart == 11)
{
//*********************************************************************'
//*********************************************************************'
//011 Graph showing MultiSubTitles
//! Look for the text immediately above and below image. //
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
//! Note that strings below always have two pipe symbols "|" //
// Set Multi Sub and Bottom Titles //
Pego1.PeString.MultiSubTitles[0] = "Top Left|Top Center|Top Right";
Pego1.PeString.MultiSubTitles[1] = "|Second Line only centered|";
// Note that bottom titles get drawn from bottom up //
Pego1.PeString.MultiBottomTitles[0] = "Second Line only on left||";
Pego1.PeString.MultiBottomTitles[1] = "Bottom Left|Bottom Center|Bottom Right";
// Other various properties //
Pego1.PeColor.BitmapGradientMode = true;
Pego1.PeColor.QuickStyle = QuickStyle.LightLine;
Pego1.PePlot.MarkDataPoints = true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -