Skip to content

Commit

Permalink
refactor: bar.tsx (#3349)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
Assigned xAxis scaled values to a variable in the same way and used.

<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
  • Loading branch information
proke03 committed Feb 9, 2023
1 parent db0462b commit 2f6126a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cartesian/Bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ export class Bar extends PureComponent<Props, State> {
height += delta;
}
} else {
x = xAxis.scale(value[0]);
const [baseValueScale, currentValueScale] = [xAxis.scale(value[0]), xAxis.scale(value[1])];
x = baseValueScale;
y = getCateCoordinateOfBar({
axis: yAxis,
ticks: yAxisTicks,
Expand All @@ -213,7 +214,7 @@ export class Bar extends PureComponent<Props, State> {
entry,
index,
});
width = xAxis.scale(value[1]) - xAxis.scale(value[0]);
width = currentValueScale - baseValueScale;
height = pos.size;
background = { x: xAxis.x, y, width: xAxis.width, height };

Expand Down

0 comments on commit 2f6126a

Please sign in to comment.