本文整理汇总了C#中ZedGraph.PointPairList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PointPairList.Add方法的具体用法?C# PointPairList.Add怎么用?C# PointPairList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.PointPairList
的用法示例。
在下文中一共展示了PointPairList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DateAxisSampleDemo
public DateAxisSampleDemo()
: base("Code Project Date Axis Sample",
"Date Axis Sample", DemoType.Tutorial)
{
GraphPane myPane = base.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "My Test Date Graph";
myPane.XAxis.Title.Text = "Date";
myPane.YAxis.Title.Text = "My Y Axis";
// Make up some data points based on the Sine function
PointPairList list = new PointPairList();
for ( int i=0; i<36; i++ )
{
double x = (double) new XDate( 1995, 5, i+11 );
double y = Math.Sin( (double) i * Math.PI / 15.0 );
list.Add( x, y );
}
// Generate a red curve with diamond
// symbols, and "My Curve" in the legend
LineItem myCurve = myPane.AddCurve( "My Curve",
list, Color.Red, SymbolType.Diamond );
// Set the XAxis to date type
myPane.XAxis.Type = AxisType.Date;
base.ZedGraphControl.AxisChange();
}
示例2: IterativePrepare
private void IterativePrepare(double xs)
{
zedIterative.GraphPane.CurveList.Clear();
MyExtension.Function f = (x =>Math.Pow(Math.Abs(Math.Cos(x)),0.5));
zedIterative.Graph(f, -10, 10, 0.1, Color.Red);
zedIterative.Graph(x => x, -10, 10, 1, Color.Blue);
PointPairList list = new PointPairList();
double x0,x1 = xs;
iterativeLogger.Items.Clear();
list.Add(x1, f(x1));
do
{
x0 = x1;
x1 = f(x0);
list.Add(x0, x1);
iterativeLogger.Items.Add(
String.Format("X = + {0:0.#####} + ; f(x) = + {1:0.########}", x1, f(x1)));
} while (Math.Abs(x1 - x0) > Eps);
LineItem line = zedIterative.GraphPane.AddCurve("", list, Color.Green, SymbolType.Diamond);
line.Line.IsVisible = false;
zedIterative.AxisChange();
}
示例3: polowienia
public void polowienia()
{
//p1 i p2 to przedziały ( początkowy i końcowy )
Number p1 = new Number(1.0, 2.0);
Number p2 = new Number(3.0, 2.0);
//
Random rnd = new Random();
Number epsilon = new Number(rnd.Next(2, 7), 100.0);
polowienieBox.AppendText("epsilon wynosi " + epsilon.value + "\nkolejne podziały: \n");
Function f_p1 = new Function(p1.value);
Function f_p2 = new Function(p2.value);
if (f_p1.val * f_p2.val < 0.0)
{
PointPairList lista = new PointPairList();
Random random = new Random();
for (int i = 0; i < 15; i++)
{
// dodawanie przedzialow na wykresie
lista.Add(f_p1.arg, 0); lista.Add(f_p1.arg, -20 + i * 2.5); lista.Add(f_p2.arg, -20 + i * 2.5); lista.Add(f_p2.arg, 0);
System.Threading.Thread.Sleep(25);
LineItem myCurve = zedGraphControl1.GraphPane.AddCurve("",
lista, Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), SymbolType.None);
myCurve.Line.Width = 1.0f;
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
zedGraphControl1.Refresh();
//
polowienieBox.AppendText(i+1 + ". " + f_p1.arg + " - " + f_p2.arg + "\n");
Function srodek = new Function((f_p1.arg + f_p2.arg) / 2.0);
if (srodek.modulus() < epsilon.value)
{
polowienieBox.AppendText("\n\nMiejsce zerowe znalezione!\nPrzybliżone miejsce zerowe (" + srodek.val.ToString("0.###") + " < " + epsilon.value + ") znaleziono w x = " + srodek.arg.ToString("#.###"));
//dodawanie strzalki na wykresie
ArrowObj strzalka = new ArrowObj(Color.Black, 10.0f, srodek.arg, srodek.val + 45, srodek.arg, srodek.val + 5);
zedGraphControl1.GraphPane.GraphObjList.Add(strzalka);
zedGraphControl1.Refresh();
break;
}
else
{
if (f_p1.val * srodek.val < 0)
f_p2 = new Function(srodek.arg);
else
f_p1 = new Function(srodek.arg);
}
}
}
else
{
MessageBox.Show("Kryczyny błąd",
"wartosci funkcji dla tego przedziału są tego samego znaku - algorytm nie może kontynuować",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例4: AxisMarkerCurveItem
public AxisMarkerCurveItem(double value, bool isXAxis)
{
Value = value;
IsXAxisMarker = isXAxis;
var points = new PointPairList();
if(isXAxis)
points.Add(value, PointPair.Missing);
else
points.Add(PointPair.Missing, value);
Points = points;
PenColor = Color.Red;
}
示例5: Draw
private void Draw(int[] x, int[] y, int[] z)
{
GraphPane pane = zgcHist.GraphPane;
pane.CurveList.Clear();
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for (long j = 0; j < x.Length; j++)
{
if (x[j] != 0)
{
list.Add(x[j], y[j]);
list2.Add(x[j], z[j]);
}
}
//BurlyWood Coral DarkMagenta
LineItem myCurve = pane.AddCurve("Гистограмма", list, Color.Coral, SymbolType.None);
//Color color = Color.FromArgb(100, Color.Coral);
//myCurve.Line.Fill = new ZedGraph.Fill(color);
pane.AddCurve("Ожидаемый результат", list2, Color.BurlyWood, SymbolType.None);
pane.YAxis.Scale.Min = 0;
pane.YAxis.Scale.Max = 1.1*y.Max();
pane.Title.Text = filename;
zgcHist.AxisChange();
zgcHist.Invalidate();
}
示例6: AddNewCurve
public void AddNewCurve(string CurveName, double[] CurveData_X, double[] CurveData_Y)
{
// Make up some data points from the Sine function
int NumofPoints = CurveData_X.Length;
PointPairList list = new PointPairList();
for (int x = 0; x < NumofPoints; x++)
{
list.Add(CurveData_X[x], CurveData_Y[x]);
}
Color Clr = Color.FromArgb(ClrRnd.Next(255), ClrRnd.Next(255), ClrRnd.Next(255));
// Generate a random-colored curve with circle symbols, and CurveName in the legend
LineItem myCurve = myPane.AddCurve(CurveName, list, Clr,SymbolType.Circle);
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);
// Fill the pane background with a color gradient
myPane.Fill = new Fill(Color.White, Color.Pink, 45F);
// Calculate the Axis Scale Ranges
_zedObject.AxisChange();
}
示例7: Form2
public Form2(Form1 f2)
{
InitializeComponent();
GraphPane pane = zedGraph.GraphPane;
// Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
pane.CurveList.Clear();
// Создадим список точек
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
// Заполняем список точек
// Создадим кривую с названием "Функція",
// которая будет рисоваться голубым цветом (Color.Blue),
// Опорные точки выделяться не будут (SymbolType.None)
LineItem myCurve = pane.AddCurve("Функція Y", list, Color.Blue, SymbolType.None);
LineItem myCurve2 = pane.AddCurve("Функція Y(точ)", list2, Color.Red, SymbolType.None);
for (int i = 0; i < f2.dataGridView1.RowCount-1; i++)
{
list.Add(Convert.ToDouble( f2.dataGridView1[0, i].Value),Convert.ToDouble( f2.dataGridView1[1, i].Value));
list2.Add(Convert.ToDouble(f2.dataGridView1[0, i].Value), Convert.ToDouble(f2.dataGridView1[2, i].Value));
}
zedGraph.AxisChange();
pane.Title.Text = "Графік";
// Обновляем график
zedGraph.Invalidate();
}
示例8: StickItemDemo
public StickItemDemo()
: base("A demonstration of the 'StickItem', which is a single line for " +
"each point running from the XAxis to the data value",
"Stick Item Demo", DemoType.Bar)
{
GraphPane myPane = base.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "StickItem Demo Chart";
myPane.XAxis.Title.Text = "X Label";
myPane.YAxis.Title.Text = "My Y Axis";
PointPairList list = new PointPairList();
for ( int i=0; i<100; i++ )
{
double x = (double) i;
double y = Math.Sin( i / 8.0 );
double z = Math.Abs(Math.Cos( i / 8.0 )) * y;
list.Add( x, y, z );
}
StickItem myCurve = myPane.AddStick( "Some Sticks", list, Color.Blue );
myCurve.Line.Width = 2.0f;
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.XAxis.Scale.Max = 100;
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill( Color.White,
Color.LightGoldenrodYellow, 45.0F );
base.ZedGraphControl.AxisChange();
}
示例9: CreateGraph
private void CreateGraph( ZedGraphControl zgc )
{
GraphPane myPane = zgc.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "My Test Graph";
myPane.XAxis.Title.Text = "X Value";
myPane.YAxis.Title.Text = "My Y Axis";
// Make up some data points from the Sine function
PointPairList list = new PointPairList();
for ( double x = 0; x < 36; x++ )
{
double y = Math.Sin( x * Math.PI / 15.0 );
list.Add( x, y );
}
// Generate a blue curve with circle symbols, and "My Curve 2" in the legend
LineItem myCurve = myPane.AddCurve( "My Curve", list, Color.Blue,
SymbolType.Circle );
// Fill the area under the curve with a white-red gradient at 45 degrees
myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F );
// Make the symbols opaque by filling them with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow, 45F );
// Fill the pane background with a color gradient
myPane.Fill = new Fill( Color.White, Color.FromArgb( 220, 220, 255 ), 45F );
// Calculate the Axis Scale Ranges
zgc.AxisChange();
}
示例10: DrawSorted
public void DrawSorted(SeriesList list, string title, string subTitle,string xAxisTitle)
{
Clear();
if (list.Count == 0)
{
return;
}
for (int i = 0; i < list.Count; i++)
{
PointPairList pairs = new PointPairList();
foreach (var pt in list[i])
{
pairs.Add(pt.Percent, pt.Value);
}
var color = Default.GetSeriesColor(pane.CurveList.Count);
LineItem myCurve = pane.AddCurve(list[i].Appearance.LegendText,
pairs, color);
myCurve.Symbol.IsVisible = false;
myCurve.Line.Width = Default.GetSeriesWidth(pane.CurveList.Count);
}
pane.Title.Text = title + "\n" + subTitle;
pane.XAxis.Title.Text = xAxisTitle;
FormatBottomAxisNumeric();
pane.XAxis.Scale.Format = "";
pane.XAxis.Scale.MajorStep = 5;
FormatYAxisStandard();
SetPaneVisible(true);
LabelYaxis(list);
RefreshChart(chart1);
}
示例11: btnCalc_Click
private void btnCalc_Click(object sender, EventArgs e)
{
int seed = int.Parse(Seed.Text);
IRandomMethod method = new MethodMiddleOfSquare(seed);
if (radioButton1.Checked) method = new MethodMiddleOfSquare(seed);
if (radioButton2.Checked) method = new MultiplicativeCongruentialMethod(seed, 3453, 5675673);
int countNumbers = int.Parse(CountNumbers.Text);
int countNumbers2 = int.Parse(CountNumbers2.Text);
int numberSections = int.Parse(textBox1.Text);
ITestingMethod testingMethod = new EasyTesting();
double M, D;
double[] values = testingMethod.TestingUniformity(method, numberSections, countNumbers2, out M, out D);
double C = testingMethod.TestingtestingIndependence(method, countNumbers);
Correlation.Text = string.Format("Correlation = {0}", C);
MValue.Text = string.Format("M = {0}", M);
DValue.Text = string.Format("D = {0}", D);
ZedGraph.PointPairList table = new PointPairList();
for(int i=0;i<numberSections;i++)
{
table.Add(i,values[i]);
}
zedGraphControl1.GraphPane.AddCurve("", table, Color.Blue, SymbolType.Square);
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
}
示例12: FormEnergyCurve_Load
private void FormEnergyCurve_Load(object sender, EventArgs e)
{
if (CoeffList.Count < 2)
return;
string curveName = "";
int counter = 0;
foreach (double coeff in CoeffList)
{
curveName += coeff.ToString("E") + " * x^" + counter.ToString() + " + ";
counter++;
}
curveName = curveName.Substring(0, curveName.Length - 3);
Det.EnergyCurveCoefficients.Clear();
Det.EnergyCurveCoefficients.AddRange(CoeffList);
GraphPane pane = graph.GraphPane;
PointPairList list = new PointPairList();
for (int i = 0; i < Det.CurrentNumChannels; i++)
list.Add((double)i, Det.GetEnergy(i));
LineItem energyCurve = pane.AddCurve(curveName, list, Color.Green, SymbolType.None);
graph.RestoreScale(pane);
graph.AxisChange();
graph.Refresh();
}
示例13: FunctionRegressionView2D
/// <summary>
/// Constructs with the details of teh function regression problem to be visualized.
/// </summary>
/// <param name="func">The function being regressed.</param>
/// <param name="xMin">The minimum value of the input range being sampled.</param>
/// <param name="xIncr">The increment between input sample values.</param>
/// <param name="sampleCount">The number of samples over the input range.</param>
/// <param name="genomeDecoder">Genome decoder.</param>
public FunctionRegressionView2D(IFunction func, double xMin, double xIncr, int sampleCount, IGenomeDecoder<NeatGenome,IBlackBox> genomeDecoder)
{
InitializeComponent();
InitGraph(string.Empty, string.Empty, string.Empty);
_func = func;
_xMin = xMin;
_xIncr = xIncr;
_sampleCount = sampleCount;
_genomeDecoder = genomeDecoder;
// Prebuild plot point objects.
_plotPointListTarget = new PointPairList();
_plotPointListResponse = new PointPairList();
double[] args = new double[]{xMin};
for(int i=0; i<sampleCount; i++, args[0] += xIncr)
{
_plotPointListTarget.Add(args[0], _func.GetValue(args));
_plotPointListResponse.Add(args[0], 0.0);
}
// Bind plot points to graph.
zed.GraphPane.AddCurve("Target", _plotPointListTarget, Color.Black, SymbolType.None);
zed.GraphPane.AddCurve("Network Response", _plotPointListResponse, Color.Red, SymbolType.None);
}
示例14: StepChartDemo
public StepChartDemo()
: base("A sample step chart",
"Step Chart Demo", DemoType.Line)
{
GraphPane myPane = base.GraphPane;
// Set the title and axis labels
myPane.Title.Text = "Demo for Step Charts";
myPane.XAxis.Title.Text = "Time, Days";
myPane.YAxis.Title.Text = "Widget Production (units/hour)";
// Generate some sine-based data values
PointPairList list = new PointPairList();
for ( double i=0; i<36; i++ )
{
double x = i * 5.0;
double y = Math.Sin( i * Math.PI / 15.0 ) * 16.0;
list.Add( x, y );
}
// Add a red curve with circle symbols
LineItem curve = myPane.AddCurve( "Step", list, Color.Red, SymbolType.Circle );
curve.Line.Width = 1.5F;
// Fill the area under the curve
curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 60, 190, 50), 90F );
// Fill the symbols with white to make them opaque
curve.Symbol.Fill = new Fill( Color.White );
curve.Symbol.Size = 5;
// Set the curve type to forward steps
curve.Line.StepType = StepType.ForwardStep;
base.ZedGraphControl.AxisChange();
}
示例15: FilterToZoomedRange
/// <summary>
/// Filters the <see cref="DataFrameBuilder.Points"/> down to just those that are
/// visible if the graph has been zoomed in.
/// This method only filters based on the value on the Base Axis
/// (i.e. the X-Axis for most curves).
/// </summary>
public virtual DataFrameBuilder FilterToZoomedRange(DataFrameBuilder dataFrameBuilder)
{
var graphPane = dataFrameBuilder.GraphPane;
var pointList = dataFrameBuilder.Points;
var baseAxis = dataFrameBuilder.CurveItem.BaseAxis(graphPane);
if (baseAxis.Scale.IsAnyOrdinal)
{
// If the Scale is either Ordinal or Text, then don't
// filter the PointList, because the point values
// are derived from their position in the list.
return dataFrameBuilder;
}
Func<PointPair, double> valueOfPointFunc = ValueOfPointFuncForAxis(dataFrameBuilder, baseAxis);
if (null == valueOfPointFunc)
{
return dataFrameBuilder;
}
double min = baseAxis.Scale.Min;
double max = baseAxis.Scale.Max;
var pointPairList = new PointPairList();
for (int i = 0; i < pointList.Count; i++)
{
var pointPair = pointList[i];
double value = valueOfPointFunc(pointPair);
if (value < min || value > max)
{
continue;
}
pointPairList.Add(pointPair);
}
return dataFrameBuilder.SetPoints(pointPairList);
}