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

Fixed barView's frame. #57

Merged
merged 2 commits into from
May 14, 2014
Merged

Fixed barView's frame. #57

merged 2 commits into from
May 14, 2014

Conversation

pala
Copy link
Contributor

@pala pala commented May 13, 2014

There's no need to minus headerPadding when calculating barView's height.

@terryworona
Copy link
Collaborator

The headerPadding is:

The vertical padding between the header and highest chart point (bar, line, etc).

If a user demands padding between the header and chart, each bar should only go as high as the padding boundary and not beyond it.

@pala
Copy link
Contributor Author

pala commented May 14, 2014

The availableHeight doesn't include headerPadding.

- (CGFloat)availableHeight
{
    return self.bounds.size.height - self.headerView.frame.size.height - self.footerView.frame.size.height - self.headerPadding;
}
CGFloat height = [self normalizedHeightForRawHeight:[self.chartDataDictionary objectForKey:key]];

So the normalized height has already subtracted the headerPadding.

@terryworona
Copy link
Collaborator

The availableHeight does include headerPadding; a bar shouldn't extend past this.

All bar's are normalized against self.height - header.height - footer.height - headerPadding

Perhaps I'm overlooking something?

@pala
Copy link
Contributor Author

pala commented May 14, 2014

All bar's are normalized against self.height - header.height - footer.height - headerPadding

That's right, headerPadding has already been subtracted. The baseline you normalize against has excluded headerPadding.

You can test the demo with headerPadding = 100.0f.

@terryworona
Copy link
Collaborator

Ah yes, I see now. Good catch.

We might as well remove the headerPadding from the bar's original Y offset; not that it matters since it's reset in setState: anyways:

barView.frame = CGRectMake(xOffset, self.bounds.size.height - height - self.footerView.frame.size.height, [self barWidth], height + extensionHeight);

terryworona added a commit that referenced this pull request May 14, 2014
Fixed barView's frame.
@terryworona terryworona merged commit ac3744c into Jawbone:master May 14, 2014
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

Successfully merging this pull request may close these issues.

2 participants