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 in Storybook - LinearScaleBase is not defined

See original GitHub issue

Expected behavior

No bug of not used features.

Current behavior

Hey guys, After updating from 3.9.1 to 4.0.1 I receive error in our builded Storybook (runtime not on build):

Uncaught ReferenceError: LinearScaleBase is not defined
    at ./node_modules/chart.js/dist/chart.js (5827.4a9359bf.iframe.bundle.js:2:4868810)
    at __webpack_require__ (runtime~main.bfd8d355.iframe.bundle.js:1:387)
    at ./src/components/common/DoughnutChart.js (main.ee1fcde1.iframe.bundle.js:1:1188558)
  • Running locally I don’t have such error.
  • LinearScaleBase is not something I use anywhere in the codebase

Any suggestions?

Reproducible sample

None

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.0.1

Browser name and version

No response

Link to your project

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

2reactions
duyn-stanfordcommented, Dec 19, 2022

I had this same issue when I only had a Doughnut chart in my project but later added a Line Chart, which required registering LinearScale (along with CategoryScale, PointElement, and LineElement) and it worked thereafter. Try registering LinearScale first to see if that addresses your problem and add some of these other Line Chart components if it’s still not working for you.

1reaction
Arxicommented, Dec 20, 2022

thank you @duyn-stanford for this suggestion. I imported LinearScale, and also had to register it with Chart.js, but now the production build works. Not exactly a “clean” solution, but certainly works, so much appreciated!

import { Chart as ChartJS, ArcElement, Tooltip, LinearScale } from 'chart.js';
ChartJS.register(ArcElement, Tooltip, LinearScale);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions - Storybook - JS.ORG
A common error is that an addon tries to access the "channel", but the channel is not set. It can happen in a...
Read more >
Storybook - no stories showing up in typescript project with ...
When trying to create a story from my components, I get the error: Module not found: Error: Can't resolve 'esri/Basemap' in '/.../GitHub/20-maps ...
Read more >
storybook/addon-docs - npm
Start using @storybook/addon-docs in your project by running `npm i ... When set to null it tells docs not to run the source-loader...
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