heatmap-node
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,3 +5,4 @@ var heatmap = require("./index"); | ||
var heat = heatmap(1024, 600, { radius: 30 }); | ||
heat.addTimestamp("February 16th 2022", "20:32:05"); | ||
heat.addTimestamp("XXXX-YYYY-ZZZZ", "February 16th 2022", "20:32:05"); | ||
fs.writeFileSync("blob2.png", heat.backgroundCanvas.toBuffer()); |
28
index.js
@@ -159,3 +159,3 @@ var convert = require("color-convert"); | ||
Heat.prototype.addTimestamp = async function (day, time) { | ||
Heat.prototype.addTimestamp = async function (title, day, time) { | ||
var width = this.canvas.width; | ||
@@ -165,5 +165,21 @@ var height = this.canvas.height; | ||
const titleWidth = ctx.measureText(title).width; | ||
const dayWidth = ctx.measureText(day).width; | ||
const timeWidth = ctx.measureText(time).width; | ||
ctx.textAlign = "center"; | ||
// const buffer = fs.readFileSync("./bg.png"); | ||
// console.log("bu", buffer); | ||
// const localImage = await loadImage(buffer); | ||
// console.log(localImage); | ||
// ctx.drawImage(localImage, 0, 0, width, height); | ||
const boxWidth = Math.max(titleWidth, dayWidth, timeWidth) + 150; | ||
const boxHeight = 60 + 50; | ||
ctx.fillStyle = "#000"; | ||
// console.log("a", boxHeight, boxWidth); | ||
ctx.fillRect(0, 0, boxWidth, boxHeight); | ||
ctx.textBaseline = "top"; | ||
ctx.textAlign = "left"; | ||
ctx.fillStyle = "#fff"; | ||
@@ -173,8 +189,8 @@ ctx.strokeStyle = "black"; | ||
ctx.font = "bold 13pt Helveric"; | ||
ctx.strokeText(time, width - timeWidth / 2 - 150, 570); | ||
ctx.fillText(time, width - timeWidth / 2 - 150, 570); | ||
ctx.strokeText(day, 200, 570); | ||
ctx.fillText(day, 200, 570); | ||
ctx.fillText(title, 25, 10); | ||
ctx.fillText(day, 25, 40); | ||
ctx.fillText(time, 25, 70); | ||
// fs.writeFileSync("blob2.png", this.backgroundCanvas.toBuffer()); | ||
return this; | ||
}; |
{ | ||
"name": "heatmap-node", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "canvas heat maps for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9275
200
0