Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Always use scale.x for getBarWidth #274

Merged
merged 1 commit into from
Jul 26, 2017
Merged

Conversation

bijection
Copy link
Contributor

Victory-bar handles switching the x and y scales for horizontal bars in getCalculatedValues:

const scale = {
  x: horizontal ? yScale : xScale,
  y: horizontal ? xScale : yScale
};

Currently, the getBarWidth function switches them again to calculate width:

const range = horizontal ? scale.y.range() : scale.x.range();

Because of this, horizontal Bars rendered by VictoryBar actually end up using their VictoryBar's xScale to determine their widths. This results in the following bug:

image |
image
--- | ---

This patch remediates the problem by always using scale.x in getBarWidth, under the assumption that scale.x will in fact be a parent VictoryBar's yScale if the Bar is horizontal.

@boygirl
Copy link
Contributor

boygirl commented Jul 26, 2017

@bijection thanks for this change!

@boygirl boygirl merged commit b73192f into FormidableLabs:master Jul 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants