Skip to content

Commit 0b46e17

Browse files
committed
docs: fix sandbox with custom chart
1 parent d06f000 commit 0b46e17

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sandboxes/custom/src/components/LineWithLineChart.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import { createTypedChart } from 'vue-chartjs'
22
import { LineController } from 'chart.js'
33

44
class LineWithLineController extends LineController {
5+
static override id = 'line-with-line'
6+
57
public override draw() {
68
super.draw()
79

8-
console.log(this.chart?.tooltip?.active)
9-
10-
if (this.chart?.tooltip?.active) {
10+
if (this.chart?.tooltip && this.chart.tooltip.opacity > 0) {
1111
const ctx = this.chart.ctx
1212
const x = this.chart.tooltip.x
13-
const topY = this.chart.scales['y-axis-0'].top
14-
const bottomY = this.chart.scales['y-axis-0'].bottom
13+
const topY = this.chart.scales.y.top
14+
const bottomY = this.chart.scales.y.bottom
1515

1616
// draw line
1717
ctx.save()
@@ -26,6 +26,9 @@ class LineWithLineController extends LineController {
2626
}
2727
}
2828

29-
const LineWithLineChart = createTypedChart('line', LineWithLineController)
29+
const LineWithLineChart = createTypedChart(
30+
'line-with-line' as 'line',
31+
LineWithLineController
32+
)
3033

3134
export default LineWithLineChart

0 commit comments

Comments
 (0)