Skip to content

Commit

Permalink
Fix/inconsistent proptypes of discrete color legend (#1147)
Browse files Browse the repository at this point in the history
* fix(DiscreteColorLegend): Fixed props validation

- Updated PropTypes of DiscreteColorLegend to be consistent with DiscreteColorLegendItem

* fix(DiscreteColorLegend): Updated documents
  • Loading branch information
lzhuor authored and mcnuttandrew committed Apr 6, 2019
1 parent 518b23b commit 794cba8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/legends.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Currently following types of legends are supported:

#### items (required)

Type: `Array<string|{title: string, color: String, strokeDasharray: string, strokeStyle: string, strokeWidth: number, disabled: boolean}|react element>`
Type: `Array<string|{title: string|react element, color: String, strokeDasharray: string, strokeStyle: string, strokeWidth: number, disabled: boolean}|react element>`

Array of items that should be shown on the legend. The array should consist from either objects (`title`, optional `color`, optional `strokeDasharray`, optional `strokeStyle`, optional `strokeWidth`, and optional `disabled` flag) or strings (treated as titles). The stroke properties should match those in your series (see [line series](line-mark-series.md))

Expand Down
2 changes: 1 addition & 1 deletion src/legends/discrete-color-legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ DiscreteColorLegend.propTypes = {
items: PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.shape({
title: PropTypes.string.isRequired,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
color: PropTypes.string,
disabled: PropTypes.bool
}),
Expand Down

0 comments on commit 794cba8

Please sign in to comment.