-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating with no data does not clear old data from the chart. #349
Comments
Same problem for me. What I did to fix that (but i think this is very hacky) is something similar to Waiting for a proper fix 👍 |
I am Having the same issue but there is a solution for it, not exactly the same thou, found it on stackoverflow http://tinyurl.com/pccza6p You can "hack" this by having an empty array that contains an empty array:
It then shows an empty chart , and you can show your No data message this way :
Even I am after a proper solution for it, to show the noData text without it overlaying the existing data. |
Workaround to solve issue novus/nvd3#349 from nvd3
+1 |
1 similar comment
+1 |
I can get this to work by updating my data object to an empty array: [] . Before we just had empty value sets and the old chart wouldn't clear, but making the data object completely empty cleared my chart and displayed the noData message. |
I do simply this in my "update" function before calling the chart update function: if ( data.length == 0 ) {
d3.select('svg').html("");
}
//do normal chart update call here... You may need to select your svg different way. In my case that was the only one in the frame. |
This was a bug that was brought up in nvd3-community too... we should handle removing data from the chart better, currently all kinds of bad stuff happens. |
Fixed by nvd3-community#63 and will likely be merged into the novus code. |
Oh yeah I need to merge nvd3-community:development soon. |
Should be fixed in dev branch now. |
@liquidpele Thanks, Ill take a look tomorrow |
i have noticed that the library have the following code for detect if is empty the data array: inside the "checkElementID" function
what do you think about this solution?, it works for me. Thanks for that amazing library!!! |
Send us a pull request based on the current development branch ;) |
like |
Thanks! However, this fix takes care of removing the chart but does not clean up any existing tooltips. |
This issue has been closed, please open a new issue for anything further, thanks! |
Thanks, opened: #998 |
If a chart is populated with data and then update is called after the data has been emptied, the noData text will overlay the existing data.
Consider if the current data should be cleared from the chart as it can be confusing to see both at the same time.
To reproduce (altered from http://nvd3.org/ghpages/multiBar.html):
The text was updated successfully, but these errors were encountered: