I\'m trying to make a graph with Charts.js (current one is just a really simple example I\'m trying to get working, somewhat taken from the Chart.js documentation) and the g
I had this exact same problem where my graph would not resize properly. To get around this issue I did two things.
below is the code I used:
css
#myGraph {
width: 100%;
height: 100%;
}
html
When you initialise the chart with the ctx set the options as below:
options: {
responsive: true,
maintainAspectRatio: false
}
now when you resize your screen the graph should resize accordingly. Note: The graph will fill the size of its container now so what ever you put your canvas into it will fill the size of that container.