效果图
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
#canvas {
border: 1px solid #999999;
}
</style>
<body>
<canvas id="canvas"></canvas>
</body>
<script>
let canvas = document.getElementById('canvas')
canvas.width = 200
canvas.height = 200
let ctx = canvas.getContext('2d')
//第一个圆
ctx.beginPath()
ctx.lineWidth = 10
ctx.strokeStyle = '#F4F5FE'
ctx.arc(100, 100, 70, 0, 2 * Math.PI)
ctx.stroke()
//第二个圆
ctx.beginPath()
ctx.lineWidth = 10
ctx.strokeStyle = '#1965EF'
ctx.arc(100, 100, 70, 0.5 * Math.PI, 1 * Math.PI)
ctx.stroke()
//绘制标题
ctx.textAlign = 'center'
ctx.font = '14px Verdana'
ctx.fillStyle = '#333333'
ctx.fillText('月收入', 100, 90)
//绘制金额
ctx.font = '20px Verdana'
ctx.textAlign = 'center'
ctx.fillText(`¥30000万`, 100, 120)
</script>
</html>