@eox/chart
Advanced tools
Comparing version 2.0.0-alpha5 to 2.0.0-alpha6
{ | ||
"name": "@eox/chart", | ||
"version": "2.0.0-alpha5", | ||
"version": "2.0.0-alpha6", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "chart.js": "^4.2.1", |
@@ -17,15 +17,17 @@ import Chart, { ChartDataset } from "chart.js/auto"; | ||
afterDraw: (chart) => { | ||
const active = chart.tooltip.getActiveElements(); | ||
if (active?.length) { | ||
let x = active[0].element.x; | ||
let yAxis = chart.scales.y; | ||
let ctx = chart.ctx; | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.moveTo(x, yAxis.top); | ||
ctx.lineTo(x, yAxis.bottom); | ||
ctx.lineWidth = 1; | ||
ctx.strokeStyle = "rgba(0, 0, 255, 0.4)"; | ||
ctx.stroke(); | ||
ctx.restore(); | ||
if (chart && chart.tooltip) { | ||
const active = chart.tooltip.getActiveElements(); | ||
if (active?.length) { | ||
let x = active[0].element.x; | ||
let yAxis = chart.scales.y; | ||
let ctx = chart.ctx; | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.moveTo(x, yAxis.top); | ||
ctx.lineTo(x, yAxis.bottom); | ||
ctx.lineWidth = 1; | ||
ctx.strokeStyle = "rgba(0, 0, 255, 0.4)"; | ||
ctx.stroke(); | ||
ctx.restore(); | ||
} | ||
} | ||
@@ -32,0 +34,0 @@ }, |
Sorry, the diff of this file is not supported yet
357379
2904