本文整理汇总了C#中ZedGraph.ZedGraphControl.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ZedGraphControl.Refresh方法的具体用法?C# ZedGraphControl.Refresh怎么用?C# ZedGraphControl.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.ZedGraphControl
的用法示例。
在下文中一共展示了ZedGraphControl.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGraph
private void CreateGraph(ZedGraphControl zgc)
{
//
// clear old coordinates
//
myPane.CurveList.Clear();
zgc.AxisChange();
// Generate a LightBlue curve with circle symbols, and "My Curve" in the legend
LineItem CurveS = myPane.AddCurve("Series GA", PPlist[0], Color.LightBlue, SymbolType.Diamond);
// Generate a PaleVioletRed curve with circle symbols, and "My Curve" in the legend
LineItem CurveP = myPane.AddCurve("Parallel GA", PPlist[1], Color.PaleVioletRed, SymbolType.Circle);
float allPointSize = 50F;
// Fill the area under the curve with a white-red gradient at 45 degrees
CurveS.Line.Fill = new Fill(Color.Transparent, Color.LightBlue, allPointSize);
// Make the symbols opaque by filling them with white
CurveS.Symbol.Fill = new Fill(Color.Transparent);
// Fill the area under the curve with a white-red gradient at 45 degrees
CurveP.Line.Fill = new Fill(Color.Transparent, Color.PaleVioletRed, allPointSize);
// Make the symbols opaque by filling them with white
CurveP.Symbol.Fill = new Fill(Color.Transparent);
// Calculate the Axis Scale Ranges
zgc.AxisChange();
zgc.Refresh();
}
示例2: asignarGrafica
private void asignarGrafica(ZedGraphControl z, int i)
{
CurveList g = new CurveList();
g = h.getGrafica(i);
if (g != null)
{
z.GraphPane.CurveList = g;
z.Invalidate();
z.Refresh();
}
}
示例3: ApplyChangesToGraphControl
private void ApplyChangesToGraphControl(ZedGraphControl graphControl)
{
if (chkLogX.Checked)
graphControl.GraphPane.XAxis.Type = AxisType.Log;
else
graphControl.GraphPane.XAxis.Type = AxisType.Linear;
if (chkLogY.Checked)
graphControl.GraphPane.YAxis.Type = AxisType.Log;
else
graphControl.GraphPane.YAxis.Type = AxisType.Linear;
graphControl.IsAntiAlias = chkAntiAlias.Checked;
if (chkXAuto.Checked)
{
graphControl.GraphPane.XAxis.Scale.MaxAuto = chkXAuto.Checked;
graphControl.GraphPane.XAxis.Scale.MinAuto = chkXAuto.Checked;
}
else
{
graphControl.GraphPane.XAxis.Scale.Min = Util.ConvertToDouble(txtMinX.Text,
graphControl.GraphPane.XAxis.Scale.Min);
graphControl.GraphPane.XAxis.Scale.Max = Util.ConvertToDouble(txtMaxX.Text,
graphControl.GraphPane.XAxis.Scale.Max);
}
if (chkYAuto.Checked)
{
graphControl.GraphPane.YAxis.Scale.MaxAuto = chkYAuto.Checked;
graphControl.GraphPane.YAxis.Scale.MinAuto = chkYAuto.Checked;
}
else
{
graphControl.GraphPane.YAxis.Scale.Min = Util.ConvertToDouble(txtMinY.Text,
graphControl.GraphPane.YAxis.Scale.Min);
graphControl.GraphPane.YAxis.Scale.Max = Util.ConvertToDouble(txtMaxY.Text,
graphControl.GraphPane.YAxis.Scale.Max);
}
graphControl.AxisChange();
graphControl.Refresh();
}
示例4: KresliGraf
public static ZedGraphControl KresliGraf(string nazovGrafu,List<Spread> myCustomObjects, ZedGraphControl zg1)
{
zg1.GraphPane.CurveList.Clear();
zg1.GraphPane.GraphObjList.Clear();
GraphPane myPane = zg1.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = nazovGrafu;
myPane.XAxis.Title.Text = "Date";
myPane.YAxis.Title.Text = "$";
myPane.XAxis.Type = AxisType.Date;
PointPairList list = new PointPairList();
int rok = myCustomObjects.First().Date.Year;
DateTime predchadzDatum = myCustomObjects.First().Date;
foreach (var item in myCustomObjects)
{
var x = (double)new XDate(DateTime.Parse(item.Date.ToShortDateString()));
var y = item.Value;
//Console.WriteLine(x + " " + y);
list.Add(x, y);
//Console.WriteLine(rok + " > " + item.Date.Year.ToString() + " " + (item.Date + " > " + new DateTime(item.Date.Year, 1, 1)).ToString() + " " + (predchadzDatum + " < " + new DateTime(item.Date.Year, 1, 1)).ToString());
//Console.WriteLine((rok > item.Date.Year).ToString() + " " + (item.Date > new DateTime(item.Date.Year, 1, 1)).ToString() + " " + (predchadzDatum < new DateTime(item.Date.Year, 1, 1)).ToString());
if (item.Date.Year != predchadzDatum.Year)
{
LineItem line = new LineItem(String.Empty, new[] { x, x }, new[] { myPane.YAxis.Scale.Min, myPane.YAxis.Scale.Max }, Color.Black, SymbolType.None);
line.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
line.Line.Width = 1f;
myPane.CurveList.Add(line);
Console.WriteLine("Datum " + item.Date);
}
predchadzDatum = item.Date;
}
myPane.CurveList.Add(new LineItem("My Curve", list, Color.Blue, SymbolType.None));
zg1.Refresh();
// LineItem myCurve = myPane.AddCurve("My Curve", list, Color.Blue, SymbolType.None);
zg1.AxisChange();
return zg1;
}
示例5: CreateGraph_MultiYDemo
//.........这里部分代码省略.........
myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
myPane.Y2Axis.MajorTic.IsOpposite = false;
myPane.Y2Axis.MinorTic.IsOpposite = false;
// Display the Y2 axis grid lines
myPane.Y2Axis.MajorGrid.IsVisible = true;
// Align the Y2 axis labels so they are flush to the axis
myPane.Y2Axis.Scale.Align = AlignP.Inside;
myPane.Y2Axis.Scale.Min = 1.5;
///////////////////////////////////////////////////////////////////
// Create a second Y Axis, green
YAxis yAxis3 = new YAxis( "Distance, m" );
myPane.YAxisList.Add( yAxis3 );
yAxis3.Scale.FontSpec.FontColor = Color.Green;
yAxis3.Title.FontSpec.FontColor = Color.Green;
yAxis3.Color = Color.Green;
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
yAxis3.MajorTic.IsInside = false;
yAxis3.MinorTic.IsInside = false;
yAxis3.MajorTic.IsOpposite = false;
yAxis3.MinorTic.IsOpposite = false;
// Align the Y2 axis labels so they are flush to the axis
yAxis3.Scale.Align = AlignP.Inside;
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
Y2Axis yAxis4 = new Y2Axis( "Energy" );
yAxis4.IsVisible = true;
myPane.Y2AxisList.Add( yAxis4 );
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
yAxis4.MajorTic.IsInside = false;
yAxis4.MinorTic.IsInside = false;
yAxis4.MajorTic.IsOpposite = false;
yAxis4.MinorTic.IsOpposite = false;
// Align the Y2 axis labels so they are flush to the axis
yAxis4.Scale.Align = AlignP.Inside;
yAxis4.Type = AxisType.Log;
yAxis4.Scale.Min = 100;
/////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
Y2Axis yAxis5 = new Y2Axis( "Another one" );
yAxis5.IsVisible = true;
myPane.Y2AxisList.Add( yAxis5 );
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
yAxis5.MajorTic.IsInside = false;
yAxis5.MinorTic.IsInside = false;
yAxis5.MajorTic.IsOpposite = false;
yAxis5.MinorTic.IsOpposite = false;
// Align the Y2 axis labels so they are flush to the axis
yAxis5.Scale.Align = AlignP.Inside;
//yAxis5.Type = AxisType.Log;
/////////////////////////////////////////////////////////////////
// Fill the axis background with a gradient
myPane.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow, 45.0f );
myPane.IsAlignGrids = true;
// Assume this is an old one
Y2Axis test = new Y2Axis( "test" );
// save the scale
Scale saveScale = test.Scale;
// throw away the "old" Y2 axis
myPane.Y2AxisList.RemoveAt( 1 );
// Create a new YAxis
int index = myPane.YAxisList.Add( "test" );
// replace the actual scale data
foreach ( YAxis axis in myPane.YAxisList )
{
if ( String.Compare( axis.Title.Text, "test", true ) == 0 )
{
// make a new scale
axis.Scale.MakeNewScale( saveScale, AxisType.Linear );
}
}
//int index2 = myPane.YAxisList.IndexOf( "test" );
//int x = myPane.YAxisList.IndexOf( "test" );
//int poop = x;
//YAxis axis = myPane.YAxisList.Find( null );
//myPane.YAxisList.Add( test );
z1.AxisChange();
z1.Refresh();
//for ( int i = 0; i < 10000000; i++ )
// ;
//myPane.Y2AxisList.RemoveAt( myPane.Y2AxisList.Count - 1 );
//myPane.Y2AxisList.RemoveAt( myPane.Y2AxisList.Count - 1 );
//z1.Refresh();
}
示例6: CreateGraph_junk6
private void CreateGraph_junk6( ZedGraphControl z1 )
{
z1.GraphPane.Title.Text = "My Test Graph\n(For CodeProject Sample)";
z1.GraphPane.XAxis.Title.Text = "My X-Axis";
z1.GraphPane.YAxis.Title.Text = "My Y-Axis";
z1.Refresh();
}
示例7: CreateEmptyChart
/**
* Grafico vazio: usado quando aparecem ocupacoes negativas (erros nos dados)
*/
private void CreateEmptyChart(ZedGraphControl zgc) {
GraphPane myPane = zgc.GraphPane;
// Set the GraphPane title
myPane.Title.Text = "";
myPane.Fill.Color = Color.LightGray;
myPane.Chart.Fill.Type = FillType.None;
// Adicionar as fatias:
myPane.CurveList.Clear();
myPane.AddPieSlice(1, Color.LightSlateGray, Color.White, 45f, .0, "Ocupação não calculável");
zgc.AxisChange();
zgc.Refresh();
}
示例8: DisplayInPicture
public static void DisplayInPicture(List<CorePointData> lstCorePt, ZedGraphControl zedGraphControlCore, bool IsClosed)
{
GraphPane myPane = zedGraphControlCore.GraphPane;
//清除原来的图形
myPane.CurveList.Clear();
myPane.GraphObjList.Clear();
//设置网格线可见
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;
//设置网格线颜色
myPane.XAxis.MajorGrid.Color = Color.Chocolate;
myPane.YAxis.MajorGrid.Color = Color.Chocolate;
//设置网格线形式
myPane.XAxis.MajorGrid.DashOff = 1;
myPane.YAxis.MajorGrid.DashOff = 1;
myPane.XAxis.MajorGrid.DashOn = 4;
myPane.YAxis.MajorGrid.DashOn = 4;
//设置显示坐标
myPane.XAxis.Scale.IsUseTenPower = false;
myPane.YAxis.Scale.IsUseTenPower = false;
myPane.XAxis.Scale.MagAuto = true;
myPane.YAxis.Scale.MagAuto = true;
myPane.Title.Text = "重心包线";
myPane.XAxis.Title.Text = "长度(毫米)";
myPane.YAxis.Title.Text = "重量(千克)";
PointPairList listCur = new PointPairList();
double x = 0, y = 0;
string strTitle = string.Empty;
string strValue = string.Empty;
if (lstCorePt != null && lstCorePt.Count > 0)
{
for (int j = 0; j < lstCorePt.Count; j++)
{
x = Math.Round(lstCorePt[j].pointXValue, picDigit);
y = Math.Round(lstCorePt[j].pointYValue, picDigit);
listCur.Add(x, y);
//显示名称
strTitle = lstCorePt[j].pointName;
// 创建一个阴影区域,看起来有渐变
TextObj text = new TextObj(strTitle, x, y,
CoordType.AxisXYScale, AlignH.Right, AlignV.Center);
//是否有背景
text.FontSpec.Fill.IsVisible = false;
//是否有边框
text.FontSpec.Border.IsVisible = false;
//文字是否粗体
text.FontSpec.IsBold = true;
//文字是否斜体
text.FontSpec.IsItalic = false;
//填充
myPane.GraphObjList.Add(text);
}
//是否成环形图形
if (IsClosed)
{
listCur.Add(Math.Round(lstCorePt[0].pointXValue, picDigit), Math.Round(lstCorePt[0].pointYValue, picDigit));
}
LineItem myCurveCur = myPane.AddCurve(string.Empty, listCur, Color.Blue, SymbolType.Default);
myCurveCur.Symbol.Size = 6;
myCurveCur.Symbol.Fill = new Fill(Color.Blue, Color.Blue);
myCurveCur.Symbol.Border.IsVisible = true;
myCurveCur.Line.IsVisible = true;
}
zedGraphControlCore.AxisChange();
zedGraphControlCore.Refresh();
}
示例9: RefreshChart
private void RefreshChart(ZedGraphControl chart)
{
chart.GraphPane.AxisChange();
chart.Refresh();
}
示例10: SoapDeSerialize
private void SoapDeSerialize( ZedGraphControl z1, string fileName )
{
if ( z1 != null && !String.IsNullOrEmpty( fileName ) )
{
SoapFormatter mySerializer = new SoapFormatter();
Stream myReader = new FileStream( fileName, FileMode.Open,
FileAccess.Read, FileShare.Read );
MasterPane master = (MasterPane) mySerializer.Deserialize( myReader );
z1.Refresh();
myReader.Close();
z1.MasterPane = master;
//trigger a resize event
z1.Size = z1.Size;
}
}
示例11: refresh
private void refresh(ZedGraphControl zedC)
{
zedC.AxisChange();
zedC.RestoreScale(zedC.GraphPane);
zedC.Refresh();
}
示例12: axisChangeZedGraph
private void axisChangeZedGraph(ZedGraphControl zg)
{
if (zg.InvokeRequired)
{
axisChangeZedGraphCallBack ad = new axisChangeZedGraphCallBack(axisChangeZedGraph);
zg.Invoke(ad, new object[] { zg });
}
else
{
zg.AxisChange();
zg.Invalidate();
zg.Refresh();
}
}
示例13: CreateGraph
//.........这里部分代码省略.........
//
// clear old coordinates
//
myPane.CurveList.Clear();
zgc.AxisChange();
//
// Make up some data points from the Sine function
PointPairList[] list = new PointPairList[5];
int minValue = 0, maxValue = 0;
//
// set data according by selectedIndex
//
switch (cmbCoordinateName.SelectedIndex)
{
case 0: // DX (Distance of the fox from rabbit on X axis) Input data
{
// size of screen 0 800
minValue = -FuzzyLogic.Width; // Rabbit is very Right than Fox (F-----------R) DX = xFox-xRabbit = -800
maxValue = FuzzyLogic.Width; // Rabbit is very Left than Fox (R-----------F) DX = xFox-xRabbit = +800
} break;
case 1: // DY (Distance of the fox from rabbit on Y axis) Input data
{
// size of screen 0 800
minValue = -FuzzyLogic.Height; // Rabbit is very Up than Fox (F-----------R) DY = xFox-xRabbit = -800
maxValue = FuzzyLogic.Height; // Rabbit is very Down than Fox (R-----------F) DY = xFox-xRabbit = +800
} break;
case 2: // DXF (Amount of the fox displacement distances on the X axis)
case 3: // DYF (Amount of the fox displacement distances on the Y axis)
{
// Amount of the fox displacement distances
minValue = -FuzzyLogic.maxStepSpeed; // (F-----------R)
// -30
//
maxValue = FuzzyLogic.maxStepSpeed; // (R-----------F)
// +30
} break;
}
//
// set double GaussianArray according by selectedIndex
//
double[,] gaussianBuffer = new double[5, 2];
switch (cmbCoordinateName.SelectedIndex)
{
case 0: gaussianBuffer = FuzzyLogic.gaussianData_DX;
break;
case 1: gaussianBuffer = FuzzyLogic.gaussianData_DY;
break;
case 2: gaussianBuffer = FuzzyLogic.gaussianData_DXF;
break;
case 3: gaussianBuffer = FuzzyLogic.gaussianData_DYF;
break;
}
//
for (int i = 0; i < 5; i++) // 5 type for gaussian Coordinate in one plot
{
list[i] = new PointPairList();
for (double x = minValue; x <= maxValue; x++)
{
double y = FuzzyLogic.Gaussian(x, gaussianBuffer[i, 0], gaussianBuffer[i, 1]);
list[i].Add(x, y);
}
}
// Generate a blue curve with circle symbols, and "My Curve" in the legend
LineItem Curve0 = myPane.AddCurve(grb0.Text, list[0], grb0.ForeColor, SymbolType.Circle);
LineItem Curve1 = myPane.AddCurve(grb1.Text, list[1], grb1.ForeColor, SymbolType.Circle);
LineItem Curve2 = myPane.AddCurve(grb2.Text, list[2], grb2.ForeColor, SymbolType.Circle);
LineItem Curve3 = myPane.AddCurve(grb3.Text, list[3], grb3.ForeColor, SymbolType.Circle);
LineItem Curve4 = myPane.AddCurve(grb4.Text, list[4], grb4.ForeColor, SymbolType.Circle);
float allPointSize = 50F;
// Fill the area under the curve with a white-red gradient at 45 degrees
Curve0.Line.Fill = new Fill(Color.Transparent, grb0.ForeColor, allPointSize);
// Make the symbols opaque by filling them with white
Curve0.Symbol.Fill = new Fill(Color.Transparent);
// Fill the area under the curve with a white-red gradient at 45 degrees
Curve1.Line.Fill = new Fill(Color.Transparent, grb1.ForeColor, allPointSize);
// Make the symbols opaque by filling them with white
Curve1.Symbol.Fill = new Fill(Color.Transparent);
// Fill the area under the curve with a white-red gradient at 45 degrees
Curve2.Line.Fill = new Fill(Color.Transparent, grb2.ForeColor, allPointSize);
// Make the symbols opaque by filling them with white
Curve2.Symbol.Fill = new Fill(Color.Transparent);
// Fill the area under the curve with a white-red gradient at 45 degrees
Curve3.Line.Fill = new Fill(Color.Transparent, grb3.ForeColor, allPointSize);
// Make the symbols opaque by filling them with white
Curve3.Symbol.Fill = new Fill(Color.Transparent);
// Fill the area under the curve with a white-red gradient at 45 degrees
Curve4.Line.Fill = new Fill(Color.Transparent, grb4.ForeColor, allPointSize);
// Make the symbols opaque by filling them with white
Curve4.Symbol.Fill = new Fill(Color.Transparent);
// Calculate the Axis Scale Ranges
zgc.AxisChange();
zgc.Refresh();
}
示例14: init_zed
private bool init_zed(ref ZedGraphControl zed, PointPairList list1, PointPairList list2)
{
try
{
LineItem myCurve1;
LineItem myCurve2;
//list.Clear();
zed.GraphPane.CurveList.Clear();//折线图清空
zed.GraphPane.GraphObjList.Clear();
zed.AxisChange();
zed.Refresh();
// list = init_zed_data(4, comboBox2.Text.ToString(), 1, 120);
myCurve1 = zed.GraphPane.AddCurve("深基点", list1, Color.Red, SymbolType.None);
myCurve2 = zed.GraphPane.AddCurve("浅基点", list2, Color.Blue, SymbolType.None);
zed.AxisChange();
zed.Refresh();
return true;
}
catch
{
return false;
}
}
示例15: AddPoint
//--------------------------实时显示----------------------
private void AddPoint(ref ZedGraphControl zedgraph, ref PointPairList list, double x, double y)
{
try
{
//LineItem mycurve = zedgraph.GraphPane.AddCurve("", list, Color.DarkBlue, SymbolType.Circle);
list.Add(x, y);
if (list.Count > 120)
list.RemoveAt(0);
if (zedgraph != null)
{
zedgraph.AxisChange();
zedgraph.Refresh();
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.ToString());
return;
}
finally
{
GC.Collect();
}
}