zedGraph 图表控件总结(一)

1.横轴显示时间

 zedGraphControl2.GraphPane.XAxis.Type = AxisType.Date;

 zedGraphControl2.GraphPane.XAxis.Scale.Format = "hh:mm";

 PointPairList list1 = new PointPairList();

 list1.Add((double)new XDate(ls[i - 1].dtime), ls[i - 1].volume);

 LineItem myCure = zedGraphControl2.GraphPane.AddCurve("流量", list1, Color.Blue, SymbolType.Diamond);

2.重新绘制

  zedGraphControl2.GraphPane.CurveList.Clear();

  zedGraphControl2.AxisChange();

  zedGraphControl2.Refresh();

3.绘制饼图  

  // 定义生成随机数方法

  Random rand = new Random();

  GraphPane myPane = zedGraphControl2.GraphPane;

  // 清除已有数据

  myPane.CurveList.Clear();

  // 饼图的几个部分 依次为值,颜色

  PieItem segment1 = myPane.AddPieSlice(rand.Next(), Color.Red, .0, "过饱和路段");

  PieItem segment2 = myPane.AddPieSlice(rand.Next(), Color.Green, 0, "畅通路段");

  PieItem segment3 = myPane.AddPieSlice(rand.Next(), Color.Yellow, .0, "饱和路段");

   // 图例的位置

  myPane.Legend.Position = LegendPos.Right;

  // 是否在   segment1.LabelType = PieLabelType.None;

  segment2.LabelType = PieLabelType.None;

  segment3.LabelType = PieLabelType.None;

  myPane.Legend.FontSpec.Size = 30f;

  myPane.Title.IsVisible = false;

  myPane.Fill = new Fill(Color.Cornsilk);

  myPane.Chart.Fill = new Fill(Color.Cornsilk);

原文地址:https://www.cnblogs.com/oftenlin/p/2715627.html