<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>随机统计图</title>
<style>
#root{
display: block;
margin: 100px auto;
/* border: 1px solid #ccc; */
}
</style>
</head>
<body>
<canvas id="root" width="600px" height="500px">111</canvas>
<script>
let container = document.querySelector('#root');
let ctx = container.getContext("2d");
// 坐标系
ctx.beginPath();
ctx.moveTo(100,100);
ctx.lineTo(100,400); //y轴
ctx.lineTo(500,400); //x轴
ctx.stroke(); //着色
c
canvas制作条形统计图
最新推荐文章于 2023-11-05 00:15:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)