Post Reply 
plotting time discrete data
06-23-2015, 03:32 PM
Post: #5
RE: plotting time discrete data
(06-23-2015 02:11 PM)leprechaun Wrote:  Thanks Didier!

However maybe you can help me getting my polyline() function working? It is a good way to learn.

Here is a very rough implementation of the polyline() function, you'll have to adjust the pixel mapping to your needs:

Code:
EXPORT polyline(data)
BEGIN
  LOCAL x_max, y_max;
  LOCAL L_Points, L_Lines;

  x_max:= length(data); y_max:=MAX(data);
  L_Points := MAKELIST({IP(I*300/x_max)+10, 220-IP(data(I)*220/y_max)+10},I,1,x_max);
  L_Lines := MAKELIST({I,I+1},I,1, x_max-1);


  RECT();
  LINE_P(10,230,320,230); LINE_P(10,10,10,230);   // Draw X & Y Axis
  LINE_P(L_Points,L_Lines,[[1,0],[0,1]]);
  FREEZE;

  RETURN L_Points; //Output for debugging
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
plotting time discrete data - leprechaun - 06-23-2015, 12:18 PM
RE: plotting time discrete data - Didier Lachieze - 06-23-2015 03:32 PM



User(s) browsing this thread: 1 Guest(s)