Create Vitals Graphs in Line\Trail renderer

Hey guys,
i need to draw Vitals such as ECG heart rate… for example:
9141748--1270075--upload_2023-7-12_17-10-30.png

do you know what is the best practice to draw such graphs?
do i have to use math functions and draw it ? or there’s another solutions?
Do you know any open source solution that i can use?
I’d love to get help with it…

Thank you all

Just put a LineRenderer in and feed it some points.

If you change the points over time, update the LineRenderer and it will move.

Everything beyond that is optimizations tailored specifically to your need.

“feed it some points” - that is exactly what i asked…
the collection of points is eventually the math function on the graph, and i want to know what is the best way to draw a mathematical function- using that LineRenderer?

Vector3[] points = new Vector3[ MAX];

for (int i = 0; i < points.Length; i++)
{
   float x = ConvertIndexToDomain( i);
   float y = YourMathematicalFunctionHere( x);
   points[i] = new Vector3( x, y);
}

TheLineRenderer.SetPositions( points);

Everything else is scaling or offsetting and whatever UI work you want. There are ten billion UI tutorials out there to help you.

This pattern, iterating to produce a range of inputs and feeding them through a function and recording the outputs in some kind of collection should become like eating, walking, falling off a bicycle. It’s that fundamental to how computer data processing works.

check some ideas from these also,

https://github.com/nukadelic/UnityGraphs
https://github.com/Tayx94/graphy

asset store has some solutions (free and paid) for charts.