You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey i was using your library for a little project and i just couldn't get the chart to fit in the container. This was only when the container was set with a percentage. When i used absolute numbers there wasn't an issue.
After exploring a little bit through your library i found that it couldn't get the height and width attributes.
I fixed the problem by just getting the width and height from the id's, but this ofcourse isn't a fix for the library.
In Smoothiechart.prototyppe.resize = function() -at line 438
var dpr = window.devicePixelRatio;
//var width = parseInt(this.canvas.getAttribute('width')); //getting NaN
//var height = parseInt(this.canvas.getAttribute('height')); //getting NaN
var width = document.getElementById("chart-div").width; //added these as a fix
var height = document.getElementById("chart-div").height; //added these as a fix
if (!this.originalWidth || (Math.floor(this.originalWidth * dpr) !== width)) {
this.originalWidth = width;
this.canvas.setAttribute('width', (Math.floor(width * dpr)).toString());
this.canvas.style.width = width + 'px';
this.canvas.getContext('2d').scale(dpr, dpr);
}
if (!this.originalHeight || (Math.floor(this.originalHeight * dpr) !== height)) {
this.originalHeight = height;
this.canvas.setAttribute('height', (Math.floor(height * dpr)).toString());
this.canvas.style.height = height + 'px';
this.canvas.getContext('2d').scale(dpr, dpr);
}
The text was updated successfully, but these errors were encountered:
The old behaviour (still the default) is to size the element to
the canvas size. This doesn't work with dynamically sized,
responsive applications.
See issues #64, #70, #78, #81
When selected, size canvas to its element size.
The old behaviour (still the default) is to size the element to
the canvas size. This doesn't work with dynamically sized,
responsive applications.
Closes issues #64, #70, #78, #81
Hey i was using your library for a little project and i just couldn't get the chart to fit in the container. This was only when the container was set with a percentage. When i used absolute numbers there wasn't an issue.
After exploring a little bit through your library i found that it couldn't get the height and width attributes.
I fixed the problem by just getting the width and height from the id's, but this ofcourse isn't a fix for the library.
In Smoothiechart.prototyppe.resize = function() -at line 438
The text was updated successfully, but these errors were encountered: