代码之家  ›  专栏  ›  技术社区  ›  Bruno

尝试使用Zedgraph创建柱状图

  •  3
  • Bruno  · 技术社区  · 15 年前

    我正在尝试用zedgraph创建柱状图。

    条形图和数据都很好,唯一需要的是我的条形图在tics之间,而不是直接在tics上。

    样本数据:

    1, 4
    2, 8
    3, 1
    

    意味着我有:

    4 items that are >= 0 and < 1
    8 items that are >= 1 and < 2
    1 item that is >= 2 and < 3
    

    因此,目前我的条形图当然直接出现在tics(x值)1、2和3上。

    但我想看看:

    • Tics 0和1之间的第一个栏,
    • 在tics 1和2和
    • TICS 2和3之间的第三个栏

    为了达到这一目标,需要调整的属性是什么? 我正在找 XAxis XAxis.Scale 但是我还没有找到任何东西…

    1 回复  |  直到 14 年前
        1
  •  3
  •   Gacek    15 年前

    BarItem BoxObj

    histList PointPairList

    for (int i = 0; i < histList.Count - 1; i++)
    {
    BoxObj box = new BoxObj(histList[i].X, histList[i].Y, histList[i + 1].X - histList[i].X, histList[i].Y);
    box.IsClippedToChartRect = true;
    box.Fill.Color = myColor;
    pane.GraphObjList.Add(box);
    }
    

    documentation


    GraphObj

    pane.XAxis.Scale.Min = ...
    pane.XAxis.Scale.Max = ...
    pane.YAxis.Scale.Min = ...
    pane.YAxis.Scale.Max = ...
    
    推荐文章