#!/bin/env python3 import requests from math import sin from time import sleep import numpy as np import json def sine(): x = 0.0 while True: requests.get(f"http://localhost:8080/add?chart=0&series=R1&x={x}&y={sin(x)}") x += 0.01 sleep(0.01) def sine_array(): start = 0 while True: x = np.linspace(start, start+0.5, 100) y = np.sin(x) start += 0.5 data = { "chart": 0, "series": "R1", "points": [ {"x": i[0], "y":i[1]} for i in zip(x,y) ] } r = requests.post("http://0.0.0.0:8080/add", json=data, headers={"Connection":"close"}) sleep(0.25) def star(): points = [ (2,2), (3,0), (0,1), (4,1), (1,0), (2,2) ] for point in points: requests.get(f"http://localhost:8080/add?chart=0&series=R1&x={point[0]}&y={point[1]}") def main(): #sine() sine_array() #star() if __name__ == "__main__": main()