diff --git a/src/components/RingBarChart.vue b/src/components/RingBarChart.vue index 02919cc..a8ebd98 100644 --- a/src/components/RingBarChart.vue +++ b/src/components/RingBarChart.vue @@ -43,7 +43,7 @@ const ringText = (ring) => { - + {{ Number((b.rate * 100).toFixed(1)) }}% { try { @@ -197,67 +198,6 @@ export function drawKDEHeatmap(canvasId, width, height, points, options = {}) { reject(error); } }); - // #endif - - // #ifndef MP-WEIXIN - // 其他平台沿用旧版绘制上下文 - return new Promise((resolve, reject) => { - try { - const ctx = uni.createCanvasContext(canvasId); - ctx.clearRect(0, 0, width, height); - - if (!points || points.length === 0) { - ctx.draw(false, () => resolve()); - return; - } - - const kernel = kernelEpanechnikov(bandwidth); - const kde = kernelDensityEstimator(kernel, range, gridSize); - const densityData = kde(points); - - const cellWidth = width / gridSize; - const cellHeight = height / gridSize; - const xRange = range[1] - range[0]; - const yRange = range[1] - range[0]; - - densityData.forEach(([x, y, density]) => { - const normalizedX = (x - range[0]) / xRange; - const normalizedY = (y - range[0]) / yRange; - const canvasX = normalizedX * width; - const canvasY = normalizedY * height; - - const color = getHeatColor(density); - ctx.setFillStyle(color); - ctx.beginPath(); - ctx.arc( - canvasX, - canvasY, - Math.min(cellWidth, cellHeight) * 0.6, - 0, - 2 * Math.PI - ); - ctx.fill(); - }); - - if (showPoints) { - ctx.setFillStyle(pointColor); - points.forEach(([x, y]) => { - const normalizedX = (x - range[0]) / xRange; - const normalizedY = (y - range[0]) / yRange; - const canvasX = normalizedX * width; - const canvasY = normalizedY * height; - ctx.beginPath(); - ctx.arc(canvasX, canvasY, 2.5, 0, 2 * Math.PI); - ctx.fill(); - }); - } - - ctx.draw(false, () => resolve()); - } catch (error) { - reject(error); - } - }); - // #endif } /** @@ -271,7 +211,6 @@ export function generateKDEHeatmapImage( points, options = {} ) { - // #ifdef MP-WEIXIN // Canvas 2D 导出(传入 canvas 对象) return new Promise((resolve, reject) => { drawKDEHeatmap(canvasId, width, height, points, options) @@ -301,26 +240,6 @@ export function generateKDEHeatmapImage( }) .catch(reject); }); - // #endif - - // #ifndef MP-WEIXIN - // 旧版导出(使用 canvasId) - return new Promise((resolve, reject) => { - drawKDEHeatmap(canvasId, width, height, points, options) - .then(() => { - uni.canvasToTempFilePath({ - canvasId, - width, - height, - destWidth: width * 3, - destHeight: height * 3, - success: (res) => resolve(res.tempFilePath), - fail: reject, - }); - }) - .catch(reject); - }); - // #endif } export const generateHeatMapData = (width, height, amount = 100) => { diff --git a/src/pages/point-book.vue b/src/pages/point-book.vue index 55c19a9..ff90745 100644 --- a/src/pages/point-book.vue +++ b/src/pages/point-book.vue @@ -282,7 +282,6 @@ onShareTimeline(() => { :src="heatMapImageSrc" mode="aspectFill" /> - { z-index: 2; " /> - - - -