Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How can I generate data to form a curved line function in javascript

When I make graphs with javascript, I usually parse external files like csv or txt. However, my next graph actually will not be using real world data, but rather simulated data. So for this, I need to hard code javascript's math representation of a curved line. Here is the line I need to formulate:

enter image description here

Question

How can I express a curved line's data points, as seen above, in javascript syntax? I'm not plotting the line, I'm just populating the x and y values for the line. Length of each array is 100.

lineDataX = [...];

lineDataY = [...];

Note: There are two distinct end points and they do not touch either axis. The curve is to "float" in the graph space, just as pictured.

Comments