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

Move left and move right #12

Open
iosdroid opened this issue Mar 25, 2015 · 2 comments
Open

Move left and move right #12

iosdroid opened this issue Mar 25, 2015 · 2 comments

Comments

@iosdroid
Copy link

Its possible to move left and move right in 5 columns

@zhuhuihuihui
Copy link
Owner

Hi,

I think you can create your own branch, and implement this feature, it should not be very difficult. You can create a merge request for me after you finish, I'd be happy to accept this feature.

Cheers,
Scott

@iosdroid
Copy link
Author

Hi,

Thanks for your appreciation . i implement your method like this for moving 5 columns.but it will return empty values where i am doing wrong. can u help me

- (void)moveRight
   {
if (nil == _dataSource)
{
    NSLog(@"Important!! DataSource Not Set!");
    return;
}
NSInteger index = _rightMostIndex - 5 * DIRECTION;
NSInteger totalColumnsRequired = [_dataSource numberOfColumnsInEColumnChart:self];
NSInteger test = totalColumnsRequired - _rightMostIndex;
NSInteger count = 0;
if (test >= 5) {
    count = 5;
}
else {
    count = test;
    index = totalColumnsRequired-1;
}

EColumnDataModel *eColumnDataModel = [_dataSource eColumnChart:self valueForIndex:index];
if (nil == eColumnDataModel)
    return;
 _leftMostIndex = _leftMostIndex - 5 * DIRECTION;
_rightMostIndex = _rightMostIndex - count * DIRECTION;

//    _leftMostIndex = _leftMostIndex - 5 * DIRECTION;
//    _rightMostIndex = _rightMostIndex - 5 * DIRECTION;


for (int i = 0; i < totalColumnsRequired; i++)
{
    EColumn *eColumn = [_eColumns objectForKey:[NSNumber numberWithInteger:_rightMostIndex + i * DIRECTION]];
    EColumn *nextEColumn = [_eColumns objectForKey:[NSNumber numberWithInteger:_rightMostIndex + (i + 5) * DIRECTION]];
    EColumnChartLabel *eColumnChartLabel = [_eLabels objectForKey:[NSNumber numberWithInteger:_rightMostIndex + i * DIRECTION]];
    EColumnChartLabel *nextEColumnChartLabel = [_eLabels objectForKey:[NSNumber numberWithInteger:_rightMostIndex + (i + 5) * DIRECTION]];


    eColumnChartLabel.frame = nextEColumnChartLabel.frame;
    eColumn.frame = nextEColumn.frame;
    /** Do not inlclude animations at the moment*/
    //        [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
    //            eColumn.frame = nextEColumn.frame;
    //        } completion:nil];

     }

       [self reloadData];
   }

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