score:2
please upgrade npm package, its worked for me
npm i chart.js@2.9.4
score:17
Angular 12 here. Gaurev's answer worked for me. I had to use:
import { Chart, registerables } from 'chart.js';
export class ChartTest {
constructor() {
Chart.register(...registerables);
}
// methods to actually make the chart per documentation
}
score:53
We can do this in three ways
By importing:
import { Chart, registerables } from 'chart.js';
and then register all the coponents
Chart.register(...registerables);
finally there is an separate path to do just the above for you, in one line:
import Chart from 'chart.js/auto';
By importing and registering the required part as commented by @Tatyana Molchanova
import { Chart, ChartConfiguration, LineController, LineElement, PointElement, LinearScale, Title} from 'chart.js'
and then register it in component before instantiating new Chart
Chart.register(LineController, LineElement, PointElement, LinearScale, Title);
Source: stackoverflow.com
Related Query
- Chart.js core.js:6162 ERROR Error: "line" is not a registered controller
- Chartkick-vue bar chart - "horizontalBar" is not a registered controller
- react-chartjs-2 with chartJs 3: Error "arc" is not a registered element
- show label in tooltip but not in x axis for chartjs line chart
- Angular-chart.js - Make line chart does not curve
- angular-chartjs line chart TypeError: t.merge is not a function
- Chart.js line chart is not displaying
- Line chart is not being displayed in Chart.js
- Chartjs not rendering chart and no error thrown
- Time series line chart is not displayed
- Time Series Line chart js in react not working
- Click event of stacked line chart not working
- Stacked line chart not displaying correctly when Xaxis is time
- Chart.js tooltip not showing on line chart
- annotation line not visible in scatter chart in chartjs
- Chart.js Date and Time Bar Chart Not Rendering - Line Works Though
- Want only line not area under it in chart js
- Do not draw line on condition in ChartJS line chart
- Legend not displaying on Line or Bar chart - React-Chartjs-2
- ReactChart2 - Line is not a registered Element
- vertical grid line not taking full hight of the canvas in chart js 3.3.2
- Line Chart is not setting backgroundColor when created dynamically Chart.js
- ChartJS line chart x = y not rendering astraight line
- ChartJS autoskip:False not working on line chart
- X and Y axis labels not displaying on line chart (Chart.js)
- Data not displaying properly in Chart.js line chart
- Chartjs backgroundColor for line chart does not appear in Vue app
- angular 4 line chart data is not showing data from http get
- Chart.js line chart not showing point on top most value
- ChartJS on NodeJS: error Chart is not defined
More Query from same tag
- Chart.js 3.5.1 Attribute question about zeroLineColor
- Chart.js: adding a custom label to each item, and displaying it with a custom tooltip
- ChartJS vertical line not removed on touchend
- Remove background color in chartjs line chart
- Chart.js -> Displaying % on pie chart
- Destroying the Div and its contents inside the jquery dialog when close button is clicked
- Querying mongoDB for some chart data - my pipeline seems convoluted
- how can i put a chart in a div with *ngIf
- chartjs add dots to bars in grouped bar chart
- How to show area chart with timeseries configuration with different datasets in Chart.js v3?
- Alter angular js chart wrapper to support drawing custom lines
- How do I make an interactive line chart
- Error Message when using ChartJS with React
- How to pass a fetched object from App.js to a child component asynchronously in ReactJS v16+
- Specifying the legendTemplate in Chart.js when using asp (classic)
- Using Chart.js with SvelteKit
- Callback after line chart rendered
- How to put 2 charts next to each other
- Read google sheet json data into chartjs
- Angular and ChartJS to create bar chart
- Charts.js : How to remove the Vertical Black lines in Bar Chart
- Chart.JS Starting at 00:00am and ending at 23:59pm
- react chart js skip zero value month
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Displaying line chart for multiple datasets using chart.js
- Bubble getting cut off in Chart.js
- Chart Js Line chart with fill on click with full information of its legend text
- how to display chart.js legend with different bar color
- Chart.js - Line Chart format data to Lacs/Crores
- assigning line chart data in chartjs