Skip to content

Commit

Permalink
fix(bars): remove border visibility based on bar width (#192)
Browse files Browse the repository at this point in the history
This commit will disable the automatic removal of a border for narrow bars. We let the
user/developer decide if the right size of that width.

fix #189
  • Loading branch information
markov00 authored Apr 26, 2019
1 parent 032be73 commit a270bab
Showing 1 changed file with 4 additions and 9 deletions.
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

0 comments on commit a270bab

Please sign in to comment.