Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chartist[type] is not a constructor #99

Open
mynameisankit opened this issue Nov 10, 2022 · 2 comments
Open

Chartist[type] is not a constructor #99

mynameisankit opened this issue Nov 10, 2022 · 2 comments

Comments

@mynameisankit
Copy link

mynameisankit commented Nov 10, 2022

I am using this on next.js but it shows TypeError: Chartist[type] is not a constructor.

<ChartistGraph
    data={{
        label: timeline.map(item => dayjs(item[0]).format('MM YYYY')),
        series: [timeline.map(item => item[1])]
    }}
    options={{
        fullWidth: true,
        axisX: {
            showGrid: true
        },
    }}
    type='Line'
/>

I tried <NoSsr /> of MUI but to no avail. Any Solutions?

@ndri
Copy link

ndri commented Nov 26, 2022

I got the same error and it seems like react-chartist doesn't support the newest versions of chartist yet. I've installed version 0.11.4 (yarn add [email protected]) and that solves this error, but doesn't display any charts. There are some warnings saying React 18 isn't supported, so that might be a reason.

@bayareacoder
Copy link

bayareacoder commented Dec 5, 2022

Same error here. The issue is that react-chartist v1 had a breaking change that all chart types are now exported as named exports to allow tree-shaking for only the chart types you use. So the Chartist[type] that react-chartist uses no longer works. It is compatible with [email protected] (I have it working with that) BUT the npm install will complain of an incorrect dependency as package.json lists 0.10.3 as required peer dependency (that version does not work for me in Gatsby while 0.11.4 works). So the workaround is to use npm install --force to avoid the peer dependency error.
This package is in dire need of an update! #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants