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

fix(bars): remove border visibility based on bar width #192

Merged
merged 1 commit into from
Apr 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/components/react_canvas/bar_geometries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface BarGeometriesDataState {
export class BarGeometries extends React.PureComponent<
BarGeometriesDataProps,
BarGeometriesDataState
> {
> {
static defaultProps: Partial<BarGeometriesDataProps> = {
animated: false,
};
Expand All @@ -43,10 +43,7 @@ export class BarGeometries extends React.PureComponent<

private renderBarGeoms = (bars: BarGeometry[]): JSX.Element[] => {
const { overBar } = this.state;
const {
style,
sharedStyle,
} = this.props;
const { style, sharedStyle } = this.props;
return bars.map((bar, index) => {
const { x, y, width, height, color, seriesStyle } = bar;
const border = seriesStyle ? seriesStyle.border : style.border;
Expand All @@ -68,8 +65,6 @@ export class BarGeometries extends React.PureComponent<
individualHighlight,
);

// min border depending on bar width bars with white border
const borderEnabled = border.visible && width > border.strokeWidth * 7;
if (this.props.animated) {
return (
<Group key={index}>
Expand All @@ -84,7 +79,7 @@ export class BarGeometries extends React.PureComponent<
fill: color,
stroke: border.stroke,
strokeWidth: border.strokeWidth,
borderEnabled,
borderEnabled: border.visible,
geometryStyle,
});

Expand All @@ -103,7 +98,7 @@ export class BarGeometries extends React.PureComponent<
fill: color,
stroke: border.stroke,
strokeWidth: border.strokeWidth,
borderEnabled,
borderEnabled: border.visible,
geometryStyle,
});
return <Rect {...barProps} />;
Expand Down