看板 java 關於我們 聯絡資訊
我手邊有一份別人的code 是利用socket把機器上資料傳給Java端畫圖出來 對方使用Papplet的內容如下 但我想改成可以把畫圖(draw)裡面 當Y軸數值超過threshold 可以把那個點標出(x,y)軸的數值放在圖形裡面 好幫助視覺化資料 請問版上大大 有哪些好的建議嗎 謝謝囉 public class DataView extends PApplet implements SocketConnection { public void setup() { 設定圖形大小 } public void draw() { background(0x222222); strokeWeight(2); stroke(141,198,63); for (int i=1; i<300; i++) { float prevVal = features.get(i-1); //features是socket來得 float currVal = features.get(i); float y1 = map(prevVal, 0, 10, 0, 200); float y2 = map(currVal, 0, 10, 0, 200); float x1 = map(i-1, 0, 300, 0, width); float x2 = map(i, 0, 300, 0, width); line(x1, (height/2)-y1, x2, (height/2)-y2); } } } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 73.174.57.201 ※ 文章網址: https://www.ptt.cc/bbs/java/M.1435425611.A.EFB.html