- this.width_ = parseInt(div.style.width, 10);
- this.height_ = parseInt(div.style.height, 10);
- // The div might have been specified as percent of the current window size,
- // convert that to an appropriate number of pixels.
- if (div.style.width.indexOf("%") == div.style.width.length - 1) {
- this.width_ = div.offsetWidth;
- }
- if (div.style.height.indexOf("%") == div.style.height.length - 1) {
- this.height_ = div.offsetHeight;
- }
-
- if (this.width_ == 0) {
- this.error("dygraph has zero width. Please specify a width in pixels.");
- }
- if (this.height_ == 0) {
- this.error("dygraph has zero height. Please specify a height in pixels.");
+ if (div.style.height == '' && div.offsetHeight == 0) {
+ div.style.height = Dygraph.DEFAULT_HEIGHT + "px";
+ if (div.style.width == '') {
+ div.style.width = Dygraph.DEFAULT_WIDTH + "px";
+ }