上海福彩3D中奖规则
-
每注投注金额为2元。
-
开奖号码为000-999的三位数字。
-
一等奖:投注数字与开奖号码完全相同,单注奖金为1000元。
-
二等奖:投注数字与开奖号码相差一位,单注奖金为100元。
-
三等奖:投注数字与开奖号码相差两位,单注奖金为10元。
javascript
// 变量声明
const canvas = document.getElementById("chart");
const ctx = canvas.getContext("2d");// 数据获取
const data = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],[20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
];// 图表绘制
const drawChart = () => {// 清除画布ctx.clearRect(0, 0, canvas.width, canvas.height);// 绘制坐标轴ctx.beginPath();ctx.moveTo(50, canvas.height - 50);ctx.lineTo(canvas.width - 50, canvas.height - 50);ctx.lineTo(canvas.width - 50, 50);ctx.stroke();// 绘制网格线for (let i = 1; i < 10; i++) {ctx.beginPath();ctx.moveTo(50 + i (canvas.width - 100) / 10, canvas.height - 50);ctx.lineTo(50 + i (canvas.width - 100) / 10, 50);ctx.stroke();}// 绘制数据点for (let i = 0; i < data.length; i++) {for (let j = 0; j < data[i].length; j++) {ctx.beginPath();ctx.arc(50 + j (canvas.width - 100) / 10, canvas.height - 50 - i (canvas.height - 100) / 3, 5, 0, 2 Math.PI);ctx.fill();}}
};// 事件监听
window.addEventListener("load", drawChart);在 `script.js` 中,我们首先声明了画布和上下文变量。我们获取了数据并绘制了图表。当窗口加载时,图表会自动绘制。