Maybe the exemples given with grafica.js library should be OK since it is created for this kind of project.
grafica.js library : https://github.com/jagracar/grafica.js
Arduino and Processing : https://playground.arduino.cc/Interfacing/Processing
Bapt