本文整理汇总了C#中ZedGraph.GraphPane.AddCurve方法的典型用法代码示例。如果您正苦于以下问题:C# GraphPane.AddCurve方法的具体用法?C# GraphPane.AddCurve怎么用?C# GraphPane.AddCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.GraphPane
的用法示例。
在下文中一共展示了GraphPane.AddCurve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
// set your pane
myPane = zedGraphControl1.GraphPane;
// set a title
myPane.Title.Text = "This is an example!";
// set X and Y axis titles
myPane.XAxis.Title.Text = "X Axis";
myPane.YAxis.Title.Text = "Y Axis";
// ---- CURVE ONE ----
// draw a sin curve
for (int i = 0; i < 100; i++)
{
listPointsOne.Add(i, Math.Sin(i));
}
// set lineitem to list of points
myCurveOne = myPane.AddCurve(null, listPointsOne, Color.Black, SymbolType.Circle);
// ---------------------
// ---- CURVE TWO ----
listPointsTwo.Add(10, 50);
listPointsTwo.Add(50, 50);
// set lineitem to list of points
myCurveTwo = myPane.AddCurve(null, listPointsTwo, Color.Blue, SymbolType.None);
myCurveTwo.Line.Width = 5;
// ---------------------
// delegate to draw
zedGraphControl1.AxisChange();
}
示例2: SetupChart
// ------------------ CHARTING ROUTINES ---------------------
/// <summary> Sets up the chart. </summary>
public void SetupChart()
{
MasterPane masterPane = chartControl.MasterPane;
masterPane.PaneList.Clear();
// get a reference to the GraphPane
_temperaturePane = new GraphPane(new Rectangle(5, 5, 890, 350),
"Temperature controller",
"Time (s)",
"Temperature (C)");
masterPane.Add(_temperaturePane);
// Create data arrays for rolling points
_analog1List = new RollingPointPairList(3000);
_analog3List = new RollingPointPairList(3000);
_analog1List.Clear();
_analog3List.Clear();
// Create a smoothened red curve for the current temperature
LineItem myCurve1 = _temperaturePane.AddCurve("Current temperature", _analog1List, Color.Red, SymbolType.None);
myCurve1.Line.Width = 2;
myCurve1.Line.IsSmooth = true;
myCurve1.Line.SmoothTension = 0.2f;
// Create a smoothened blue curve for the goal temperature
LineItem myCurve3 = _temperaturePane.AddCurve("Goal temperature", _analog3List, Color.Blue, SymbolType.None);
myCurve3.Line.Width = 2;
myCurve3.Line.IsSmooth = true;
myCurve3.Line.SmoothTension = 0.2f;
// Tell ZedGraph to re-calculate the axes since the data have changed
chartControl.AxisChange();
_heaterPane = new GraphPane(new Rectangle(5, 360, 890, 250),
null,
null,
null);
masterPane.Add(_heaterPane);
_heaterList = new RollingPointPairList(3000);
_heaterPwmList = new RollingPointPairList(3000);
_heaterList.Clear();
_heaterPwmList.Clear();
// Create a red curve for the heater value
LineItem heaterCurve = _heaterPane.AddCurve(null, _heaterList, Color.YellowGreen, SymbolType.None);
heaterCurve.Line.Width = 2;
heaterCurve.Line.IsSmooth = false;
// Create a red curve for the current heater pwm value
LineItem heaterPwmCurve = _heaterPane.AddCurve(null, _heaterPwmList, Color.Blue, SymbolType.None);
heaterPwmCurve.Line.Width = 2;
heaterPwmCurve.Line.IsSmooth = false;
SetChartScale(0);
}
示例3: PressPlot
public PressPlot()
{
InitializeComponent();
PressPane = zedGraphControl1.GraphPane;
PressPane.Title.IsVisible = false;
PressPane.XAxis.Title.Text = "time (sec)";
PressPane.YAxis.Title.Text = "pressure (Pa)";
PressPane.Y2Axis.IsVisible = true;
PressPane.Y2Axis.Title.Text = "temperature (degC)";
// Save 1200 points. At 50 ms sample rate, this is one minute
// The RollingPointPairList is an efficient storage class that always
// keeps a rolling set of point data without needing to shift any data values
RollingPointPairList xlist = new RollingPointPairList(20000);
RollingPointPairList ylist = new RollingPointPairList(20000);
// Initially, a curve is added with no data points (list is empty)
// Color is blue, and there will be no symbols
LineItem curve1 = PressPane.AddCurve("pressure", xlist, Color.Blue, SymbolType.None);
LineItem curve2 = PressPane.AddCurve("temparature", ylist, Color.Red, SymbolType.None);
curve2.IsY2Axis = true;
// Sample at 50ms intervals
timer1.Interval = 250;
timer1.Enabled = true;
timer1.Start();
// Just manually control the X axis range so it scrolls continuously
// instead of discrete step-sized jumps
PressPane.XAxis.Scale.Min = 0;
PressPane.XAxis.Scale.Max = (double)numericUpDown1.Value;
PressPane.XAxis.Scale.MinorStep = 1;
PressPane.XAxis.Scale.MajorStep = 5;
PressPane.YAxis.Scale.Max = 110000;
PressPane.YAxis.Scale.Min = 110000 / 5;
PressPane.YAxis.MajorTic.IsOpposite = false;
PressPane.YAxis.MinorTic.IsOpposite = false;
PressPane.Y2Axis.MajorTic.IsOpposite = false;
PressPane.Y2Axis.MinorTic.IsOpposite = false;
PressPane.Y2Axis.MajorGrid.IsZeroLine = false;
PressPane.Y2Axis.Scale.MajorStep = 20;
PressPane.Y2Axis.Scale.MinorStep = 5;
PressPane.Y2Axis.Scale.Max = 80;
PressPane.Y2Axis.Scale.Min = -20;
// Scale the axes
zedGraphControl1.AxisChange();
// Save the beginning time for reference
tickStart = Environment.TickCount;
}
示例4: AddCurve
public void AddCurve(GraphPane pane, string name, Color color, int capacity = 8192)
{
_dataPointList = new RollingPointPairList(capacity);
// Добавим кривую пока еще без каких-либо точек
pane.AddCurve(name, _dataPointList, color, SymbolType.None);
}
示例5: EveryNumCycleLoad
void EveryNumCycleLoad(object sender, EventArgs e)
{
MasterPane myMaster = zedGraphControl1 .MasterPane ;
myMaster.PaneList.Clear();
myMaster.Title.Text = "MasterPane Test";
myMaster.Title.IsVisible = true;
myMaster.Fill = new Fill( Color.White, Color.MediumSlateBlue, 45.0F );
int[][] everyRes = DataProcess .AllSingleCycle (MainForm .arr ) ;
for ( int j=0; j< 10; j++ )
{
GraphPane myPane = new GraphPane();
myPane.Title.Text = "My Test Graph #" + (j+1).ToString();
myPane.XAxis.Title.Text = "X Axis";
myPane.YAxis.Title.Text = "Y Axis";
//myPane.Fill = new Fill( Color.White, Color.LightYellow, 45.0F );
//myPane.BaseDimension = 6.0F;
PointPairList list = new PointPairList();
for ( int i=0; i < everyRes [j ].Length ; i++ )
{
int x = i ;
int y = everyRes [j ][i ] ;
list.Add( x, y );
}
LineItem myCurve = myPane.AddCurve( "label" + j.ToString(),list, Color.Red, SymbolType.Diamond );
myMaster.Add( myPane );
}
using ( Graphics g = this.CreateGraphics() )
{
myMaster .SetLayout( g, PaneLayout.SquareColPreferred );
}
}
示例6: drawGraph
private void drawGraph()
{
Dictionary<double, double> coordinats = new Dictionary<double, double>();
for (double x = xMin; x <= xMax; x += top)
{
if (x!=0)
coordinats.Add(x, a/x);
}
GraphPane myPane = new GraphPane();
zedGraphControl1.GraphPane = myPane;
myPane.XAxis.Title.Text = "Координата X";
myPane.YAxis.Title.Text = "Координата Y";
// myPane.Fill = new Fill(Color.White, Color.LightSkyBlue, 45.0f);
myPane.Chart.Fill.Type = FillType.None;
myPane.Legend.Position = LegendPos.Float;
myPane.Legend.IsHStack = false;
if (comboBox1.GetItemText(comboBox1.SelectedIndex) == "1")
{
myPane.AddBar("", coordinats.Keys.ToArray(), coordinats.Values.ToArray(), penColor);
}
else
{
LineItem myCurve = myPane.AddCurve("", coordinats.Keys.ToArray(), coordinats.Values.ToArray(), penColor, SymbolType.None);
myCurve.Line.Width = penWeight;
myCurve.Symbol.Fill = new Fill(Color.White);
}
zedGraphControl1.AxisChange();
zedGraphControl1.Refresh();
zedGraphControl1.Visible = true;
}
示例7: Form1
public Form1()
{
InitializeComponent();
myPane = myPlot.GraphPane;
int status = myDevice.connect();
if (status == 0)
{
MessageBox.Show("Device couldn't be found!");
Environment.Exit(0);
}
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = plotWidth;
myPane.YAxis.Scale.Min = 0;
myPane.YAxis.Scale.Max = 5;
myDevice.pinMode(2, 1);
myLine = myPane.AddCurve("Analog Voltage", myPoints, Color.Blue, SymbolType.None);
myDevice.initPwm();
myLine.Line.Width = 1;
myPlot.Invalidate();
myPlot.AxisChange();
myTimer.Start();
}
示例8: CreateLineGraph
public GraphPane CreateLineGraph(int nSeries, string title, string xAxisTitle, string yAxisTitle, bool xAxisTitleVisible, bool yAxisTitleVisible, bool xScaleVisible, bool yScaleVisible, bool xMajorGridVisible, bool xIsBetweenLabels, bool yMajorGridVisible, bool yIsBetweenLabels)
{
GraphPane graphPane = new GraphPane();
SetupGraphPane(graphPane, title, xAxisTitle, yAxisTitle, xAxisTitleVisible, yAxisTitleVisible, xScaleVisible, yScaleVisible, xMajorGridVisible, xIsBetweenLabels, yMajorGridVisible, yIsBetweenLabels);
PointPairList points = new PointPairList();
graphPane.AddCurve("", points, Color.Yellow, SymbolType.None);
return graphPane;
}
示例9: AccPlot
public AccPlot()
{
InitializeComponent();
gyroPane = zedGraphControl1.GraphPane;
gyroPane.Title.IsVisible = false;
gyroPane.XAxis.Title.Text = "time (sec)";
gyroPane.YAxis.Title.Text = "acceleration (g)";
// Save 1200 points. At 50 ms sample rate, this is one minute
// The RollingPointPairList is an efficient storage class that always
// keeps a rolling set of point data without needing to shift any data values
RollingPointPairList xlist = new RollingPointPairList(2000);
RollingPointPairList ylist = new RollingPointPairList(2000);
RollingPointPairList zlist = new RollingPointPairList(2000);
// Initially, a curve is added with no data points (list is empty)
// Color is blue, and there will be no symbols
LineItem curve = gyroPane.AddCurve("x axis", xlist, Color.Blue, SymbolType.None);
curve = gyroPane.AddCurve("y axis", ylist, Color.Red, SymbolType.None);
curve = gyroPane.AddCurve("z axis", zlist, Color.Green, SymbolType.None);
// Sample at 50ms intervals
timer1.Interval = 10;
timer1.Enabled = true;
timer1.Start();
// Just manually control the X axis range so it scrolls continuously
// instead of discrete step-sized jumps
gyroPane.XAxis.Scale.Min = 0;
gyroPane.XAxis.Scale.Max = (double)numericUpDown1.Value;
gyroPane.XAxis.Scale.MinorStep = 0.5;
gyroPane.XAxis.Scale.MajorStep = 1;
gyroPane.YAxis.Scale.Max = A_Page.fullScale_acc / 4;
gyroPane.YAxis.Scale.Min = -A_Page.fullScale_acc / 4;
// Scale the axes
zedGraphControl1.AxisChange();
// Save the beginning time for reference
tickStart = Environment.TickCount;
}
示例10: CreateLineGraph
public GraphPane CreateLineGraph(int nSeries, string title, string xAxisTitle, string yAxisTitle, bool xAxisTitleVisible, bool yAxisTitleVisible, bool xScaleVisible, bool yScaleVisible, bool xMajorGridVisible, bool xIsBetweenLabels, bool yMajorGridVisible, bool yIsBetweenLabels)
{
GraphPane graphPane = new GraphPane();
SetupGraphPane(graphPane, title, xAxisTitle, yAxisTitle, xAxisTitleVisible, yAxisTitleVisible, xScaleVisible, yScaleVisible, xMajorGridVisible, xIsBetweenLabels, yMajorGridVisible, yIsBetweenLabels);
RollingPointPairList[] listArray = new RollingPointPairList[nSeries];
for (int i = 0; i < listArray.Length; i++)
{
listArray[i] = new RollingPointPairList(0x4b0);
graphPane.AddCurve("", listArray[i], graphDataColors[i], SymbolType.None);
}
return graphPane;
}
示例11: Draw
public GraphPane Draw(GraphPane pane, int id)
{
filterDataContext db = new filterDataContext();
double t_max = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.p_time).Max();
double t_min = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.p_time).Min();
double p_max = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.psnr).Max();
double p_min = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.psnr).Min();
double w_max = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.p1).Max();
double w_min = (double)(from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a.p1).Min();
pane.Title.Text = "Анализ продолжительности вычислений";
pane.CurveList.Clear();
pane.YAxis.Scale.Min = p_min;
pane.YAxis.Scale.Max = p_max;
pane.YAxis.Title.Text = "PSNR";
pane.XAxis.Title.Text = "Время обработки";
pane.XAxis.Scale.Min = t_min;
pane.XAxis.Scale.Max = t_max;
pane.Y2Axis.Scale.Min = w_min;
pane.Y2Axis.Scale.Max = w_max;
pane.Y2Axis.Title.Text = "Размер окна фильтра";
PointPairList List1 = new PointPairList();
PointPairList List2 = new PointPairList();
var query = from a in db.Datas where (a.ftype == type[id]) && (a.ftype == "gaussian") select a;
foreach (var test in query)
{
List1.Add((double)test.p_time, (double)test.psnr);
List2.Add((double)test.p_time, (double)test.p1);
}
LineItem Curve1 = pane.AddCurve("", List1, Color.Blue, SymbolType.None);
LineItem Curve2 = pane.AddCurve("", List2, Color.Blue, SymbolType.None);
return pane;
}
示例12: ZedGraphProxy
public ZedGraphProxy(ZedGraphControl chart)
{
Chart = chart;
master = chart.MasterPane;
master.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0f);
master.PaneList.Clear();
master.Title.IsVisible = true;
//master.Title.Text = "";
master.Margin.All = 10;
master.InnerPaneGap = 0;
myPane = new GraphPane(new Rectangle(25, 25, chart.Width - 50, chart.Height - 50), "", "", "");
// myPane.Title.Text = "";
myPane.XAxis.Title.Text = "Time, s";
myPane.Y2Axis.IsVisible = true;
myPane.Fill.IsVisible = false;
myPane.Chart.Fill = new Fill(Color.White, Color.LightYellow, 45.0F);
myPane.Margin.All = 0;
myPane.Margin.Top = 20;
master.Add(myPane);
y1List = new PointPairList();
y2List = new PointPairList();
var myCurve = myPane.AddCurve("", y1List, Color.Red, SymbolType.Circle);
myCurve.IsVisible = false;
myCurve = myPane.AddCurve("", y2List, Color.Green, SymbolType.Circle);
myCurve.IsVisible = false;
myCurve.IsY2Axis = true;
chart.IsSynchronizeYAxes = true;
chart.Invalidate();
}
示例13: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
writer = new StreamWriter(saveFileDialog1.FileName);
MyPane = WaveformGraph.GraphPane;
MyPane.XAxis.Title.Text = "";
MyPane.YAxis.Scale.Max = 5;
MyPane.YAxis.Scale.Min = 0;
MyPane.YAxis.Title.Text = "";
MyPane.Title.Text = "";
LineItem myCurve = MyPane.AddCurve("", list1, Color.Red, SymbolType.None);
WaveformGraph.AxisChange();
SerialReader.Open();
Timer_ms.Start();
}
示例14: AddCurve
public void AddCurve(GraphPane myPane, Stats dataClass, int Length, string title)
{
PointPairList points = new PointPairList();
for (int i = 0; i < Length; i++)
{
double x = Math.Abs(dataClass.DataList[i]);
double y = (i + 1) * (1.0 / ((double) Length));
points.Add(x, y);
}
myPane.AddCurve(title, points, this.rotator.NextColor, this.rotator.NextSymbol).Symbol.Fill = new Fill(Color.White);
myPane.YAxis.Scale.MaxAuto = false;
myPane.YAxis.Scale.MinAuto = false;
myPane.YAxis.Scale.Max = 1.0;
myPane.YAxis.Scale.Min = 0.0;
this.zedGraphControl1.AxisChange();
}
示例15: SaveImage
public void SaveImage(int width, int height, string title, string outputFile, ImageFormat imageFormat)
{
GraphPane myPane = new GraphPane(new RectangleF(0, 0, width, height), title, "Week", "Hours");
myPane.IsBoundedRanges = true;
var ppl = new PointPairList();
foreach (var week in data)
{
ppl.Add(week.Item1, week.Item2);
}
// Hide the legend
myPane.Legend.IsVisible = false;
var foreground = Color.FromArgb(255, 55, 108, 153);
myPane.XAxis.AxisGap = 1f;
myPane.XAxis.Type = AxisType.Text;
myPane.XAxis.Scale.TextLabels = data.Select(t => "Week " + t.Item1).ToArray();
myPane.YAxis.Scale.Min = 0;
myPane.YAxis.Scale.MinorStep = 1;
myPane.YAxis.MinorTic.Color = Color.Transparent;
myPane.Border.IsVisible = false;
LineItem curve = myPane.AddCurve("Hours of effort", ppl, foreground, SymbolType.Circle);
curve.Line.Width = 2.0F;
curve.Line.IsAntiAlias = true;
curve.Symbol.Fill = new Fill(Color.White);
curve.Symbol.Size = 7;
// Leave some extra space on top for the labels to fit within the chart rect
myPane.YAxis.Scale.MaxGrace = 0.1;
myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45);
myPane.Fill = new Fill(Color.White);
Bitmap bm = new Bitmap(1, 1);
using (Graphics g = Graphics.FromImage(bm))
myPane.AxisChange(g);
myPane.GetImage().Save(outputFile, imageFormat);
}