H

グラフプログラム(自分用)

<script>
//size is 300*300

function DrawGraph(array, id){
var x = array[0];
var y = array[1];
var canvas = document.getElementById(id);
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.moveTo(150, 0);
ctx.lineTo(150, 300);
ctx.moveTo(0, 150);
ctx.lineTo(300, 150);
ctx.strokeStyle = 'rgb(0, 0, 255)';
ctx.moveTo(x[0] + 150, y[0] - 150);
for(let i=1;i - 1 != x.length;i++){
ctx.lineTo(x[i] + 150, 150 - y[i]);
};
ctx.stroke();
};
</script>