本文整理汇总了C#中ZedGraph.ZedGraphControl.AxisChange方法的典型用法代码示例。如果您正苦于以下问题:C# ZedGraphControl.AxisChange方法的具体用法?C# ZedGraphControl.AxisChange怎么用?C# ZedGraphControl.AxisChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.ZedGraphControl
的用法示例。
在下文中一共展示了ZedGraphControl.AxisChange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowHistorgam
public static void ShowHistorgam(string title, string[] xLabels, double[] yValues)
{
// Графики строятся сторонней библиотекой ZedGraph. Документацию можно найти тут http://zedgraph.sourceforge.net/samples.html
// Не бойтесь экспериментировать с кодом самостоятельно!
var chart = new ZedGraphControl()
{
Dock = DockStyle.Fill
};
chart.GraphPane.Title.Text = title;
chart.GraphPane.YAxis.Title.Text = "Y";
chart.GraphPane.AddBar("", Enumerable.Range(0, yValues.Length).Select(i => (double)i).ToArray(), yValues, Color.Blue);
chart.GraphPane.YAxis.Scale.MaxAuto = true;
chart.GraphPane.YAxis.Scale.MinAuto = true;
chart.GraphPane.XAxis.Type = AxisType.Text;
chart.GraphPane.XAxis.Scale.TextLabels = xLabels;
chart.AxisChange();
// Form — это привычное нам окно программы. Это одна из главных частей подсистемы под названием Windows Forms http://msdn.microsoft.com/ru-ru/library/ms229601.aspx
var form = new Form();
form.Text = title;
form.Size = new Size(800, 600);
form.Controls.Add(chart);
form.ShowDialog();
}
示例2: 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();
}
示例3: CreateErrorChart
public void CreateErrorChart(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
// Set the title and axis labels
myPane.Title.Text = "Errors Found In the PCAP";
myPane.XAxis.Title.Text = "Stream ID";
myPane.YAxis.Title.Text = "Error Count";
// create the curves
BarItem[] bars = new BarItem[_errorTotals.Length];
for(int i=0;i!=_errorTotals.Length;i++)
{
bars[i] = myPane.AddBar(i.ToString(), _errorTotals[i], Color.Bisque);
}
//BarItem myCurve = myPane.AddBar("curve 1", list, Color.Blue);
//BarItem myCurve2 = myPane.AddBar("curve 2", list2, Color.Red);
//BarItem myCurve3 = myPane.AddBar("curve 3", list3, Color.Green);
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill(Color.White,
Color.FromArgb(255, 255, 166), 45.0F);
zgc.AxisChange();
// expand the range of the Y axis slightly to accommodate the labels
myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep;
// Create TextObj's to provide labels for each bar
BarItem.CreateBarLabels(myPane, false, "f0");
}
示例4: 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";
var list = _GetData();
// 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();
}
示例5: ShowHeatmap
public static void ShowHeatmap(string title, double[,] heat, int xMin, int yMin)
{
var chart = new ZedGraphControl()
{
Dock = DockStyle.Fill
};
var maxHeat = heat.Cast<double>().Max();
chart.GraphPane.Title.Text = title;
chart.GraphPane.YAxis.Title.Text = "";
var maxSize = Math.Max(heat.GetLength(0), heat.GetLength(1));
for (int x = 0; x < heat.GetLength(0); x++)
for (int y = 0; y < heat.GetLength(1); y++)
{
var value = heat[x, y];
if (value > 1000) throw new ArgumentException("too large heat value " + value);
var color = Color.FromArgb(255, 50, (int)(255 * value / maxHeat), 0);
var lineItem = chart.GraphPane.AddCurve("", new double[] { x + xMin }, new double[] { y + yMin }, color);
lineItem.Symbol.Type = SymbolType.Circle;
lineItem.Symbol.Fill = new Fill(color);
lineItem.Symbol.Size = (float)(600 * value / maxHeat / maxSize);
}
chart.GraphPane.YAxis.Scale.MaxAuto = true;
chart.GraphPane.YAxis.Scale.MinAuto = true;
chart.AxisChange();
var form = new Form();
form.Text = title;
form.Size = new Size(800, 600);
form.Controls.Add(chart);
form.ShowDialog();
}
示例6: 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 = "Temperature Graph";
myPane.YAxis.Title.Text = "Temperature";
myPane.XAxis.Title.Text = "Time";
myPane.XAxis.Type = AxisType.Date;
//myPane.XAxis.Scale.Format
// Generate a red curve with diamond
// symbols, and "Porsche" in the legend
LineItem myCurve = myPane.AddCurve("Ambient",
list1, Color.Red, SymbolType.None);
// Generate a blue curve with circle
// symbols, and "Piper" in the legend
LineItem myCurve2 = myPane.AddCurve("Thermocouple",
list2, Color.Blue, SymbolType.None);
// Tell ZedGraph to refigure the
// axes since the data have changed
zgc.AxisChange();
}
示例7: 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();
}
示例8: ZedGraphFigure
public ZedGraphFigure(ZedGraphControl zg) {
this.ClientSize = new Size(500, 400);
mZG = zg;
mZG.Parent = this;
mZG.Location = new Point(BorderSize, BorderSize);
mZG.Size = new Size(ClientRectangle.Width - 2*BorderSize, ClientRectangle.Height - 2*BorderSize);
mZG.AxisChange();
}
示例9: 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;
}
示例10: Graph
public Graph(ZedGraphControl zedGraphControl1, string graphTitle, string xAxisTitle, string yAxisTitle, string name1,string name2,string name3)
{
this.zedGraphControl1 = zedGraphControl1;
myPane = zedGraphControl1.GraphPane;
myPane.Title.Text = graphTitle;
myPane.XAxis.Title.Text = xAxisTitle;
myPane.YAxis.Title.Text = yAxisTitle;
// 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 list1 = new RollingPointPairList(70000);
//RollingPointPairList list2 = new RollingPointPairList(70000);
//RollingPointPairList list3 = new RollingPointPairList(70000);
// Initially, a curve is added with no data points (list is empty)
// Color is blue, and there will be no symbol
// LineItem curve1 = myPane.AddCurve(name1, list1, Color.Red, SymbolType.None);
// LineItem curve2 = myPane.AddCurve(name2, list2, Color.Blue, SymbolType.None);
// LineItem curve3 = myPane.AddCurve(name3, list3, Color.Green, SymbolType.None);
// curve1.Line.Width = 1.75F;
// curve2.Line.Width = 1.75F;
// curve3.Line.Width = 1.75F;
// Console.WriteLine(zedGraphControl1.GraphPane.CurveList[0].Label.Text);
// Console.WriteLine(curve1.Label.Text);
//foreach (String s in hashTable.Keys)
//{
// curves.Add(myPane.AddCurve(s,new RollingPointPairList(70000),Color.Red,SymbolType.None));
//}
//curve.Line.Fill = new Fill(Color.White, Color.Red, 45F);
//curve.Line.Width = 2F;
// Just manually control the X axis range so it scrolls continuously
// instead of discrete step-sized jumps
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 50;
myPane.XAxis.Scale.MinorStep = 0;
myPane.XAxis.Scale.MajorStep = 3;
// Scale the axes
zedGraphControl1.AxisChange();
// Save the beginning time for reference
tickStart = Environment.TickCount;
}
示例11: SetReflectogramZedgraphStyle
public static void SetReflectogramZedgraphStyle(ZedGraphControl zedGraph)
{
try
{
GraphPane graphpane = zedGraph.GraphPane;
graphpane.Border.Color = SystemColors.Control;
graphpane.Fill.Color = SystemColors.Control;
graphpane.IsFontsScaled = false;
// Set the titles and axis labels
graphpane.Title.Text = "Рефлектограмма";
graphpane.XAxis.Title.Text = "Дискрет вермени";
graphpane.YAxis.Title.Text = "U, ед. АЦП";
// Show the x axis grid
graphpane.XAxis.MajorGrid.IsVisible = true;
graphpane.XAxis.Scale.Max = 4100;
// turn off the opposite tics so the Y tics don't show up on the Y2 axis
graphpane.YAxis.MajorTic.IsOpposite = false;
graphpane.YAxis.MinorTic.IsOpposite = false;
// Don't display the Y zero line
graphpane.YAxis.MajorGrid.IsZeroLine = false;
// Align the Y axis labels so they are flush to the axis
graphpane.YAxis.Scale.Align = AlignP.Inside;
// Manually set the axis range
// Fill the axis background with a gradient
graphpane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);
graphpane.IsBoundedRanges = true;
// Enable scrollbars if needed
zedGraph.IsAutoScrollRange = true;
zedGraph.IsScrollY2 = true;
// OPTIONAL: Show tooltips when the mouse hovers over a point
zedGraph.IsShowPointValues = true;
// Tell ZedGraph to calculate the axis ranges
// Note that you MUST call this after enabling IsAutoScrollRange, since AxisChange() sets
// up the proper scrolling parameters
zedGraph.AxisChange();
}
catch (Exception ex)
{
FileWorker.WriteEventFile(DateTime.Now, "ALayout", "SetReflectogramZedgraphStyle", ex.Message);
}
}
示例12: CreateChart
public void CreateChart(ZedGraphControl zgc)
{
GraphPane myPane = zgc.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 from the Sine function
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for (int i = 0; i < 36; i++)
{
double x = new XDate(1995, i + 1, 1);
double y = Math.Sin((double)i * Math.PI / 15.0);
double y2 = 2 * y;
list.Add(x, y);
list2.Add(x, y2);
}
// Generate a blue curve with circle symbols, and "My Curve 2" in the legend
LineItem myCurve2 = myPane.AddCurve("My Curve 2", list, Color.Blue,
SymbolType.Circle);
// Fill the area under the curve with a white-red gradient at 45 degrees
myCurve2.Line.Fill = new Fill(Color.Red, Color.Pink, 90F);
myCurve2.Line.FillFromBottom = true;
// Make the symbols opaque by filling them with white
myCurve2.Symbol.Fill = new Fill(Color.White);
// Generate a red curve with diamond symbols, and "My Curve" in the legend
LineItem myCurve = myPane.AddCurve("My Curve",
list2, Color.MediumVioletRed, SymbolType.Diamond);
// Fill the area under the curve with a white-green gradient
//myCurve.Line.Fill = new Fill(Color.White, Color.Green);
// Make the symbols opaque by filling them with white
myCurve.Symbol.Fill = new Fill(Color.White);
// Set the XAxis to date type
myPane.XAxis.Type = AxisType.Date;
// Fill the axis background with a color gradient
myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);
// Calculate the Axis Scale Ranges
zgc.AxisChange();
}
示例13: CreateGraph
private void CreateGraph(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
myPane.Title.Text = "Temperature Graph";
myPane.YAxis.Title.Text = "Temperature";
myPane.XAxis.Title.Text = "Time";
myPane.XAxis.Type = AxisType.Date;
LineItem curve1 = myPane.AddCurve("NewK", list1, Color.Red, SymbolType.None);
LineItem curve2 = myPane.AddCurve("OldK", list2, Color.Blue, SymbolType.None);
LineItem curve3 = myPane.AddCurve("OldT", list3, Color.Green, SymbolType.None);
LineItem curve4 = myPane.AddCurve("OldJ", list4, Color.Purple, SymbolType.None);
LineItem curve5 = myPane.AddCurve("OldE", list5, Color.Orange, SymbolType.None);
zgc.AxisChange();
}
示例14: CreateGraph
private static void CreateGraph(ZedGraphControl zgc, GraphModel graphModel)
{
// get a reference to the GraphPane
var myPane = zgc.GraphPane;
// Set the Titles
myPane.Title.Text = graphModel.TitleText;
myPane.XAxis.Title.Text = graphModel.XTitleText;
myPane.YAxis.Title.Text = graphModel.YTitleText;
// Generate a red curve with diamond
// symbols, and "Porsche" in the legend
myPane.AddCurve(string.Empty, graphModel.Values, Color.Red, SymbolType.Circle);
// Tell ZedGraph to refigure the
// axes since the data have changed
zgc.AxisChange();
}
示例15: 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();
}