예제 #1
0
        public static void AddIndividualLine(this ZedGraphControl zgc, PointPairList list, Color[] colors, bool update)
        {
            GraphPane myPane = zgc.GraphPane;
            int       index  = 0;

            list.ForEach(pp =>
            {
                var ppl = new PointPairList();
                ppl.Add(new PointPair(pp.X, 0));
                ppl.Add(new PointPair(pp.X, pp.Y));
                myPane.AddCurve("", ppl, colors[index++], SymbolType.None);
            });

            if (update)
            {
                UpdateGraph(zgc);
            }
        }
예제 #2
0
        public static void AddIndividualLine(this GraphPane myPane, String title, PointPairList list, Color?defaultColor = null, Color?tagColor = null, int tagFontSize = 10, DashStyle dStyle = DashStyle.Solid)
        {
            int index = 0;

            Color defaultLineColor = defaultColor.HasValue ? defaultColor.Value : Color.Black;
            Color defaultTagColor  = tagColor.HasValue ? tagColor.Value : Color.Green;

            list.ForEach(pt =>
            {
                var ppl = new PointPairList();
                ppl.Add(new PointPair(pt.X, 0));
                ppl.Add(pt);

                Color curColor = pt.Tag == null ? defaultLineColor : defaultTagColor;
                LineItem line;
                if (index == 0)
                {
                    line = myPane.AddCurve(title, ppl, curColor, SymbolType.None);
                    index++;
                }
                else
                {
                    line = myPane.AddCurve("", ppl, curColor, SymbolType.None);
                }
                line.Line.Style = dStyle;

                if (pt.Tag != null)
                {
                    TextObj text = new TextObj(pt.Tag.ToString(), pt.X, pt.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center);

                    text.ZOrder = ZOrder.A_InFront;
                    // Hide the border and the fill
                    text.FontSpec.Border.IsVisible = false;
                    text.FontSpec.Fill.IsVisible   = false;
                    text.FontSpec.Angle            = 90; //字体倾斜度
                    text.FontSpec.Size             = tagFontSize;
                    text.FontSpec.FontColor        = curColor;
                    myPane.GraphObjList.Add(text);
                }
            });
        }
예제 #3
0
    public static void AddIndividualLine(this ZedGraphControl zgc, PointPairList list, Color[] colors, bool update)
    {
      GraphPane myPane = zgc.GraphPane;
      int index = 0;
      list.ForEach(pp =>
      {
        var ppl = new PointPairList();
        ppl.Add(new PointPair(pp.X, 0));
        ppl.Add(new PointPair(pp.X, pp.Y));
        myPane.AddCurve("", ppl, colors[index++], SymbolType.None);
      });

      if (update)
      {
        UpdateGraph(zgc);
      }
    }
예제 #4
0
    public static void AddIndividualLine(this GraphPane myPane, String title, PointPairList list, Color? defaultColor = null, Color? tagColor = null, int tagFontSize = 10, DashStyle dStyle = DashStyle.Solid)
    {
      int index = 0;

      Color defaultLineColor = defaultColor.HasValue ? defaultColor.Value : Color.Black;
      Color defaultTagColor = tagColor.HasValue ? tagColor.Value : Color.Green;

      list.ForEach(pt =>
      {
        var ppl = new PointPairList();
        ppl.Add(new PointPair(pt.X, 0));
        ppl.Add(pt);

        Color curColor = pt.Tag == null ? defaultLineColor : defaultTagColor;
        LineItem line;
        if (index == 0)
        {
          line = myPane.AddCurve(title, ppl, curColor, SymbolType.None);
          index++;
        }
        else
        {
          line = myPane.AddCurve("", ppl, curColor, SymbolType.None);
        }
        line.Line.Style = dStyle;

        if (pt.Tag != null)
        {
          TextObj text = new TextObj(pt.Tag.ToString(), pt.X, pt.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center);

          text.ZOrder = ZOrder.A_InFront;
          // Hide the border and the fill
          text.FontSpec.Border.IsVisible = false;
          text.FontSpec.Fill.IsVisible = false;
          text.FontSpec.Angle = 90;  //字体倾斜度
          text.FontSpec.Size = tagFontSize;
          text.FontSpec.FontColor = curColor;
          myPane.GraphObjList.Add(text);
        }
      });
    }