1.要做乙個除錯工具,採集感測器資料並顯示。繪製曲線注意座標反轉,線條的張力即可。專案中的曲線是從右往左顯示的,線條的座標都放在list裡了,效果如下圖:
2.上**
public class drawingcurve
/// /// 繪製畫布
///
///
///
///
///
public bitmap drawcanvas(int width, int height,listpoints)
bitmap = new bitmap(width, height);
graphics = graphics.fromimage(bitmap);
graphics.fillrectangle(brushes.black, new rectangle(0, 0, width, height));
graphics.transform = new matrix(1, 0, 0, -1, 0, 0);//y軸向上為正,x向右為
pen pen = new pen(color.red, 1);
pen.dashstyle = dashstyle.custom;
pen.dashpattern = new float ;
graphics.drawline(pen, new point(0, height / 4), new point(width, height / 4));
graphics.drawline(pen, new point(0, height / -4), new point(width, height / -4));
graphics.drawline(new pen(color.greenyellow,1), new point(0, 0), new point(width, 0));
graphics.drawstring("0", new font("vendara",10), brushes.white, new point(0, -15));
graphics.drawstring("+", new font("vendara", 10), brushes.white, new point(0, height / 4));
graphics.drawstring("-", new font("vendara", 10), brushes.white, new point(0, height / -4-15));
graphics.transform = new matrix(1, 0, 0, 1, 0, 0);//y軸向上為正,x向右為
graphics.drawstring("-59s", new font("vendara", 8), brushes.white, new point(0, height/2-15));
graphics.drawstring("0s", new font("vendara", 8), brushes.white, new point(width-20, height / 2 - 15));
for (int i = 0; i < timeline; i++)
graphics.transform = new matrix(-1, 0, 0, -1, 0, 0);//y軸向上為正,x向右為
if (showx) drawx(graphics, points);
if (showy) drawy(graphics, points);
if (showz) drawz(graphics, points);
graphics.dispose();
return bitmap;
}#region 繪製曲線
private void drawx(graphics graphics, listpoints)
graphics.drawcurve(curvepen, curvepointf, this.tension);
}private void drawy(graphics graphics, listpoints)
graphics.drawcurve(curvepen, curvepointf, this.tension);
}private void drawz(graphics graphics, listpoints)
graphics.drawcurve(curvepen, curvepointf, this.tension);
}/// /// 曲線開關
///
///
///
public void hidecurve(string _xyz,bool show)
}#endregion
}
3.ui上使用threadstart進行呼叫,根據需要設定休眠時間即可,同時設定picturebox顯示即可。 QChart 繪製實時曲線
qvalueaxis 建議使用動態分配的方式axisx setrange 0,2000 設定座標範圍axisx setlabelformat g 設定座標顯示格式 比如整形 d i,浮點型 f axisx settitletext samples 設定座標標題 axisx settickcount ...
Matplotlib繪製動態實時曲線的方法改進
已有的解決方案 存在的問題 def method point es time np.zeros point fig plt.figure ax fig.add subplot 1,1,1 ax.axis equal 設定影象顯示的時候xy軸比例 ax.set xlabel horizontal po...
C 繪製曲線的類
using system using system.collections.generic using system.text using system.drawing namespace curveplot public bitmap plot curve byte data if dataque...