本文整理汇总了C#中ZedGraph.ZedGraphControl.Invalidate方法的典型用法代码示例。如果您正苦于以下问题:C# ZedGraphControl.Invalidate方法的具体用法?C# ZedGraphControl.Invalidate怎么用?C# ZedGraphControl.Invalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.ZedGraphControl
的用法示例。
在下文中一共展示了ZedGraphControl.Invalidate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGraph
public static Bitmap GetGraph(List<int> data, List<DateTime> date, string xAxis, string yAxis, string graphName)
{
ZedGraphControl zedGraph = new ZedGraphControl();
if (data.Count == 0)
{
return null;
}
if (data.Count == 1)
{
data.Add(data[0]);
date.Add(date[0].AddSeconds(1));
}
GraphPane myPane = zedGraph.GraphPane;
myPane.CurveList.Clear();
PointPairList list1 = new PointPairList();
DateTime l, r;
l = date.First();
r = date.Last();
for (int i = 0; i < data.Count; i++)
{
list1.Add(date[i].ToOADate(), data[i]);
}
LineItem myCurve = myPane.AddCurve("Line1",
list1, Color.Red, SymbolType.Diamond);
myPane.XAxis.Type = AxisType.Date;
myPane.YAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.DashOff = 0;
myPane.YAxis.MajorGrid.Color = Color.DarkGray;
myPane.XAxis.Scale.Min = l.ToOADate();
myPane.XAxis.Scale.Max = r.ToOADate();
myPane.XAxis.Scale.Format = "dd-MMM-yy";
myPane.XAxis.Title.Text = xAxis;
myPane.YAxis.Title.Text = yAxis;
myPane.Title.Text = graphName;
myPane.Legend.IsVisible = false;
zedGraph.Enabled = false;
myCurve.Line.Width = 4.0F;
myCurve.Line.Color = Color.FromArgb(189, 43, 43);
myCurve.Line.Fill = new Fill(Color.FromArgb(100, 207, 236, 255),
Color.FromArgb(200, 145, 213, 255), 90F);
myCurve.Symbol.Size = 12.0F;
myCurve.Symbol.Fill = new Fill(Color.FromArgb(145, 16, 16));
myCurve.Symbol.Border.Color = Color.FromArgb(99, 4, 4);
zedGraph.AxisChange();
zedGraph.Invalidate();
Bitmap bmp = zedGraph.MasterPane.GetImage(1024, 768, 96);
return bmp;
}
示例2: Clear
//метод очищает полотно для рисования
public void Clear(ZedGraphControl control)
{
// Получим панель для рисования
GraphPane pane = control.GraphPane;
// Очистим список кривых
pane.CurveList.Clear();
// Обновляем график
control.Invalidate();
}
示例3: 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();
}
}
示例4: CreateScatterplot
public void CreateScatterplot(ZedGraphControl zgc, double[,] graph)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = _sourceColumns[0];
myPane.YAxis.Title.Text = _sourceColumns[1];
// Classification problem
PointPairList list1 = new PointPairList(); // Z = -1
PointPairList list2 = new PointPairList(); // Z = +1
for (int i = 0; i < graph.GetLength(0); i++)
{
if (graph[i, 2] == 0)
list1.Add(graph[i, 0], graph[i, 1]);
if (graph[i, 2] == 1)
list2.Add(graph[i, 0], graph[i, 1]);
}
// Add the curve
LineItem myCurve = myPane.AddCurve("G1", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2", list2, Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
// Fill the background of the chart rect and pane
//myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
//myPane.Fill = new Fill(Color.White, Color.SlateGray, 45.0f);
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}
示例5: CreateGraph
///////////////////////////////////////////////////////////////////////////////////////////////
// Build the Chart
private void CreateGraph(ZedGraphControl zgc)
{
// get a reference to the GraphPane
GraphPane myPane = zgc.GraphPane;
// Set the Titles
myPane.Title.Text = microphone.title;
myPane.XAxis.Title.Text = "";
myPane.YAxis.Title.Text = "";
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsZeroLine = false;
myPane.XAxis.Scale.Min = -1;
myPane.XAxis.Scale.Max = 1;
// По оси Y установим автоматический подбор масштаба
myPane.YAxis.Scale.MinAuto = true;
myPane.YAxis.Scale.MaxAuto = true;
// Создаем список точек
RadarPointList points = new RadarPointList();
// Т.к. в списке будет 4 точки, то и окружность будет разбиваться на 4 части
// Обход точек будет осуществляться по часовой стрелке
points.Clockwise = true;
// Первая точка - сверху над началом координат. Расстояние до центра = 1. Второй параметр в большинстве случаев не используется
for (int i = 0; i < pointsArray.Length; i++)
{
points.Add(pointsArray[i], 1);
}
// Добавляем кривую по этим четырем точкам
LineItem myCurve = myPane.AddCurve("", points, Color.Black, SymbolType.None);
// Отметим начало координат черным квадратиком
BoxObj box = new BoxObj(-0.005, 0.005, 0.01, 0.01, Color.Black, Color.Black);
myPane.GraphObjList.Add(box);
zgc.AxisChange();
zgc.Invalidate();
}
示例6: draw
private void draw(int[] x, int[] y, int[] z, ZedGraphControl zgcHist, string filename)
{
GraphPane pane = zgcHist.GraphPane;
pane.CurveList.Clear();
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for (long j = 0; j < x.Length; j++) {
list.Add(x[j], y[j]);
list2.Add(x[j], z[j]);
}
pane.AddBar("Histogram", list, Color.Black);
pane.AddCurve("The mean", list2, Color.Coral, SymbolType.None);
pane.YAxis.Scale.Min = 0;
pane.YAxis.Scale.Max = 1.1*y.Max();
pane.XAxis.Scale.Min = -100;
pane.XAxis.Scale.Max = 100;
zgcHist.AxisChange();
zgcHist.Invalidate();
}
示例7: DrawValues
/// <summary>
/// Draws the values.
/// </summary>
/// <param name="functionVector">The function vector.</param>
/// <param name="zedGraphControl">The zed graph control.</param>
/// <param name="title">The title.</param>
/// <param name="color">The color.</param>
private void DrawValues(double[] functionVector, ZedGraphControl zedGraphControl, String title, Color color)
{
var graphPane = zedGraphControl.GraphPane;
graphPane.XAxis.Title.Text = "Count number";
graphPane.YAxis.Title.Text = "Value of the function";
graphPane.Title.Text = title;
graphPane.CurveList.Clear();
var pointList = new PointPairList();
for (var i = 0; i < functionVector.Length; i++)
{
pointList.Add(i, functionVector[i]);
}
graphPane.AddCurve(String.Empty, pointList, color);
zedGraphControl.AxisChange();
zedGraphControl.Invalidate();
}
示例8: 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();
}
示例9: Draw
private void Draw(int[] x, int[] y, int[] z, ZedGraphControl zgcHist, string filename)
{
GraphPane pane = zgcHist.GraphPane;
pane.CurveList.Clear();
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for (long j = 0; j < x.Length; j++)
{
list.Add(x[j], y[j]);
list2.Add(x[j], z[j]);
}
pane.AddBar("Гистограмма", list, Color.IndianRed);
pane.AddCurve("Ожидаемый результат", list2, Color.Crimson, SymbolType.None);
pane.YAxis.Scale.Min = 0;
pane.YAxis.Scale.Max = 1.1*y.Max();
pane.XAxis.Scale.Min = -100;
pane.XAxis.Scale.Max = 100;
pane.Title.Text = filename;
zgcHist.AxisChange();
zgcHist.Invalidate();
}
示例10: CreateResultScatterplot
public void CreateResultScatterplot(ZedGraphControl zgc, double[][] inputs, double[] expected, double[] output)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = sourceColumns[0];
myPane.YAxis.Title.Text = sourceColumns[1];
// Classification problem
PointPairList list1 = new PointPairList(); // Z = -1, OK
PointPairList list2 = new PointPairList(); // Z = +1, OK
PointPairList list3 = new PointPairList(); // Z = -1, Error
PointPairList list4 = new PointPairList(); // Z = +1, Error
for (int i = 0; i < output.Length; i++)
{
if (output[i] == -1)
{
if (expected[i] == -1)
list1.Add(inputs[i][0], inputs[i][1]);
if (expected[i] == 1)
list3.Add(inputs[i][0], inputs[i][1]);
}
else
{
if (expected[i] == -1)
list4.Add(inputs[i][0], inputs[i][1]);
if (expected[i] == 1)
list2.Add(inputs[i][0], inputs[i][1]);
}
}
// Add the curve
LineItem
myCurve = myPane.AddCurve("G1 Hits", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2 Hits", list2, Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
myCurve = myPane.AddCurve("G1 Miss", list3, Color.Blue, SymbolType.Plus);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = true;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2 Miss", list4, Color.Green, SymbolType.Plus);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = true;
myCurve.Symbol.Fill = new Fill(Color.Green);
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}
示例11: CreateBarGraph
public void CreateBarGraph(ZedGraphControl zgc, double[] discriminants)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
myPane.Title.IsVisible = false;
myPane.Legend.IsVisible = false;
myPane.Border.IsVisible = false;
myPane.Border.IsVisible = false;
myPane.Margin.Bottom = 20f;
myPane.Margin.Right = 20f;
myPane.Margin.Left = 20f;
myPane.Margin.Top = 30f;
myPane.YAxis.Title.IsVisible = true;
myPane.YAxis.IsVisible = true;
myPane.YAxis.MinorGrid.IsVisible = false;
myPane.YAxis.MajorGrid.IsVisible = false;
myPane.YAxis.IsAxisSegmentVisible = false;
myPane.YAxis.Scale.Max = 9.5;
myPane.YAxis.Scale.Min = -0.5;
myPane.YAxis.MajorGrid.IsZeroLine = false;
myPane.YAxis.Title.Text = "Classes";
myPane.YAxis.MinorTic.IsOpposite = false;
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsInside = false;
myPane.YAxis.MajorTic.IsInside = false;
myPane.YAxis.MinorTic.IsOutside = false;
myPane.YAxis.MajorTic.IsOutside = false;
myPane.XAxis.MinorTic.IsOpposite = false;
myPane.XAxis.MajorTic.IsOpposite = false;
myPane.XAxis.Title.IsVisible = true;
myPane.XAxis.Title.Text = "Relative class response";
myPane.XAxis.IsVisible = true;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 100;
myPane.XAxis.IsAxisSegmentVisible = false;
myPane.XAxis.MajorGrid.IsVisible = false;
myPane.XAxis.MajorGrid.IsZeroLine = false;
myPane.XAxis.MinorTic.IsOpposite = false;
myPane.XAxis.MinorTic.IsInside = false;
myPane.XAxis.MinorTic.IsOutside = false;
myPane.XAxis.Scale.Format = "0'%";
// Create data points for three BarItems using Random data
PointPairList list = new PointPairList();
for (int i = 0; i < discriminants.Length; i++)
list.Add(discriminants[i] * 100, i);
BarItem myCurve = myPane.AddBar("b", list, Color.DarkBlue);
// Set BarBase to the YAxis for horizontal bars
myPane.BarSettings.Base = BarBase.Y;
zgc.AxisChange();
zgc.Invalidate();
}
示例12: CreateScatterplot
public void CreateScatterplot(ZedGraphControl zgc, double[,] graph)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = columnNames[0];
myPane.YAxis.Title.Text = columnNames[1];
// Regression problem
PointPairList list1 = new PointPairList();
for (int i = 0; i < graph.GetLength(0); i++)
list1.Add(graph[i, 0], graph[i, 1]);
// Add the curve
LineItem myCurve = myPane.AddCurve("Y", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}
示例13: CreateResultScatterplot
public void CreateResultScatterplot(ZedGraphControl zgc, double[][] inputs, double[] expected, double[] output)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = columnNames[0];
myPane.YAxis.Title.Text = columnNames[1];
// Regression problem
PointPairList list1 = new PointPairList(); // svm output
PointPairList list2 = new PointPairList(); // expected output
for (int i = 0; i < inputs.Length; i++)
{
list1.Add(inputs[i][0], output[i]);
list2.Add(inputs[i][0], expected[i]);
}
// Add the curve
LineItem myCurve = myPane.AddCurve("Model output", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = true;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("Data output", list2, Color.Red, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Red);
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}
示例14: CreateScatterplot
public void CreateScatterplot(ZedGraphControl zgc, double[][] graph, int n)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set graph pane object
myPane.Title.Text = "Normal (Gaussian) Distributions";
myPane.XAxis.Title.Text = "X";
myPane.YAxis.Title.Text = "Y";
myPane.XAxis.Scale.Max = 10;
myPane.XAxis.Scale.Min = -10;
myPane.YAxis.Scale.Max = 10;
myPane.YAxis.Scale.Min = -10;
myPane.XAxis.IsAxisSegmentVisible = false;
myPane.YAxis.IsAxisSegmentVisible = false;
myPane.YAxis.IsVisible = false;
myPane.XAxis.IsVisible = false;
myPane.Border.IsVisible = false;
// Create mixture pairs
PointPairList list = new PointPairList();
for (int i = 0; i < graph.Length; i++)
list.Add(graph[i][0], graph[i][1]);
// Add the curve for the mixture points
LineItem myCurve = myPane.AddCurve("Mixture", list, Color.Gray, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Gray);
for (int i = 0; i < n; i++)
{
// Add curves for the clusters to be detected
Color color = colors[i];
myCurve = myPane.AddCurve("D" + (i + 1), new PointPairList(), color, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(color);
}
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}
示例15: createMappingScatterplot
/// <summary>
/// Creates the space mapping scatter plot using ZedGraph.
/// </summary>
///
private void createMappingScatterplot(ZedGraphControl zgc, double[,] graph)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.Text = "Scatter Plot";
myPane.XAxis.Title.Text = "X";
myPane.YAxis.Title.Text = "Y";
myPane.XAxis.IsAxisSegmentVisible = false;
myPane.YAxis.IsAxisSegmentVisible = false;
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
PointPairList list3 = new PointPairList();
for (int i = 0; i < graph.GetLength(0); i++)
{
if (graph[i, 2] == 1.0)
list1.Add(graph[i, 0], graph[i, 1]);
if (graph[i, 2] == 2.0)
list2.Add(graph[i, 0], graph[i, 1]);
if (graph[i, 2] == 3.0)
list3.Add(graph[i, 0], graph[i, 1]);
}
// Add the curve
LineItem myCurve = myPane.AddCurve("G1", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2", list2, Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
myCurve = myPane.AddCurve("G3", list3, Color.Orange, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Orange);
myCurve = myPane.AddCurve("M1", new PointPairList(), Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("M2", new PointPairList(), Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
myCurve = myPane.AddCurve("M3", new PointPairList(), Color.Orange, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Yellow);
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}