Overview
Occasionally you will want to chart the output of analytic function., as opposed to charting data that exists in a blog or your workspace. For example, you may wish to chart the sine function.
In this case, you need to generate the data you wish to display. This can be
let points = [];
for(let i=0;i<1000;i++){ points.push({
x:i*2*3.14/1000,
y:Math.sin(i*2*3.14/1000)
});
}
$val.set('data', points);
Alternatively, you can use the $from function to create a data array.
let points = $from(0, 2*3.14, 1000).map(p=> {
return {
x:p,
y:Math.sin(p)
};
});
$val.set('data', points);
copy