Skip to content

Commit

Permalink
fixed missing fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanjeev Lakhwani committed Nov 14, 2022
1 parent 84c56c5 commit 11f7c70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/js/components/Overview/charts/BentoBarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const TICK_MARGIN = 5;
const BentoBarChart = ({ title, data, units, height }) => {
const { t } = useTranslation();

// remove "missing" field if zero
data = data.filter((e) => !(e.x === 'missing'));
data = data.map((d) => ({ ...d, x: t(d.x) }));

const titleStyle = {
Expand All @@ -45,9 +47,6 @@ const BentoBarChart = ({ title, data, units, height }) => {

const totalCount = data.reduce((sum, e) => sum + e.y, 0);

// remove "missing" field if zero
data = data.filter((e) => !(e.x === 'missing'));

return (
<div style={wrapperStyle}>
<div style={titleStyle}>{title}</div>
Expand Down
2 changes: 2 additions & 0 deletions src/js/components/Overview/charts/BentoPie.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function BentoPie({ data, height }) {

// Changing immutable data to mutable data
data = [...data];
// remove "missing" field if zero
data = data.filter((e) => !(e.x === 'missing'));

// combining sections with less than OTHER_THRESHOLD
const sum = data.reduce((acc, e) => acc + e.y, 0);
Expand Down

0 comments on commit 11f7c70

Please sign in to comment.