AbelHeinsbroek / chartjs-plugin-crosshair

Crosshair plugin for ChartJS
https://chartjs-plugin-crosshair.netlify.com/samples/
MIT License
147 stars 86 forks source link

Getting TypeError when using v. 1.1.3+ #21

Open EsbenLorenzen opened 4 years ago

EsbenLorenzen commented 4 years ago

When loading a chart with crosshair enabled, I am recieving the following TypeError:

TypeError: chart.crosshair is undefined chartjs-plugin-crosshair.js:395:11
    beforeTooltipDraw https://cdn.jsdelivr.net/npm/chartjs-plugin-crosshair@1.1.3/dist/chartjs-plugin-crosshair.js:395
    notify https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    _drawTooltip https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    draw https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    render https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    callback https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    advance https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    startDigest https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7
    request https://cdn.jsdelivr.net/npm/chart.js@2.8.0/dist/Chart.min.js:7

This only happens when using version 1.1.3 or 1.1.4 via CDN. Version 1.1.2 works as expected:

<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-crosshair@1.1.2/dist/chartjs-plugin-crosshair.js"></script>

I have not tried loading from local file.

Bug or mistake on my end?

Following setup:

EsbenLorenzen commented 4 years ago

EDIT: I am getting the same error on version 1.1.2

Version 1.1.1 is working fine.

johnny5th commented 4 years ago

I'm also having problems with 1.1.2+ Downgrading to 1.1.1 works as well.