public static void AddPoly(this GraphPane myPane, String title, PointPairList list, Color color, Color[] fillColor) { var pds = new PointD[list.Count + 2]; pds[0] = new PointD(list[0].X, 0); for (int i = 0; i < list.Count; i++) { pds[i + 1] = new PointD(list[i].X, list[i].Y); } pds[list.Count + 1] = new PointD(list[list.Count - 1].X, 0); var obj = new PolyObj(pds); obj.Border = new Border(false, Color.Empty, 0); if (fillColor.Length == 0) { throw new ArgumentException("fillColor should contains at least one color"); } if (fillColor.Length == 1) { obj.Fill = new Fill(fillColor[0]); } else { obj.Fill = new Fill(fillColor, 90F); } obj.ZOrder = ZOrder.E_BehindCurves; myPane.GraphObjList.Add(obj); }
public void SetUpField(double width, double height) { if (zedGraphControl.GraphPane == null) { return; } double ratio = (double)zedGraphControl.Height / (double)zedGraphControl.Width; if (height > ratio * width) { SetFixedXScale(-height / 2 / ratio, height / 2 / ratio); SetFixedYScale(-height / 2, height / 2); } else { SetFixedXScale(-width / 2, width / 2); SetFixedYScale(-width / 2 * ratio, width / 2 * ratio); } var poly = new ZedGraph.PolyObj { Points = new[] { new ZedGraph.PointD(-width / 2, -height / 2), new ZedGraph.PointD(width / 2, -height / 2), new ZedGraph.PointD(width / 2, height / 2), new ZedGraph.PointD(-width / 2, height / 2) }, Fill = new ZedGraph.Fill(Color.LightGreen), ZOrder = ZedGraph.ZOrder.E_BehindCurves, Border = new Border(Color.Black, 4) }; zedGraphControl.GraphPane.GraphObjList.Add(poly); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj( PolyObj rhs ) : base( rhs ) { rhs._points = (PointD[]) _points.Clone(); rhs._isClosedFigure = _isClosedFigure; }
private void CreateGraph_PolyTest( ZedGraphControl z1 ) { GraphPane junk = z1.GraphPane.Clone(); // Get a reference to the GraphPane instance in the ZedGraphControl GraphPane myPane = z1.GraphPane; PointD[] corners = new PointD[4]; corners[0] = new PointD( 300.0f, 85.0f ); corners[1] = new PointD( 400.0f, 85.0f ); corners[2] = new PointD( 400.0f, 95.0f ); corners[3] = new PointD( 300.0f, 95.0f ); PolyObj poly1 = new PolyObj( corners, Color.Empty, Color.Red ); PointD[] corners3 = new PointD[3]; corners3[0] = new PointD( 300.0f, 88.0f ); corners3[1] = new PointD( 375.0f, 95.0f ); corners3[2] = new PointD( 300.0f, 95.0f ); PolyObj poly3 = new PolyObj( corners3, Color.Empty, Color.LightGreen ); PointD[] corners2 = new PointD[3]; corners2[0] = new PointD( 333.0f, 85.0f ); corners2[1] = new PointD( 400.0f, 91.0f ); corners2[2] = new PointD( 400.0f, 85.0f ); PolyObj poly2 = new PolyObj( corners2, Color.Empty, Color.Cyan ); myPane.GraphObjList.Add( poly3 ); myPane.GraphObjList.Add( poly2 ); myPane.GraphObjList.Add( poly1 ); myPane.XAxis.Scale.Min = 250; myPane.XAxis.Scale.Max = 450; myPane.YAxis.Scale.Min = 80; myPane.YAxis.Scale.Max = 100; z1.AxisChange(); z1.Refresh(); //Serialize( z1, "junk.bin" ); //z1.MasterPane.PaneList.Clear(); //DeSerialize( z1, "junk.bin" ); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj(PolyObj rhs) : base(rhs) { rhs._points = (PointD[])_points.Clone(); rhs._isClosedFigure = _isClosedFigure; }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj(PolyObj rhs) : base(rhs) { rhs._points = (PointD[]) _points.Clone(); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj(PolyObj rhs) : base(rhs) { rhs._points = (PointD[])_points.Clone(); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj(PolyObj rhs) : base(rhs) { rhs._points.AddRange(_points); rhs._isClosedFigure = _isClosedFigure; }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="PolyObj"/> object from which to copy</param> public PolyObj( PolyObj rhs ) : base(rhs) { rhs._points.AddRange(_points); rhs._isClosedFigure = _isClosedFigure; }