Search code examples
c#zedgraph

Text displayed out of the graph pane


Is there a way to not display objects out of the graph pane, as shown on the picture below?

ZedGraph screenshot

I use GraphPane.AddCurve() to add the curves and GraphPane.GraphObjList.Add(new TextObj(...)) to add the texts.


Solution

  • In order to do it, I think you have to create a new TextObj so that you can modify the "IsClippedToChartRect" attribute.

    ZedGraph.TextObj text = new ZedGraph.TextObj("Hello", xloc, yloc);
    
    text.IsClippedToChartRect = true;