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

When animating charts after reload, chart is shown fully drawn before animating. #204

Closed
BrandonShega opened this issue Jul 10, 2015 · 1 comment

Comments

@BrandonShega
Copy link

Sorry for all of the issue spam. I have this code here which resets the data based on a segment that the user can change. The problem am I seeing is that right before the graph animates, it is shown as fully drawn and then the graph draws. Is there any way to prevent it from drawing right before the animation?

        [self.graphIndicator stopAnimating];
//        self.barChartView.hidden = NO;

        self.currentBarChartDataSet = [[BarChartDataSet alloc] initWithYVals:self.graphData label:@"Current"];
        self.currentBarChartDataSet.barSpace = -0.3;
        self.currentBarChartDataSet.barShadowColor = [UIColor blackColor];
        self.currentBarChartDataSet.colors = @[[UIColor colorWithHexString:@"B3E869"]];

        self.pastBarChartDataSet = [[BarChartDataSet alloc] initWithYVals:self.pastGraphData label:@"Previous"];
        self.pastBarChartDataSet.barSpace = 0.1;
        self.pastBarChartDataSet.colors = @[[UIColor colorWithHexString:@"49B1D9"]];

        BarChartData *data = [[BarChartData alloc] initWithXVals: [DashboardUtility arrayOfValuesForXAxisForGraphDurationDASHBOARD:(int)self.duration withDate:[NSDate date]] dataSets:@[self.pastBarChartDataSet, self.currentBarChartDataSet]];

        self.barChartView.data = data;

        [self.barChartView setNeedsDisplay];
        [self.barChartView notifyDataSetChanged];

        self.barChartView.hidden = NO;

        [self.barChartView animateWithYAxisDuration:1.5];

Here is what it looks like
http://i.giphy.com/l41lG5AuF679u1560.gif

@danielgindi
Copy link
Collaborator

15b3f43
Try now...

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

2 participants