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

[Bug]: Error: "category" is not a registered scale. #1080

Open
1 task
philharmonie opened this issue Jan 21, 2024 · 4 comments
Open
1 task

[Bug]: Error: "category" is not a registered scale. #1080

philharmonie opened this issue Jan 21, 2024 · 4 comments

Comments

@philharmonie
Copy link

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Having "vue-chartjs": "^5.3.0" and "chart.js": "^4.4.0" I'm getting the error Error: "category" is not a registered scale. when I use the code from the readme:

<template>
  <Bar :data="data" :options="options" />
</template>

<script lang="ts">
import {
  Chart as ChartJS,
  Title,
  Tooltip,
  Legend,
  BarElement,
  CategoryScale,
  LinearScale
} from 'chart.js'
import { Bar } from 'vue-chartjs'

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend)

export default {
  name: 'App',
  components: {
    Bar
  },
  data() {
    return {
      data: {
        labels: ['January', 'February', 'March'],
        datasets: [{ data: [40, 20, 12] }]
      },
      options: {
        responsive: true
      }
    }
  }
}
</script>

Reproduction

I don't have it

chart.js version

^4.4.0

vue-chartjs version

^5.3.0

Possible solution

No response

@philharmonie
Copy link
Author

Update: I get this error only when running bun run dev. When I run bun run build the error is gone.

@grokpot
Copy link

grokpot commented Oct 27, 2024

@philharmonie encountering this issue today, exactly as you described. Did you find a fix?

@apertureless
Copy link
Owner

@grokpot are you also using bun? Does this also happen with npm ?

@grokpot
Copy link

grokpot commented Nov 3, 2024

@apertureless No - pnpm, but same behavior - build worked, but dev did not.
I switched to Apache Echarts

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