score:4
Follup up:
Another possible issue is that you try to render canvas inside non-block element.
By default any Angular component with tag selector is inline
So you could just make it block:
:host {
display: block;
}
Answer
Today current version is 2.1.0. API has changes. Version 2.0-alpha was released on 5 Jun 2015. https://github.com/chartjs/Chart.js/releases/tag/v2.0-alpha Version that you use in jsfiddle is 2.0.0-alpha4 (22 Jun 2015, hash 9368c6079d989527dcd2072b6f18780b53e3113c)
You need to change your code as described below:
this.myChart = new Chart(ctx).Line({
data: _data,
options: _options
});
See working example with chart v2.0-alpha https://plnkr.co/edit/IFdEeMcS9lHGWrsUwkGb?p=preview
If you use syntax 2.1.3 then you can write like this:
this.myChart = new Chart(ctx, {
type: 'line',
data: _data,
options: _options
});
Example with v2.1.3 https://plnkr.co/edit/GubwdD9Voo3mBPYYKEEL?p=preview
score:10
The canvas element parent MUST be a valid HTML element, it can't be an Angular2 component tag like my-app
.
So this doesn't works when using Chart.js:
<my-chart-component>
<canvas></canvas>
</my-chart-component>
This works:
<div>
<canvas></canvas>
</div>
Not sure if this is your problem though.
Source: stackoverflow.com
Related Query
- Chart.js v2 charts do not display inside angular 2 (but Chart.js v1 works perfectly)
- Chart.js chart does not display when inside an ngIf.
- code works fine on jsfiddle but one function is not working on website
- How to display the values inside the pie chart of PrimeNG (chart) using JavaScript or Angular
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- Pie Chart using chart.js not showing up but bar charts are?
- angular-chart.js - chart height not working on iOS but works fine on Android and Web
- How to display data on hover inside doughnut chart in Angular Chart?
- how to not repeat code while creating multiple charts in chart js
- show label in tooltip but not in x axis for chartjs line chart
- Problem for display a chart with Chart.js and Angular
- Series Details Not Showing in Angular Chart with Charts.js
- Chart.js Chart in Angular does not load until resizing browser window
- Display Date Label in axes - chart js/ng2 charts
- Chartjs (Non Vue) Not Rendering Graph Chart inside V-if/V-show
- How to add title inside doughnut chart in Angular Chart?
- chart annotations not showing in Angular 2
- Chart.js Date and Time Bar Chart Not Rendering - Line Works Though
- Css style not working well when resizing chart height in angular application
- vue-chart.js : Data available as computed properties, but not showing in chart
- charts js, doughnut chart not rendering tooptips correctly
- Set Global Config on Angular Charts Not Working
- chart.js not getting rendered inside ng-template in angular
- Datalabels of Chart JS can not display full values
- VueJs and ChartJs - Chart is responsive in width, but not height?
- Chart does not display on webpage in Django app (with Chart.js)
- How to customize tooltip on mouse hover of a polar area chart of Angular Charts
- Chart js pie or doughnut charts 3 inside instead of 1
- Chart.js in Angular 10: Specified colors not shown in multi-series bar chart (instead random colors)
- Doughnut chart from Chart.js, custom legend and call of original handler not works as expected
More Query from same tag
- ChartJS set yAxes "ticks"
- Remove 0% from pie chart
- create legend from colors saved in const
- how to display labels at top of charts(chart.js)
- Creating datapoints on mouseclick Chart.js
- Chart.js scatter charts: Is there a way to indicate that datapoints of two data sets are on top of each other?
- How to update a react-chartjs-2 plot using useState()
- How to install chart.js
- ChartJS number shows up on top of number
- Chart.js - Creating multiple charts on one page
- Animation chart js (line), animate chart drawing line by line
- How to remove the line/rule of an axis in Chart.js?
- Change background color of all charts beside the one hovered
- Use JSON file with chart.js
- How do I update the chart to reflect local storage values?
- Chartsjs update datasets with dropdown
- ChartJS on small screen
- Chartjs is stripping trailing zeros in decimal datasets
- Chart.js configuration
- How to implement mysql database connection in Chart.js
- How can I change the label name when you hover your data in Chart.js?
- How to make data always visible on bars Chart.js
- Frontend and backend for chart using chartjs, mongodb, and controller
- Create Chart using Reactjs Chartjs and axios
- How to get ChartJs object from dynamically created chart
- Canvas not rendering after animation without resizing viewport
- Chart.js with handlebar.js shows empty canvas
- Why doesn't parsing option work in chartjs?
- Saving ChartJS chart showing all tooltips
- How to change colors in react charts