score:6
Accepted answer
Chart.js has a property (responsive) that you can configure at the global or chart level via options that will make the chart responsive. See http://www.chartjs.org/docs/#getting-started-global-chart-configuration > responsive
// Boolean - whether or not the chart should be responsive and resize when the browser does.
responsive: true,
true makes it responsive. false (default) makes it non-responsive.
Example usage (only the relevant part, check out the CodePen for the full exam)
var ctx = $("#bar").get(0).getContext("2d");
var myChart = new Chart(ctx).Bar(barData, {
responsive: true
});
CodePen - http://codepen.io/anon/pen/bdrGVx
You might also want to check out the maintainAspectRatio option, if you want to maintain the ratio of width to height.
Source: stackoverflow.com
Related Query
- How to make chartjs pie chart responsive
- How to make a 30days chart responsive on mobile using chart.js?
- How can I make two of my lines in Chart JS thicker
- Can't make chart js responsive
- How can I make a stepline or stepped chart in chart.js or D3?
- how to make a chart.js bar chart scrollable
- How to make react-chartjs-2 responsive on mobile?
- how to programmatically make a line chart point active/highlighted
- How to make Chart JS responsive?
- How to make bar chart animation where all bars grow at the same speed?
- How to make a chart scroll horizontally (when using Chart.js)
- How can I make line on chart thinner?
- How to make a chart with an associative array with chart.js?
- ChartJS: how to make a bar chart with a horizontal guideline:
- How to make aspecific API call from within a Line Chart class in ReactJS using react-chartjs-2?
- chart.js: How do I make the radar chart axis labels bigger?
- Chart JS, ng2-Charts - How to make the label to the right of pie chart instead on top?
- How to make the chart smaller than its container
- How to make dynamic chart using Vue component with chart-js
- Chart.js - how to make proportional intervals on X axis on line chart
- How do i make a new chart by pressing a button (chart.js)?
- How to make Chart.js Bubble chart with ng2-chart?
- how to make doughnut chart portions, buttons
- How do you make a progressive line chart with time as the X axis?
- How can I make streaming chart with react?
- How to make bar chart cover multiple labels?
- How to make dynamic chart js using JSON in Codeigniter?
- How to position chart details next to a chart responsive for multiple devices?
- How to make chart with chartjs.?
- how to make scrollable the legends of pie chart ( chart js )
More Query from same tag
- Add options to Charts.js
- How to disable scientific notations in logarithmic chart type
- Combine two line charts into one in ChartJS
- Chartjs does not render chart when set responsive option to true
- trouble with making floating bar charts using chart.js
- Artefacts when showing compact vertical bar chart in chart.js
- Custom Legend ChartJS not showing the text decoration: line through
- pie chart label undefined ionic 3
- chart.js - tooltip callback function ignore hidden datasets when deselecting legend
- ChartJs won't appear in DIV in same page
- ChartJS : It's not showing in html on Django
- Auto center ticks and values on graph when there's only one with chart.js
- How to iterate over array elements inside objects in javascript
- Chart from chart.js to pdf
- Display data labels on a pie chart in angular-chart.js
- React - render Chart.js chart based on user selection, after Ajax returns JSON
- Creating a chart
- chartjs - top and bottom padding of a chart area
- Draw borders on line chartjs
- How to loop inside javascript using php variable
- Chart.js hours scale show day switch
- Create Vue.js + Chart.js charts using datasets stored outside in a csv file
- Passing SQL results from controller to chart.js
- How to make y axis only integer scaling in ChartJS?
- Chart js loading screen
- Zoom and Pan in react-chartjs-2
- Chart JS prepend labels to x-axis with addData
- chartjs: bars smaller than actual column, tooltip doesn't display
- Datalabels of Chart JS can not display full values
- Bootstrap modal not working with chartjs line graph