score:0
in the JavaScript file where you add all the options for the chart
new Chart(ctx).Line(data, options );
//Boolean - If we want to override with a hard coded scale
scaleOverride : true,
score:16
I managed to solve your problem!
Please check this jsFiddle.
Try resizing the panels to see it in action.
Basically, you call a function that responds to the resize of the window:
$(window).resize(respondCanvas);
that triggers a fetch of the width and height of the parent element that it is encapsulated in and then redraws your chart.
function respondCanvas() {
c.attr('width', jQuery("#daily").width());
c.attr('height', jQuery("#daily").height());
//Call a function to redraw other content (texts, images etc)
myNewChart = new Chart(ct).Bar(data, options);
}
You can adjust all tiny bits like your own IDs, classes, width and heights.
Source: stackoverflow.com
Related Query
- Bootstrap grid not working with canvas
- Chartjs not working with d3 from csv source
- Bootstrap modal not working with chartjs line graph
- Why chart is not working with Bootstrap Modal?
- Using CSS variables (color) with chart.js - "var(--primaryColor)" not working
- chartjs-plugin-zoom not working with my React project
- Android: WebView with JavaScript for Chart.js not working properly
- Chart.js stepSize not working with min
- code works fine on jsfiddle but one function is not working on website
- yAxes not working with min max option
- Why is chart.js not working with angular JS
- Chart JS not working with date
- Chartjs with Vue, Bar Chart Border Radius not working
- Chart JS not working with Phonegap
- vertical grid line not taking full hight of the canvas in chart js 3.3.2
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
- Updating chart.js not working after recieved new data from database with ajax
- Legend color not working with randomly generated background colors in chartjs pie chart
- chart js download to png with canvas.toDataURL() not working in IE and firefox
- chart.js not working in browser with django. no error for template and static folder setting
- Chart JS not working with Dynamic Data
- drawImage not working on canvas
- ChartJs is not working in angular 4 with no errors
- chart.js v3 - data decimation not working with zoom plugin
- Refreshing scope variable not working with scope function
- ChartJs not working with this JSON Object
- Annotation plugin not working with Chart.js 2.8.0
- ng2-Chart not working with newly created angular 10 project
- Updating chart.js with a dataset of different size not working
- angular directive is not working with chartjs
More Query from same tag
- Split JSON into two arrays gives undefined keys-values
- Bar chart with min height and zero values - ChartJs
- How can I add a euro sign (€) to all tooltips in my chart js line chart
- How to change the color of y axis labels in different color in Chart.js
- How to put dynamic value in Doughnutchart Using chartjs?
- Charts.js - Colors for stacked bar on multi-series line/bar chart are not working
- Dynamic colours in chartJS based on entries in the array
- ChartJS - Show values in the center of each bar
- Javascript object from string
- How to add "shadow" on hovering bar chart?
- How to write the value over each bullet in small div permanently in chart js
- How do I use this new extension for chart.js?
- Chart.js: hide dataset line but keep ticks on y-axis?
- How to change format of DateTime reading into chart.js chart?
- How to custom index label on each bar chart using chartjs?
- chartnew.js - remove lines from pie chart on 100%
- Is it possible to draw a bar and arrow/pointer on the right side of a chart?
- change axis scale to be round numbers instead of decimal - chart.js
- chart.js cuts off canvas - but padding makes doughnut very small
- There's a way to link bars to a file in a chart bar in chart.js?
- How can I make my charts dynamic every time I choose an item from my dropdown?
- chart.js plugins.register function with outer data
- ChartJS line chart or bar graph from a Java program
- How can I remove the white border from Chart.js pie chart when all legends are hidden?
- How to pass model object to javascript function in asp.net Core
- Chart.js How can i make a horizontal lines like this?
- Chart.js removing first dataset and label
- min and max tag is not showing in chart chart.js
- chartJS: How to return the closest x-axis label on click
- Chart.js with factory and webservices (Ionic)