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

Can't change hide state of data once chart has been initially drawn #38

Open
brightshine1111 opened this issue Mar 12, 2018 · 1 comment

Comments

@brightshine1111
Copy link

brightshine1111 commented Mar 12, 2018

So I have a chart on a webpage. The data prop for the chart is composed within the react render function, like so:

render() {
  let data = {
      rows: this.state.points,
      hide: this.getHideVals()
    };

  ...

  return (
    ...
    <C3Chart data={data} />
    ...
  );
}

The function getHideVals() creates an array of strings based on this.state.

When a state change is triggered and state.points is updated, the data in the chart is updated no problem. But when getHideVals() returns a new value, the new hide states of the data are not reflected. Whatever values for data to hide are originally passed in when the webpage is first rendered persist. I can't figure out how to get changes to the data.hide prop to display.

@brightshine1111
Copy link
Author

brightshine1111 commented Mar 12, 2018

After some experimentation I've figured out this is a problem with c3 itself. It looks like only certain fields of the data object can be controlled by passing them into the load() function via a data object, and some must use the API. Hiding/showing data has an API call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant