1

In my C# project 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

Community
  • 1
  • 1
  • Just an idea for now, try adding another `PointPairList` to the graph which only has the values you want to highlight. Set the attributes such that the symbols are a circle of the desired size and color, and the points are not connected. I'll try to post an example if I have time. – JYelton Jul 30 '11 at 01:10
  • 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 – kalhari abeykoon Aug 01 '11 at 02:05
  • You can skip points by using `double.NaN`; see ["How to miss points in a ZedGraph line graph in C#"](http://stackoverflow.com/q/5154848/161052). – JYelton Aug 01 '11 at 14:45

1 Answers1

0

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:

JYelton
  • 35,664
  • 27
  • 132
  • 191