Sign in to follow this  
FelipeOdoni

Cannot read property 'width' of undefined - FusionCharts.HC.js error.

Recommended Posts

Hi All.
 
I am using FusionCharts XT 3.3.1-sr2.19840 to render a javascript chart and I get the following error: Cannot read property 'width' of undefined
 
The snippet code that throws this error is (FusionCharts.HC.js):
 

getSmartText: function (d, e, q, l) {
                        if (!this.init) return !1;
                        if (d === void 0 || d === null) d = "";
                        var v = {
                            text: d,
                            maxWidth: e,
                            maxHeight: q,
                            width: null,
                            height: null,
                            oriTextWidth: null,
                            oriTextHeight: null,
                            oriText: d,
                            isTruncated: !1
                        }, i = !1,
                            k, b, f, a, g = -1,
                            c = -1,
                            t = -1,
                            x = this.container,
                            J = this.context,
                            ja = g = 0,
                            la, r = [],
                            w = 0,
                            u = this.showNoEllipses ? "" : "...",
                            g = this.lineHeight,
                            V = function (a) {
                                for (var a = a.replace(/^\s\s*/, ""), b = /\s/, g = a.length; b.test(a.charAt(g -= 1));
                                return a.slice(0, g + 1)
                            };
                        la = J ? function (a) {
                        	return J.measureText(a).width;
                        } : function (a) {
                            x.innerHTML = a;
                            return x.offsetWidth
                        };

In some situations (generally when a = "") the call J.measureText (a) returns undefined and the next call (.width) throws the error.
 
I could not identify why this call returns undefined, or why a = "".
 
Can someone help me with this?
 
Thanks in advance,
 
Felipe Odoni

Share this post


Link to post
Share on other sites

Hi,

 

Could you please let us know the chart type you are trying to render along with the XML/JSON data being used?

 

If feasible, please send us the code snippet of code rendering so that we can help you better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this