Skip to content

Commit ab61073

Browse files
authored
Merge pull request esnet#281 from camflan/barchart-entire-category-highlight
add ability for highlighting entire event at once
2 parents 3a7fccc + 4e547fb commit ab61073

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/BarChart.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ export default class BarChart extends React.Component {
178178

179179
const isHighlighted =
180180
this.props.highlighted &&
181-
column === this.props.highlighted.column &&
182-
Event.is(this.props.highlighted.event, event);
181+
((column === this.props.highlighted.column &&
182+
Event.is(this.props.highlighted.event, event)) ||
183+
(this.props.highlightEntireEvent &&
184+
Event.is(this.props.highlighted.event, event)))
183185

184186
const isSelected =
185187
this.props.selected &&
@@ -354,6 +356,12 @@ BarChart.propTypes = {
354356
*/
355357
columns: PropTypes.arrayOf(PropTypes.string),
356358

359+
/**
360+
* When true, the entire `highlighted` event will be highlighted, instead of
361+
* only the column bar that's currently being hovered
362+
*/
363+
highlightEntireEvent: PropTypes.bool,
364+
357365
/**
358366
* The style of the bar chart drawing (using SVG CSS properties).
359367
* This is an object with a key for each column which is being drawn,
@@ -500,6 +508,7 @@ BarChart.propTypes = {
500508
BarChart.defaultProps = {
501509
visible: true,
502510
columns: ["value"],
511+
highlightEntireEvent: false,
503512
spacing: 1.0,
504513
offset: 0,
505514
minBarHeight: 1,

0 commit comments

Comments
 (0)