我有一个返回时间t的图的PointPairList的方法,但是我想用它来绘制一个“移动”的图,我说的“移动”是指这个图应该随着时间的推移而变化,有谁知道我怎么做的吗?我试过使用RollingPointPairList的方法,但它就是不起作用。
发布于 2012-10-05 15:08:57
你说演进是什么意思?是要随着时间推移将点添加到曲线中,还是要更改曲线已有点的位置?对于第一种选择,我使用了一个计时器和一个DrawPoint方法作为处理程序,将一个点添加到曲线中。第二种选择可能会有点复杂,我没有试图改变一点的坐标,但也许它是可能的…在最坏的情况下,你将不得不删除你的旧点数并绘制新的点数…无论如何,这是我的代码的一部分,用来添加一个点(实际上有很多点,因为我使用的是多条曲线)
tmr.Interval = 6;
tmr.Tick += new EventHandler(tmr_Tick);
tmrActive = true;
tmr.Start();
void tmr_Tick(object sender, EventArgs e)
{
DrawPoint(zedGraphControl1, points, num); //points is an PointPair array of length num with the new points that i want to add to my Curves(1 point for each Curve)
zedGraphControl1.AxisChange();
zedGraphControl1.Refresh();
if (Start.Enabled == false) Freeze.Enabled = true;
}
private void DrawPoint(ZedGraphControl zgc, PointPair[] p, int num)
{
GraphPane myPane = zgc.GraphPane;
if (myPane.CurveList.Count < num)
{
DrawCurves(zgc, num);
}
for (int i = 0; i < num; i++)
{
myPane.CurveList[i].AddPoint(p[i]);
}
actPos = p[0].X;
mResize(zgc, actPos);
}https://stackoverflow.com/questions/12734121
复制相似问题