-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Unable to create chart with json and dot in key #1691
Unable to create chart with json and dot in key #1691
Comments
I encountered the same problem today. In the function c3_chart_internal_fn.convertJsonToData, since the version 0.4.11 (the problem doesn't exist in version 0.4.10), the following block of code changes : 0.4.10targetKeys.forEach(function (key) {
// convert undefined to null because undefined data will be removed in convertDataToTargets()
var v = isUndefined(o[key]) ? null : o[key];
new_row.push(v);
}); becomes 0.4.11targetKeys.forEach(function (key) {
// convert undefined to null because undefined data will be removed in convertDataToTargets()
var v = $$.findValueInJson(o, key);
if (isUndefined(v)) {
v = null;
}
}); I'm not exaclty sure what the findValueInJson does, but the part replacing brackets with dots and then spliting on the dots seems to be the cause of problems. Anyway, until this issue is resolved, using the 0.4.10 version solved it for me. Cheers, |
@Kyhel thank you very much! So I can use it, until the issue has been fixed! |
This was implemented as a fix for issue #1471 . A bugfix would probably be to check if key "x.y" exists and using its value if it does. Only if this key doesn't exist, the nested-object logic should be used. A workaround would be if your object structure would look like this:
|
Has anyone created a jsfiddle of how the new x.y data model fetch is supposed to work? This would be really helpful. |
@joeshub This is a simple jsfiddle that demonstrates the new functionality: http://jsfiddle.net/h0wag7ur/ |
Fixed the bug (see pull request), this jsfiddle shows @DoomyTheFroomy 's example with my fixed c3 dependency. Edit: |
Thanks for the explanations, now I understand better what was the reason behind the new code. Good job on fixing that quickly anyway, and thanks for your work on c3 ! |
A check to see if a key is a number could be implemented to prevent the conflict with numbers. But I don't know if it's worth it. I don't like the idea of implementing overly complex logic checks or obscure special characters. |
It seems that this issue is still open in the current version, isn't it? We have a problem similar to the described behavior. |
The problem is still in the latest version. |
How to fix this problem? |
I have this problem too, how we can solve this ? |
Co-authored-by: Jakob Kneissl <[email protected]>
Co-authored-by: Jakob Kneissl <[email protected]>
I have tried to create a
donut
chart for Chrome version. Which contain a dot as key. This will cause errors. I have tried to create the chart on http://c3js.org (c3.min-4c5bef8f.js) with a chrome (50.0). But it was not possible.The text was updated successfully, but these errors were encountered: