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
- Adding Chart.js line chart to Jinja2/Flask html page from JS file
- Chartjs pie chart not showing from dynamic data
- Emberjs binding properties within Ember object
- Gradient effect with Chart.js and Angular
- How to decrease bottom width of triangle using line chart in chartJs?
- chart.js hide gridline inside chartarea but keep y-axis border
- How can i add additional Data(Type) to chart.js
- Full size download Chartjs canvas on mobile device
- ChartJS - tooltip of one element is covering point that user should be able to select
- First point on scatter plot on JavaScript chart.js not showing
- Show center tick value radar chart- Chart.js
- Chart.js Style bold on 1/one/certain label
- ChartJS: Get individual values minus another value in the custom legend
- How to write better code in es6 for formatting an object with array values
- Why can I not see a data value when hovering over a point on the radar chart?
- Edge does not set height on canvas properly
- Retrieving daily & monthly totals from MySQL for use in a chart
- How to load chart data to an appended canvas
- How to format x-axis time scale values in Chart.js v2
- Secondary bar with chart.js
- create legend from colors saved in const
- How to get data of json file for chart.js diagram
- How to align Chart.JS line chart labels to the center
- ReactChart2 - Line is not a registered Element
- Overlap chart datasets with different view types in Chart.js
- React Chartjs 2 display axes above datasets backgroundColor
- ChartJs is not working in angular 4 with no errors
- How to fix the number of gridlines in X-Axis as label are too condensed
- Angular 2 chart - change point radius
- How to remove old chart and append new chart to div using chartjs