Skip to content
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

.load() json needs keys included #1652

Open
greenafrican opened this issue Apr 13, 2016 · 4 comments
Open

.load() json needs keys included #1652

greenafrican opened this issue Apr 13, 2016 · 4 comments
Labels
C-feature-request Category: A feature request or an enhancement easy pull request

Comments

@greenafrican
Copy link
Contributor

Seems as though you need to re-include chart.internal.config.data_keys when loading new json data:

chart.load({json: newData, keys: chart.internal.config.data_keys});

This seems unnecessary but otherwise you get an Uncaught Error: x is not defined for id = "0"

@abacaj
Copy link

abacaj commented Apr 15, 2016

That's because there is a bug in c3.js :) - the keys are not being stored from what I can see in the codebase.

@greenafrican
Copy link
Contributor Author

The keys are being stored in chart.internal.config.data_keys, hence me logging the issue and why the workaround works.

@abacaj
Copy link

abacaj commented Apr 20, 2016

I misunderstood then, you were able to work around it by using the internal config?

@aendra-rininsland
Copy link
Member

This seems like it's sort of intentional, given that C3 doesn't know the structure of the JSON being loaded in. In reality, your new data will likely have the same schema, so the second parameter should just default to chart.internal.config.data_keys.

Marking as enhancement, easy PR if anyone wants it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request or an enhancement easy pull request
Projects
None yet
Development

No branches or pull requests

3 participants