Skip to content

Commit a49801f

Browse files
author
jacobbleakley-neo4j
committed
Fixed bug (hopefully)
1 parent 82c3b0a commit a49801f

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/chart/bar/BarChart.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,27 @@ const NeoBarChart = (props: ChartProps) => {
124124
const handleBarClick = (e) => {
125125
// Get the original record that was used to draw this bar (or a group in a bar).
126126
const record = getOriginalRecordForNivoClickEvent(e, records, selection);
127-
// From that record, check if there are any rules assigned to each of the fields (columns).
128-
record
129-
? Object.keys(record).forEach((key) => {
130-
let rules = getRule({ field: key, value: record[key] }, actionsRules, 'Click');
131-
// If there is a rule assigned, run the rule with the specified field and value retrieved from the record.
132-
rules?.forEach((rule) => {
133-
const ruleField = rule.field;
134-
const ruleValue = record[rule.value];
135-
performActionOnElement(
136-
{ field: ruleField, value: ruleValue },
137-
actionsRules,
138-
{ ...props, pageNames: pageNames },
139-
'Click',
140-
'bar'
141-
);
142-
});
143-
})
144-
: null;
145-
};
127+
128+
// If there's a record, check if there are any rules assigned to each of the fields (columns).
129+
if (record) {
130+
Object.keys(record).forEach((key) => {
131+
let rules = getRule({ field: key, value: record[key] }, actionsRules, 'Click');
132+
// If there is a rule assigned, run the rule with the specified field and value retrieved from the record.
133+
rules?.forEach((rule) => {
134+
const ruleField = rule.field;
135+
const ruleValue = record[rule.value];
136+
performActionOnElement(
137+
{ field: ruleField, value: ruleValue },
138+
actionsRules,
139+
{ ...props, pageNames: pageNames },
140+
'Click',
141+
'bar'
142+
);
143+
});
144+
});
145+
}
146+
};
147+
146148

147149
// Function to calculate the right margin
148150
function calculateRightMargin(legendPosition, legend, legendWidth, marginRight) {

0 commit comments

Comments
 (0)