Commit 99a92b14 authored by Mathieu Rodic's avatar Mathieu Rodic

[FEATURE] Better parameters validation for the Graph class constructor

parent 6c9a2986
......@@ -545,9 +545,15 @@ var Graph = function(container, width, height) {
};
(function() {
if (typeof(container) != 'object') {
if (typeof(container) != 'object' || !container.style) {
console.error('The first parameter of the Graph class constructor should be a valid DOM object.');
}
if (!width) {
width = container.style.width;
}
if (!height) {
height = container.style.height;
}
var canvas = document.createElement('canvas');
var canvasContext = canvas.getContext && canvas.getContext('2d');
if (!!canvasContext) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment