Moish Cohen
Moish Cohen

Reputation: 93

How to require / import chartist-plugin-tooltip in react app

I'm using react-chartist in my project, and I would like to use the chartist-plugin-tooltip. I saw in the documentation that I can add the plugin to an array of plugins under the chart options object.

The thing that I don't understand is how to import it or require it. I've tried:

const tooltip = require('chartist-plugin-tooltip');

and

import { Chartist } from 'chartist-plugin-tooltip';

None of them work, when I try to assign to the plugins array:

plugins:[ Chartist.plugins.tooltip() ]

Has anyone made this working with react?

Upvotes: 2

Views: 1607

Answers (1)

Moish Cohen
Moish Cohen

Reputation: 93

I managed to overcome the lack of documentation by requiring the plugin directly:

const tooltip = require('chartist-plugin-tooltip');

and in the plugins array I called it like this:

plugins:[ tooltip()]

Upvotes: 4

Related Questions