project_cryptoverse
project_cryptoverse copied to clipboard
"category" is not a registered scale
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
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
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
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, }, }, }, };
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 that code help a lot to understanding the concept it really help me a lot to under the chart..........
you can add one additional import:
import {Chart as ChartJS} from 'chart.js/auto'
to make this work
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
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, }, }, }, };
ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend );
Thanks Bro for helping.
you can add one additional import:
import {Chart as ChartJS} from 'chart.js/auto'
to make this work
thanks man so useful
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