ZedGraph Fill Zones

I am using the ZedGraph control and want to fill one side of the chart function with some color and the other side with a different color.

PointPairList list1 = new PointPairList(); list1.Add(0, 4); list1.Add(4, 0); LineItem myCurve = myPane.AddCurve("y(n)", list1, Color.Red, SymbolType.Diamond); //This filling bottom side. myCurve.Line.Fill = new Fill(Color.White, Color.FromArgb(113, 255, 0, 0), 90F); //How to fill the top side? 
+4
source share
1 answer

I do not quite understand what you are asking, but I hope the following helps. You said in the comments

Is it possible to fill the polygon area in Zedgraph?

So here is how ...

 var zed = new ZedGraph.ZedGraphControl { Dock = System.Windows.Forms.DockStyle.Fill }; var poly = new ZedGraph.PolyObj { Points = new[] { new ZedGraph.PointD(0, 0), new ZedGraph.PointD(0.5, 1), new ZedGraph.PointD(1, 0.5), new ZedGraph.PointD(0, 0) }, Fill = new ZedGraph.Fill(Color.Blue), ZOrder = ZedGraph.ZOrder.E_BehindCurves }; var poly1 = new ZedGraph.PolyObj { Points = new[] { new ZedGraph.PointD(1, 0), new ZedGraph.PointD(0.25, 1), new ZedGraph.PointD(0.5, 0), new ZedGraph.PointD(1, 0) }, Fill = new ZedGraph.Fill(Color.Red), ZOrder = ZedGraph.ZOrder.E_BehindCurves }; zed.GraphPane.AddCurve("Line", new[] { 0.0, 1.0 }, new[] { 0.0, 1.0 }, Color.Green); zed.GraphPane.GraphObjList.Add(poly1); zed.GraphPane.GraphObjList.Add(poly); 

Results in

enter image description here

We hope this points you in the right direction!

( VB code on request via http://converter.telerik.com/ - there is no guarantee that VB code works or even compiles!)

+5
source

Source: https://habr.com/ru/post/1338147/


All Articles