project_cryptoverse icon indicating copy to clipboard operation
project_cryptoverse copied to clipboard

"category" is not a registered scale

Open juli000 opened this issue 2 years ago • 11 comments

I'm am getting this error when trying to click on crypto to see the chart. It doesn't give me a line anywhere in the code where this would be a problem. Please help! Thank you

juli000 avatar Nov 25 '21 04:11 juli000

add the following to the import section

import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, } from 'chart.js';

ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend );

this will fix the issue

danhdeng avatar Nov 30 '21 14:11 danhdeng

I am also having that issue. I copied over the code but I still do not see a line in the graph...? I get this error: Invalid scale configuration for scale: yAxes

brlojam4932 avatar Dec 03 '21 03:12 brlojam4932

for Invalid scale config. for scale: yAxes, I removed the first array, I think it was and left it like this: const options = { scales: { y: { ticks: { beginAtZero: true, }, }, }, };

brlojam4932 avatar Dec 03 '21 21:12 brlojam4932

please check out the same project in my github, i use the latest version of chart.js and react-chartjs-2

https://github.com/danhdeng/react-crypto-app

danhdeng avatar Dec 03 '21 22:12 danhdeng

Thanks man that code help a lot to understanding the concept it really help me a lot to under the chart..........

sayam9901 avatar Jan 16 '22 12:01 sayam9901

you can add one additional import:

import {Chart as ChartJS} from 'chart.js/auto'

to make this work

Fremen1990 avatar Jan 28 '22 00:01 Fremen1990

you can add one additional import:

import {Chart as ChartJS} from 'chart.js/auto'

to make this work

@Fremen1990 Thanks man ,my graph finally rendered

BHARATH740 avatar Feb 01 '22 09:02 BHARATH740

If you are using 'react-chartjs-2' version 3+

const options = { scales: { // remove the [ & ] here yAxes: { scaleLabel: { display: true, fontColor: 'white', fontSize: 25, labelString: 'Faction Points', }, ticks: { beginAtZero: true, }, }, }, };

clonglam avatar Mar 08 '22 10:03 clonglam

ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend );

Thanks Bro for helping.

smitgol avatar Apr 04 '22 14:04 smitgol

you can add one additional import:

import {Chart as ChartJS} from 'chart.js/auto'

to make this work

thanks man so useful

tianlilei-c avatar Jun 09 '22 16:06 tianlilei-c

please check out the same project in my github, i use the latest version of chart.js and react-chartjs-2

https://github.com/danhdeng/react-crypto-app

Thanks, Man I already wasted many hours solving this issue

Himanshu-dev-web avatar Sep 25 '22 18:09 Himanshu-dev-web