question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot read property 'tooltip' of undefined

See original GitHub issue

Hello,

I am using and existing Angular2-Bootstrap template for my dashboard application and it had some Chartist bar and lines charts with them. I am ableto load data from an API into the chart as expected, but when I try to add the tooltip plugin onto the chart, I get this error

Cannot read property ''tooltip’of undefined.

When I remove the code, the graph draws properly, when I just insert the plugin, the graph doesn’t render and nothing else executes within the page.

Here is what I have. In my package.json,

"chartist-plugins-tooltip": "0.0.11"

In my dashboard.ts

const dataFromAPI = {
labels: data.labels,
series: [data.series]
};

const optionsForChart = {
 axisX: {
   showGrid: false,
  },
low: 0,
high: 500,
chartPadding: { top: 0, right: 5, bottom: 0, left: 0},
plugins: [
 Chartist.plugins.tooltip() // This is where I get the error. Cannot read property 'tooltip' of undefined
]
}
const responsiveOptions = {
 .......
}

const createChartForDataFromAPI = new Chartist.Line('#idofthechart',dataFromAPI, optionsForChart, responsiveOptions);

I have no idea why I get this error. Anything I’'m doing wrong?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
Gergely1987commented, Jan 3, 2019

I used chartist in an angular project, and for me the solution was that to use it:

import * as Legends from ‘chartist-plugin-legend’; //or import any other plugin that You are using and in the constructor initalize an object: var legend = Legends;

and use this object in the chart options plugins: plugins: [ Chartist.plugins.legend({ legendNames: classNames, position: ‘bottom’ }) ]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Treemap - Cannot read property 'tooltip' of undefined #894
Hi! I'm unable to use Treemap in interactive mode. When the user hovers the chart it disappears with this error: nivo-tooltip.esm.js:160 ...
Read more >
Bootstrap Tooltip "Uncaught TypeError: Cannot read property ...
When I try to display a new tooltip, after destroying the old one, I get "Uncaught TypeError: Cannot read property 'trigger' of null"...
Read more >
Tooltip : TypeError: Cannot read property '0&#38
Hi,. Tooltips and popovers were completely rebuilt in version 4.12.0 (complete changelog) ...
Read more >
Custom tooltip - Uncaught TypeError: Cannot read properties ...
I am developing custom simple visual where I would like to use built-in tooltips, I integrated it by documentation steps, but I am...
Read more >
Cannot read property 'tooltip' of undefined at pqgrid.min.js:9
I have download the paramQuery Grid jQuery library (download option available) from portal. When I tried with ASP.Net MVC + jQuery Application, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found