height attributes of the
<canvas> element are unitless, so use:
template: '<canvas width="100" height="100" style="width:100px; !important height:100px; !important"></canvas>'
i found similar behaviour with aurelia (rather than angular) - it didn't like rending the chart inside an element with a custom name, in your case "answers-plot". with aurelia, i can just add "containerless" to my custom element and it works. i'm not sure with angular directives - maybe replace:true, or transclude:true in the directive options?
i encountered the same problem the other day.
and i found that:
the parent of
<answers-plot>, and the
<answers-plot> 's width and height are 0. it seems that
chartjs resizes its chart according to the size of the parent element of
<canvas> which causes the width and height of the canvas to be 0.
i used a
<div> to wrap the
<canvas> in my directive's template and gave a non-zero size to the
chartjs's options) to
false, and the problem is solved.
- Why would a ChartJS chart end up with width 0 and height 0?
- React chart : prevent chart's canvas scaling with height and width
- Bar chart with min height and zero values - ChartJs
- ChartJS - would like to create a mixed chart with horizontal Bar and a dot to represent the answer from the current user
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- Chart.js: width and height of a pie chart not respected
- How to get the actual chart width and height in chart.js
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Keep chart.js doughnut with fixed width and height centered in container
- Chartjs - Set start and end value into a Bar Chart
- I can not properly re scale <canvas> with width and height attributes
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- Unable to set width and height on canvas in chart js
- How to make a chart with chartjs and Angular?
- Trying to export chart with Chartjs and React but getting erorr
- attempting to change height and width of canvas for chart
- 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
- Chartjs - Doughnut chart with multi layer and running value
- Chartjs create chart with big data and fixed labels
- How to shrink the height and increase the line width of a custom Chartjs horizontal line?
- Prevent size of canvas chart js to equal window height and width
- ChartJs - width scale of chart area and label area
- Setting width and height
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- ChartJS - Draw chart with label by month, data by day
- Display line chart with connected dots using chartJS
- chartjs datalabels change font and color of text displaying inside pie chart
- How to fix chart Legends width-height with overflow scroll in ChartJS
- Chart.js Mixed Bar and Line chart with different scales
More Query from same tag
- chart.js 2.0 add new property to dataset
- Adding Multiple value in Tooltips in ChartJS charts
- Ionic2 Angular2: I can't seem to get an ng2-chart to appear in my app
- Chart js 2.8 - How to make bars grow at the same speed?
- How do I update the Chart.js automatically every 2 seconds?
- Displaying JSON in Chart.js
- Chart.js Y-Axis data not rendering
- Charts .js update when array changes
- Angular Chart.js - Remove Moment.js as Dependency / Reduce Bundle Size
- Problem in passing values using props in react.js while using chart.js
- ionic display chartjs data from json http request
- Is it possible to define data attributes for each dataset value in a Chart.js chart?
- Multiple lines / data series from JSON file with Chart.js
- How can I update my ChartJS in real time (It's works only when I zoom-in and zoom-out)
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- Chart js background color changes on click
- Unable to display point values without mouse hover
- How to use Utils from Chartjs on Django
- Sum array of objects value based on month - ReactJS
- ChartJs - Double tooltip Top and Bottom on hover
- Chart.js Polar Area Chart scale background color
- How to connect Firebase in Chart.js?
- pie chart label undefined ionic 3
- How to change cursor on hover of data labels in chart.js version 3?
- Multiple line types in ChartJS
- showing tooltips all the time in chartjs 2.4 not working
- On click event to show name of pie chart slice in chartsJS
- Drawing to canvas on click clears text when mouse leaves the chart
- Use data from SQL database in .js file with PHP