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

Variable series revert to their old values on hiding a line #60

Open
badrAZ opened this issue May 2, 2019 · 0 comments
Open

Variable series revert to their old values on hiding a line #60

badrAZ opened this issue May 2, 2019 · 0 comments

Comments

@badrAZ
Copy link

badrAZ commented May 2, 2019

Hi!

I've got an issue with the plugin. The series revert to their old values on hiding a line. Please see the example bellow.

class Test extends React.Component {
  state = {
    series: [
      { name: 'Money A', data: [60000, 40000, 80000, 70000] },
      { name: 'Money B', data: [40000, 30000, 70000, 65000] },
      { name: 'Money C', data: [8000, 3000, 10000, 6000] },
      { name: 'Money D', data: [15000, 80000, 60000, 40000] },
      { name: 'Money E', data: [80000, 60000, 40000, 20000] },
    ],
  }

  _onClick = () => {
    this.setState({
      series: [
        { name: 'Money A', data: [40000, 40000, 40000, 40000] },
        { name: 'Money B', data: [40000, 40000, 40000, 40000] },
        { name: 'Money C', data: [40000, 40000, 40000, 40000] },
        { name: 'Money D', data: [40000, 40000, 40000, 40000] },
        { name: 'Money E', data: [40000, 40000, 40000, 40000] },
      ],
    })
  }

  render() {
    return (
      <div>
        <ChartistGraph
          type='Line'
          data={{
            series: this.state.series,
            labels: [
              'First quarter of the year',
              'Second quarter of the year',
              'Third quarter of the year',
              'Fourth quarter of the year',
            ],
          }}
          options={{
            width: '100%',
            height: '300px',
            fullWidth: true,
            chartPadding: {
              right: 40,
            },
            plugins: [ChartistLegend({})],
          }}
        />
      <Button onClick={this._onClick}>
        click
      </Button>
     </div>
    )
  }
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