Skip to content

Commit

Permalink
feature: choose custom point style for bar legend display (#8341)
Browse files Browse the repository at this point in the history
* add feature to choose custom point style for bar legend display
* add documentation and type
* the docs are in the right place now
  • Loading branch information
LeeLenaleee committed Jan 30, 2021
1 parent 8cca4fe commit bc312d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/docs/charts/bar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ the color of the bars is generally set this way.
| [`indexAxis`](#general) | `string` | - | - | `'x'`
| [`label`](#general) | `string` | - | - | `''`
| [`order`](#general) | `number` | - | - | `0`
| [`pointStyle`](../configuration/elements.md#point-styles) | `string`\|`Image` | Yes | False | `'circle'`
| [`xAxisID`](#general) | `string` | - | - | first x axis
| [`yAxisID`](#general) | `string` | - | - | first y axis

Expand Down
1 change: 1 addition & 0 deletions src/controllers/controller.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ BarController.defaults = {
'categoryPercentage',
'maxBarThickness',
'minBarLength',
'pointStyle'
],
interaction: {
mode: 'index'
Expand Down
5 changes: 2 additions & 3 deletions test/specs/plugin.legend.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Legend block tests', function() {
lineJoin: undefined,
lineWidth: 10,
strokeStyle: 'green',
pointStyle: undefined,
pointStyle: 'crossRot',
rotation: undefined,
datasetIndex: 2
}]);
Expand Down Expand Up @@ -311,7 +311,7 @@ describe('Legend block tests', function() {
lineJoin: undefined,
lineWidth: 10,
strokeStyle: 'green',
pointStyle: undefined,
pointStyle: 'crossRot',
rotation: undefined,
datasetIndex: 2
}]);
Expand Down Expand Up @@ -887,4 +887,3 @@ describe('Legend block tests', function() {
});
});
});

6 changes: 6 additions & 0 deletions types/index.esm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ export interface BarControllerDatasetOptions
* Set this to ensure that bars have a minimum length in pixels.
*/
minBarLength: number;

/**
* Point style for the legend
* @default 'circle;
*/
pointStyle: PointStyle;
}

export interface BarControllerChartOptions {
Expand Down

0 comments on commit bc312d0

Please sign in to comment.