如何绘制基于 Y2 轴的第二条曲线,而第一条曲线基于 Y 轴?
我正在使用 ZedGraph。
我有两条曲线要绘制,第一条曲线基于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行rows(与 Y1Axis
相同),我应该使用哪个函数?
I'm using ZedGraph.
I have 2 curves to draw, the first curve is based on the scale of YAxis, while the second one is based on the Y2Axis, the value in first curve is far bigger than the second value.
In my project, both curves are based on YAxis, which makes the graph ugly.
Does anyone has experience to draw second curve based on the Y2Axis?
Here is my code: (What should I change?)
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;
Thank you.
If I want to set the Y2Axis
share the same grid of Y1Axis
, after:
LineItem curveY2 = gp.AddCurve(p2, "", Color.Blue);
...
curveY2 .IsY2Axis = true;
i.e., the grid is based on Y1Axis
, then Y2Axis
has the same grid but with different lable.
For example, Y1Axis
is from 1 to 300, and have 7 rows, however Y2Axis
has 1 to 20, I want the Y2Axis
also have 7 rows (same as the Y1Axis
), which function should I use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)