<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-2.3.1.min.js'></script>
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
const Ax = [], Ay = [];
//типа новые данные
setInterval( () => {
addPoint( Ax, Ay );
Plotly.newPlot('myDiv', [ { type: 'scatter',
x: Ax.slice( -15 ),
y: Ay.slice( -15 )
} ] );
}, 200 );
//просто обнулятор
setInterval( () => {
Ax.length = 0;
Ay.length = 0;
}, 15000 );
function addPoint( xs, ys ) {
xs.push( xs.length + 1 );
ys.push( Math.round( Math.random() * 20 ) );
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.