꺽은선 그래프
-
Canvas 차트 그리기 1 - LineCanvas 2021. 10. 1. 19:39
1. html 문서에 Canvas Element 추가. 2. 차트 정보 정의 const gridCount = 5; const gridArea = {x:50, y:50, h:250, w:400}; const chartArea = {x:70, y:70, h:200, w:360}; 3. Grid 그리기 const canvas = document.getElementById('chart'); const ctx = canvas.getContext('2d'); ctx.fillStyle = "#CCC" const gapY = gridArea.h / gridCount; for(let i = 0 ; i Math.max(prev,curr)); const min = data.reduce((prev,curr) => Math.m..