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

Animation of Numbers Formatted Corrupts Numbers #315

Closed
kkerr1 opened this issue Aug 19, 2016 · 1 comment
Closed

Animation of Numbers Formatted Corrupts Numbers #315

kkerr1 opened this issue Aug 19, 2016 · 1 comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@kkerr1
Copy link

kkerr1 commented Aug 19, 2016

When transitioning between two strings that are formatted numbers, the numbers will lose digits, the code snippet below transitions between "1,324,050" and "2,000,000" and will result in 1,324,50 and 2,0,0. (Seems to drop leading zeros)

class App extends React.Component {
   constructor(props) {
    super(props);
    this.state = {
      data: this.getData(),
    };
  }

  getData(label) {
      return [{
        x: 1,
        y: 1,
        label,
      }];
  }

  componentDidMount() {
    let idx = 0;
    const nums = ["1,324,050", "2,000,000"];
    setInterval(() => {
      idx = idx ? 0 : 1;
      this.setState({
        data: this.getData(nums[idx]),
      });
    }, 2000);
  }

  render() {
    return (
      <VictoryScatter
        height={600}
        animate={{
          duration: 1000,
        }}
        data={this.state.data}
        style={{
            labels: {
                fontSize: 30
            }
        }}
      />

    );
  }
}
@boygirl
Copy link
Contributor

boygirl commented Jul 1, 2017

It will be necessary to manually format number strings that contain commas, but leading zeros will no longer be dropped

@boygirl boygirl closed this as completed Jul 1, 2017
boygirl added a commit that referenced this issue Jul 17, 2018
update react versions, update enzyme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

No branches or pull requests

2 participants