@import 'https://fonts.googleapis.com/css?family=Akronim';
<svg id='d301svg02' style='background-color:silver;'/><br/><br/>
m=20,margin2={top:m,right:m,bottom:m,left:m},
width2=600-margin2.left-margin2.right,
height2=600-margin2.top-margin2.bottom;
function randi(min,max) {
return Math.floor(Math.random()*(max-min+1))+min;};
var g=randi(50,200),b=randi(50,200);
return '#00'+g.toString(16)+b.toString(16);}
function fx(a,b,c,d,e,f,t) {
x2=(-1)**f*a*Math.sin(b*t)*Math.cos(t),
x3=(-1)**f*c*Math.sin(e*b*t);
function fy(a,b,c,d,e,f,t) {
y2=(-1)**f*a*Math.sin(b*t)*Math.sin(t),
y3=(-1)**f*c*Math.cos(e*b*t);
const a=randi(5,15)/10,b=randi(6,12),c=randi(1,100)/10**3,
d=randi(5,7),e=randi(14,18),f=randi(1,2);
var data=d3.range(1,10**3+1).map(function(k) {
return {'x':fx(a,b,c,d,e,f,k*b*e*Math.PI/10**3),
'y':fy(a,b,c,d,e,f,k*b*e*Math.PI/10**3)}; });
return [data,[a,b,c,d,e,f]]};
function RandomPlot(data,coef,col) {
var line=d3.line().curve(d3.curveMonotoneX)
.x(function(d){return xScale2(d.x);})
.y(function(d){return yScale2(d.y);});
svg2.append('path').datum(data)
.transition().duration(10000)
.attr('class','line').attr('d',line)
.attr('stroke',col).attr('stroke-width',.5)
.attr('fill',col).attr('fill-opacity',.1);
svg2.append('text').attr('id','plot_text')
.text('[a,b,c,d,e,f]='+coef)
.attr('x',width2/2).attr('y',40)
xScale2=d3.scaleLinear().domain([-3,3]).range([0,width2]);
yScale2=d3.scaleLinear().domain([-3,3]).range([height2,0]);
svg2=d3.select('#d301svg02')
.attr('width',width2+margin2.left+margin2.right)
.attr('height',height2+margin2.top+margin2.bottom)
'translate('+margin2.left+','+margin2.top+')');
svg2.append('text').text('<<< add a random line')
.attr('x',60).attr('y',40).attr('fill','#36ffff')
.attr('style','font-family:Akronim; font-size:120%');
.attr('cx',40).attr('cy',40)
.attr('r',20).attr('fill','#36ffff')
.attr('stroke','silver').attr('stroke-width',5)
d3.selectAll('#plot_text')
.transition().duration(3000).remove();
.transition().duration(3000).remove();
var array=make_data(),col=randcol();
RandomPlot(array[0],array[1],col);});