开发者

ZedGraphControl marks important places in a curve

In my C# proj开发者_StackOverflow中文版ect use zedGraphControl to draw a curve

In the curve have several maximum values, and I want to highlight that maximum values by circle it

How I add to my curve?


LineItem myCurve = myPane.AddCurve("My Curve", list, Color.Red, SymbolType.Circle); there is no parameter set to not connected the points. In zedgraphcontrol how to set points without connecting


Here is a simplified example.

I've created two PointPairLists, one of which contains double.NaN so that it does not draw contiguous line segments. I then set the symbol for the line that contains highlights to a non-filled red circle.

GraphPane myPane = zedGraphControl1.GraphPane;

PointPairList myData = new PointPairList
{ 
    {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}
};
PointPairList myHighlights = new PointPairList
{ 
    {double.NaN, double.NaN}, { 2, 2 }, {double.NaN, double.NaN}, { 4, 4 }, {double.NaN, double.NaN}
};

LineItem dataLine = myPane.AddCurve("Data", myData, Color.Blue);
LineItem highLine = myPane.AddCurve("Highlight", myHighlights, Color.Red);

dataLine.Symbol.IsVisible = false;
highLine.Symbol.IsVisible = true;

highLine.Symbol.Type = SymbolType.Circle;
highLine.Symbol.Fill.IsVisible = false;
highLine.Symbol.Border.Width = 2F;
highLine.Symbol.Size = 16F;

zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();

Here are some good references:

  • Introduction and examples: http://www.codeproject.com/KB/graphics/zedgraph.aspx
  • Source code documentation: http://zedgraph.sourceforge.net/documentation/default.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜