private void InitGraph()
{
GraphPane myPane = zedGraph.GraphPane;
zedGraph.IsShowPointValues = true;
myPane.CurveList.Clear();
myPane.GraphObjList.Clear();
myPane.Legend.IsVisible = true;
myPane.XAxis.Title.Text = "x";
myPane.XAxis.MinorGrid.IsVisible = false;
myPane.XAxis.MajorGrid.IsVisible = false;
myPane.XAxis.Scale.MajorStep = 1.0;
myPane.YAxis.Title.Text = "y'";
myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
myPane.YAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MinorGrid.IsVisible = false;
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsOpposite = false;
myPane.YAxis.Scale.Align = AlignP.Inside;
myPane.YAxis.Scale.Min = 0.0;
myPane.YAxis.Scale.MajorStep = 10.0;
myPane.Title.Text = "x/y'";
myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
myPane.Fill = new Fill(Color.White, Color.AliceBlue, 45.0f);
zedGraph.AxisChange();
}
private void ClearGraph()
{
zedGraph.GraphPane.CurveList.Clear();
zedGraph.AxisChange();
zedGraph.Refresh();
}
private void FillGraph()
{
this.ClearGraph();
GraphPane myPane = zedGraph.GraphPane;
...
zedGraph.AxisChange();
zedGraph.Refresh();
}
Schlagwort: ZedGraph
[Zedgraph] Eigene Punktwerte anzeigen
public void InitGraph()
{
// Punktwerte anzeigen
zedGraph.IsShowPointValues = true;
// eigenen Eventhandler einfügen
zedGraph.PointValueEvent += new ZedGraphControl.PointValueHandler(zedGraph_PointValueEvent);
}
string _zedGraph_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt)
{
// Kurvenpunkt nahe des Cursors holen
PointPair pt = curve[iPt];
// Label (Name aus der Legende), X, Y untereinander anzeigen
return curve.Label.Text + Environment.NewLine + "X: " + pt.X.ToString() + Environment.NewLine + "Y: " + pt.Y.ToString();
}