本文整理汇总了C#中ZedGraph.GraphPane类的典型用法代码示例。如果您正苦于以下问题:C# GraphPane类的具体用法?C# GraphPane怎么用?C# GraphPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphPane类属于ZedGraph命名空间,在下文中一共展示了GraphPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScaleAxisLabels
/// <summary>
/// Rescale font size of x axis labels when the graph is zoomed or resized.
/// </summary>
/// <param name="width">Width of the graph in pixels.</param>
/// <param name="pane">GraphPane of the graph.</param>
public static void ScaleAxisLabels(int width, GraphPane pane)
{
if (pane.XAxis.Scale.TextLabels == null)
return;
pane.XAxis.Scale.IsPreventLabelOverlap = false;
int countLabels = (int) Math.Ceiling(pane.XAxis.Scale.Max - pane.XAxis.Scale.Min) + 1;
float dxAvailable = (float) width / countLabels;
var fontSpec = pane.XAxis.Scale.FontSpec;
int pointSize;
for (pointSize = 12; pointSize > 4; pointSize--)
{
using (var font = new Font(fontSpec.Family, pointSize))
{
// See if the original labels fit with this font
int maxWidth = MaxWidth(font, pane.XAxis.Scale.TextLabels);
if (maxWidth <= dxAvailable)
break;
}
}
pane.XAxis.Scale.FontSpec.Size = pointSize;
pane.AxisChange();
}
示例2: AddCurve
public void AddCurve(GraphPane pane, string name, string measure, Color color, SymbolType sType, int capacity)
{
_dataPointList = new RollingPointPairList(capacity);
// Добавим кривую пока еще без каких-либо точек
_myCurve = pane.AddCurve(string.Format("{0} ({1})",name,measure), _dataPointList, color, sType);
}
示例3: GraphPane_AxisChangeEvent
public void GraphPane_AxisChangeEvent(GraphPane pane)
{
if (sameStepForXY)
{
double realHeight = (zedGraphControl.GraphPane.YAxis.Scale.Max - zedGraphControl.GraphPane.YAxis.Scale.Min) * heightMultiplier;
double realWidth = zedGraphControl.GraphPane.XAxis.Scale.Max - zedGraphControl.GraphPane.XAxis.Scale.Min;
DoubleExtension multiplier, smallVal, bigVal;
if (realHeight > realWidth)
{
multiplier = new DoubleExtension(realHeight / realWidth);
MathExtension.MiddleBasedResize(new DoubleExtension(zedGraphControl.GraphPane.XAxis.Scale.Min), new DoubleExtension(zedGraphControl.GraphPane.XAxis.Scale.Max), multiplier, out smallVal, out bigVal);
zedGraphControl.GraphPane.XAxis.Scale.Min = smallVal.AccurateValue;
zedGraphControl.GraphPane.XAxis.Scale.Max = bigVal.AccurateValue;
zedGraphControl.GraphPane.XAxis.Scale.MajorStep = MathExtension.DynamicRound((bigVal.AccurateValue - smallVal.AccurateValue) / 6);
zedGraphControl.GraphPane.XAxis.Scale.MinorStep = MathExtension.DynamicRound((bigVal.AccurateValue - smallVal.AccurateValue) / 6) / 4;
}
else
{
multiplier = new DoubleExtension(realWidth / realHeight);
MathExtension.MiddleBasedResize(new DoubleExtension(zedGraphControl.GraphPane.YAxis.Scale.Min), new DoubleExtension(zedGraphControl.GraphPane.YAxis.Scale.Max), multiplier, out smallVal, out bigVal);
zedGraphControl.GraphPane.YAxis.Scale.Min = smallVal.AccurateValue;
zedGraphControl.GraphPane.YAxis.Scale.Max = bigVal.AccurateValue;
zedGraphControl.GraphPane.YAxis.Scale.MajorStep = MathExtension.DynamicRound((bigVal.AccurateValue - smallVal.AccurateValue) / 6);
zedGraphControl.GraphPane.YAxis.Scale.MinorStep = MathExtension.DynamicRound((bigVal.AccurateValue - smallVal.AccurateValue) / 6) / 4;
}
}
}
示例4: 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 );
}
}
示例5: 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;
}
示例6: AddHistogram
/// <summary>
/// Add a plot of the 1D histogram. You should call the Refresh() function to update the control after all modification is complete.
/// </summary>
/// <param name="name">The name of the histogram</param>
/// <param name="color">The drawing color</param>
/// <param name="histogram">The 1D histogram to be drawn</param>
public void AddHistogram(String name, System.Drawing.Color color, Histogram histogram)
{
Debug.Assert(histogram.Dimension == 1, "Only 1D histogram is supported");
GraphPane pane = new GraphPane();
// Set the Title
pane.Title.Text = name;
pane.XAxis.Title.Text = "Color Intensity";
pane.YAxis.Title.Text = "Pixel Count";
#region draw the histogram
RangeF range = histogram.Ranges[0];
int binSize = histogram.BinDimension[0].Size;
float step = (range.Max - range.Min) / binSize;
float start = range.Min;
double[] bin = new double[binSize];
for (int binIndex = 0; binIndex < binSize; binIndex++)
{
bin[binIndex] = start;
start += step;
}
PointPairList pointList = new PointPairList(
bin,
Array.ConvertAll<float, double>(histogram.Data, System.Convert.ToDouble));
pane.AddCurve(name, pointList, color);
#endregion
zedGraphControl1.MasterPane.Add(pane);
}
示例7: InitGraph
private void InitGraph(string title, string xAxisTitle, string y1AxisTitle, string y2AxisTitle, SummaryDataSource[] dataSourceArray)
{
_graphPane = zed.GraphPane;
_graphPane.Title.Text = title;
_graphPane.XAxis.Title.Text = xAxisTitle;
_graphPane.XAxis.MajorGrid.IsVisible = true;
_graphPane.YAxis.Title.Text = y1AxisTitle;
_graphPane.YAxis.MajorGrid.IsVisible = true;
_graphPane.Y2Axis.Title.Text = y2AxisTitle;
_graphPane.Y2Axis.MajorGrid.IsVisible = false;
// Create point-pair lists and bind them to the graph control.
int sourceCount = dataSourceArray.Length;
_pointPlotArray = new PointPairList[sourceCount];
for(int i=0; i<sourceCount; i++)
{
SummaryDataSource ds = dataSourceArray[i];
_pointPlotArray[i] =new PointPairList();
Color color = _plotColorArr[i % 3];
BarItem barItem = _graphPane.AddBar(ds.Name, _pointPlotArray[i], color);
barItem.Bar.Fill = new Fill(color);
_graphPane.BarSettings.MinClusterGap = 0;
barItem.IsY2Axis = (ds.YAxis == 1);
}
}
示例8: RenderBarLabel
/// <summary>
/// Render text at the bottom of a bar
/// </summary>
/// <param name="gp"></param>
/// <param name="d"></param>
/// <param name="x"></param>
protected override void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
{
var requestText = new TextObj(d.Request + " -", x, 0).Style(Color.Black, 7);
requestText.FontSpec.Angle = 25;
requestText.Location.AlignH = AlignH.Right;
gp.GraphObjList.Add(requestText);
}
示例9: 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();
}
示例10: ZedGraphDataLoader
public ZedGraphDataLoader(ZedGraphControl chart)
{
chart1 = chart;
pane = chart1.GraphPane;
pane.Chart.Border.IsVisible = false;
// set scale
pane.YAxis.Scale.MinGrace = 0;
pane.YAxis.Scale.MaxGrace = 0;
pane.XAxis.Scale.MinGrace = 0;
pane.XAxis.Scale.MaxGrace = 0;
pane.XAxis.Scale.MagAuto = false;
pane.YAxis.Scale.MagAuto = false;
SetPaneVisible(false);
chart1.ZoomEvent += chart1_ZoomEvent;
chart1.MouseDownEvent += chart1_MouseDownEvent;
chart1.MouseUpEvent += chart1_MouseUpEvent;
using (Graphics g = chart1.CreateGraphics())
{
_dpiFactor = Convert.ToSingle(g.DpiX / 96.0);
}
// set fonts
ApplyFontDefaults();
}
示例11: ZoomState
/// <summary>
/// Construct a <see cref="ZoomState"/> object from the scale ranges settings contained
/// in the specified <see cref="GraphPane"/>.
/// </summary>
/// <param name="pane">The <see cref="GraphPane"/> from which to obtain the scale
/// range values.
/// </param>
/// <param name="type">A <see cref="StateType"/> enumeration that indicates whether
/// this saved state is from a pan or zoom.</param>
public ZoomState(GraphPane pane, StateType type)
{
_xAxis = new ScaleState(pane.XAxis);
_yAxis = new ScaleStateList(pane.YAxisList);
_y2Axis = new ScaleStateList(pane.Y2AxisList);
_type = type;
}
示例12: GraphController
public GraphController(Model model, ZedGraphControl graphControl)
{
this.model = model;
this.graphControl = graphControl;
this.graphPane = graphControl.GraphPane;
// Initialize lines
this.lineItemA = this.graphPane.AddCurve("Person A", new PointPairList(), Color.Red, SymbolType.Diamond);
this.lineItemB = this.graphPane.AddCurve("Person B", new PointPairList(), Color.Blue, SymbolType.Circle);
this.lineItemAgent = this.graphPane.AddCurve("Agent", new PointPairList(), Color.Green, SymbolType.Star);
this.lineItemAgent.IsY2Axis = true;
// Set the Titles
this.graphPane.Title.Text = "Graph of persons' data and the agent's state";
this.graphPane.XAxis.Title.Text = "Time";
this.graphPane.XAxis.Type = AxisType.Date;
this.graphPane.Y2Axis.Title.Text = "Agent's state";
this.graphPane.YAxis.Scale.Min = -4;
this.graphPane.YAxis.Scale.Max = 4;
this.graphPane.Y2Axis.Scale.Min = -4;
this.graphPane.Y2Axis.Scale.Max = 4;
this.graphPane.Y2Axis.IsVisible = true;
// Update threshold lines
UpdateThresholdLines();
}
示例13: PropertygraphControl
List<string> selectedKeys = new List<string>(); // Selected Parameters to display
#endregion Fields
#region Constructors
/// <summary>
/// Initialises the Graphcontrol
///
/// </summary>
/// <param name="core"></param>
public PropertygraphControl(GroundControlCore.GroundControlCore core)
{
InitializeComponent();
this.comboBox1.Items.Clear();
List<UAVSingleParameter> uavData = MonitoredDictionary<string, UAVSingleParameter>.NormaliseDictionary(core.currentUAV.uavData);
foreach (UAVSingleParameter param in uavData)
{
comboBox1.Items.Add(param.GetStringPath());
}
this.core = core;
myPane = zedGraphControl1.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "Live Data";
myPane.XAxis.Title.Text = "Time";
myPane.YAxis.Title.Text = "Values";
myPane.XAxis.Type = AxisType.Date;
myPane.YAxis.Scale.MaxAuto = true;
myPane.XAxis.Scale.MaxAuto = true;
zedGraphControl1.IsAutoScrollRange = true;
zedGraphControl1.IsEnableWheelZoom = true;
zedGraphControl1.IsEnableHPan = true;
myPane.Legend.IsVisible = true;
}
示例14: AddHistogram
/// <summary>
/// Add a plot of the 1D histogram. You should call the Refresh() function to update the control after all modification is complete.
/// </summary>
/// <param name="name">The name of the histogram</param>
/// <param name="color">The drawing color</param>
/// <param name="histogram">The 1D histogram to be drawn</param>
public void AddHistogram(String name, Color color, DenseHistogram histogram)
{
Debug.Assert(histogram.Dimension == 1, Properties.StringTable.Only1DHistogramSupported);
GraphPane pane = new GraphPane();
// Set the Title
pane.Title.Text = name;
pane.XAxis.Title.Text = Properties.StringTable.Value;
pane.YAxis.Title.Text = Properties.StringTable.Count;
#region draw the histogram
RangeF range = histogram.Ranges[0];
int binSize = histogram.BinDimension[0].Size;
float step = (range.Max - range.Min) / binSize;
float start = range.Min;
double[] bin = new double[binSize];
for (int binIndex = 0; binIndex < binSize; binIndex++)
{
bin[binIndex] = start;
start += step;
}
PointPairList pointList = new PointPairList(
bin,
Array.ConvertAll<float, double>( (float[]) histogram.MatND.ManagedArray, System.Convert.ToDouble));
pane.AddCurve(name, pointList, color);
#endregion
zedGraphControl1.MasterPane.Add(pane);
}
示例15: DrawCurve
public DrawCurve(CurveItem _curve, string _curveName, GraphPane _pane, string _paneName)
{
CurveName = _curveName;
PaneName = _paneName;
Curve = _curve;
Pane = _pane;
}