Skip to content

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

Description

@badrAZ

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>
    )
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions