我正在尝试为甘特图创建一个水平堆叠条形图,但轴是反转的。
我写的代码如下:
a[0] = 0;
a[1] = 6;
a[2] = 7;
a[3] = 7;
b[0] = 6;
b[1] = 0;
b[2] = 11;
b[3] = 0;
c[0] = 0;
c[1] = 6;
c[2] = 0;
c[3] = 19;
string[] labels = new string[] { "A1", "A2", "B1" , "B2" };
GraphPane _p = zedGraphControl1.GraphPane;
BarItem bar1 = _p.AddBar("", a, null, Color.White);
BarItem bar2 = _p.AddBar("", b, null, Color.Blue);
BarItem bar3 = _p.AddBar("", c, null, Color.Green);
_p.BarSettings.MinClusterGap = 0;
_p.YAxis.Scale.TextLabels = labels;
_p.YAxis.Type = AxisType.Text;
_p.BarSettings.Base = BarBase.Y;
_p.BarSettings.Type = BarType.Stack;
如何扭转y轴?我希望A1在顶部,然后是A2,B1和B2。
答案 0 :(得分:2)
_p.YAxis.Scale.IsReverse = true;