我正在使用ZedGraph。
我有2条曲线要绘制,第一条曲线基于YAxis的比例,而第二条曲线基于Y2Axis,第一条曲线中的值远大于第二条曲线。 在我的项目中,两条曲线都基于YAxis,这使图形变得丑陋。
有没有人有基于Y2Axis绘制第二条曲线的经验?
这是我的代码:(我应该改变什么?)
PointPairList p1 = new PointPairList(),
p2 = new PointPairList();
//code to add data into p1 and p2
GraphPane gp = new GraphPane();
gp.AddCurve(p1, "", Color.Black);
gp.AddCurve(p2, "", Color.Blue);
gp.XAxis.Scale.Min = v1;
gp.Y2Axis.Scale.Max = v2;
gp.AxisChange();
gp.XAxis.Scale.IsUseTenPower = false;
gp.Y2Axis.Scale.IsUseTenPower=false;
谢谢。
如果我想将Y2Axis
分享设置为Y1Axis
的同一网格,请执行以下操作:
LineItem curveY2 = gp.AddCurve(p2, "", Color.Blue);
...
curveY2 .IsY2Axis = true;
即,网格基于Y1Axis
,然后Y2Axis
具有相同的网格但具有不同的标签。
例如,Y1Axis
从1到300,有7行,但Y2Axis
有1到20,我希望Y2Axis
也有7行(与{{1}相同}),我应该使用哪个函数?
答案 0 :(得分:4)
LineItem curveY2 = gp.AddCurve(p2, "", Color.Blue);
...
curveY2 .IsY2Axis = true;
//If you have more than one axis on the related side, you have to assign the index of the axis
curveY2 .YAxisIndex = 0;