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

Skip all borders if borderSkipped === true #10530

Merged
merged 3 commits into from Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/charts/bar.md
Expand Up @@ -74,7 +74,7 @@ Only the `data` option needs to be specified in the dataset namespace.
| [`barPercentage`](#barpercentage) | `number` | - | - | `0.9` |
| [`barThickness`](#barthickness) | `number`\|`string` | - | - | |
| [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`borderSkipped`](#borderskipped) | `string` | Yes | Yes | `'start'`
| [`borderSkipped`](#borderskipped) | `string`\|`boolean` | Yes | Yes | `'start'`
| [`borderWidth`](#borderwidth) | `number`\|`object` | Yes | Yes | `0`
| [`borderRadius`](#borderradius) | `number`\|`object` | Yes | Yes | `0`
| [`categoryPercentage`](#categorypercentage) | `number` | - | - | `0.8` |
Expand Down Expand Up @@ -163,7 +163,8 @@ Options are:
* `'left'`
* `'top'`
* `'right'`
* `false`
* `false` (don't skip any borders)
* `true` (skip all borders)

#### borderWidth

Expand Down
5 changes: 5 additions & 0 deletions src/controllers/controller.bar.js
Expand Up @@ -208,6 +208,11 @@ function setBorderSkipped(properties, options, stack, index) {
return;
}

if (edge === true) {
properties.borderSkipped = {top: true, right: true, bottom: true, left: true};
return;
}

const {start, end, reverse, top, bottom} = borderProps(properties);

if (edge === 'middle' && stack) {
Expand Down
4 changes: 2 additions & 2 deletions types/index.esm.d.ts
Expand Up @@ -1979,10 +1979,10 @@ export interface BarOptions extends Omit<CommonElementOptions, 'borderWidth'> {
base: number;

/**
* Skipped (excluded) border: 'start', 'end', 'left', 'right', 'bottom', 'top', 'middle' or false (none).
* Skipped (excluded) border: 'start', 'end', 'left', 'right', 'bottom', 'top', 'middle', false (none) or true (all).
* @default 'start'
*/
borderSkipped: 'start' | 'end' | 'left' | 'right' | 'bottom' | 'top' | 'middle' | false;
borderSkipped: 'start' | 'end' | 'left' | 'right' | 'bottom' | 'top' | 'middle' | boolean;

/**
* Border radius
Expand Down