Jump to content
JChartFX Community
  • 0

Resize chart using doUpdate()


niravbhatt

Question

Hello,

I am a licensed JChartFX user.

I am facing problem on resizing charts when window resize. I am using chart.doUpdate(true) on  $(window).resize(), but when chart try to update it's give error message "Error: <svg> attribute width: Expected length, "NaN"". How can i resolve this issue with JchartFX?

Thanks in advance

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

We will need more information about this issue, including

1) Are there any chart settings relevant to the occurrence of this problem (i.e. does the problem still happens if you comment them out)
2) Is the data relevant to the issue.
3) Does the error happens on a particular scenario, e.g. the first time a chart is resized, when a chart is too big or too small, etc.

Regard,

JuanC

Link to comment
Share on other sites

  • 0

Hi JaunC,

1) Are there any chart settings relevant to the occurrence of this problem (i.e. does the problem still happens if you comment them out)

-- No, If i commit "chart.doUpdate(true);" then every thing is OK, But chart resize not possible.

2) Is the data relevant to the issue.

-- No

3) Does the error happens on a particular scenario, e.g. the first time a chart is resized, when a chart is too big or too small, etc.

--May be Yes, because first time it's resize correctly. but after some time when i come for same it's generate above error.

-- I try to explain my scenario. we have two dashboards and each dashboards have some charts. We using AngularJs and also use AngularJs Gridster to represent a chart.

When i load dashboard-01 first time then resize of chart is working perfect. When i come from same dashboard after dashboard-02 and try to resize then  "Error: <svg> attribute width: Expected length, "NaN"" and some other errors. All errors are show in attached file. 

 

doUpdate.PNG

Link to comment
Share on other sites

  • 0

>> No, If i commit "chart.doUpdate(true);" then every thing is OK, But chart resize not possible

What I meant was, can you try commenting the block of code where you customize the chart (chart gallery, colors, etc) and/or the block of code where you pass the data, WITHOUT commenting the doUpdate call to find out if there is a specific code that triggers the issue.

>> When i load dashboard-01 first time then resize of chart is working perfect. When i come from same dashboard after dashboard-02 and try to resize then

Are dashboard-01 and dashboard-02 different HTML pages? 

We need to be able to duplicate the problem in-house in order to find a fix and test it.

Can you try using console.log to log the sizes of the chart(s) just before you do the initial render as well as before the doUpdate calls? This could let you and us know which of the charts are failing and the sequence of events that triggers the issue, also knowing if the error happens without any of the chart customizations or data will be critical to try to reproduce and fix the issue.

Regards,

JuanC

Link to comment
Share on other sites

  • 0

Hi JuanC,

First of all thank you for your reply.

>> What I meant was, can you try commenting the block of code where you customize the chart (chart gallery, colors, etc) and/or the block of code where you pass the data, WITHOUT commenting the doUpdate call to find out if there is a specific code that triggers the issue.

Yes, I had tried your suggestion and found that in background i forgot to clear previous charts object list that's why in second time it will find duplicate object and try to resize old one and generate error. I cleared previous old objects list and error was resolved.

Thanks for your support and suggestion. :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...