diff --git a/plottable.js b/plottable.js index ed7bdd61a9..7b4ae3991f 100644 --- a/plottable.js +++ b/plottable.js @@ -1017,10 +1017,11 @@ var Plottable; function _getParsedStyleValue(style, prop) { var value = style.getPropertyValue(prop); - if (value == null) { + var parsedValue = parseFloat(value); + if (parsedValue !== parsedValue) { return 0; } - return parseFloat(value); + return parsedValue; } // @@ -5403,6 +5404,14 @@ var Plottable; Legend.prototype._requestedSpace = function (offeredWidth, offeredY) { var textHeight = this.measureTextHeight(); + if (textHeight === 0) { + return { + width: 0, + height: 0, + wantsWidth: false, + wantsHeight: false + }; + } var totalNumRows = this.colorScale.domain().length; var rowsICanFit = Math.min(totalNumRows, Math.floor(offeredY / textHeight)); diff --git a/src/components/legend.ts b/src/components/legend.ts index 430c685c83..a70a00629c 100644 --- a/src/components/legend.ts +++ b/src/components/legend.ts @@ -140,6 +140,14 @@ export module Component { public _requestedSpace(offeredWidth: number, offeredY: number): ISpaceRequest { var textHeight = this.measureTextHeight(); + if (textHeight === 0) { + return { + width: 0, + height: 0, + wantsWidth: false, + wantsHeight: false + }; + } var totalNumRows = this.colorScale.domain().length; var rowsICanFit = Math.min(totalNumRows, Math.floor(offeredY / textHeight)); diff --git a/src/utils/domUtils.ts b/src/utils/domUtils.ts index 24fdc90e73..151bb90957 100644 --- a/src/utils/domUtils.ts +++ b/src/utils/domUtils.ts @@ -22,10 +22,11 @@ export module Util { function _getParsedStyleValue(style: CSSStyleDeclaration, prop: string): number { var value: any = style.getPropertyValue(prop); - if (value == null){ - return 0; + var parsedValue = parseFloat(value); + if (parsedValue !== parsedValue) { + return 0; } - return parseFloat(value); + return parsedValue; } //