diff --git a/src/components/TradeDynamicsChart/LongitudinalTradeChart.js b/src/components/TradeDynamicsChart/LongitudinalTradeChart.js index 17fd6bc..df9c34a 100644 --- a/src/components/TradeDynamicsChart/LongitudinalTradeChart.js +++ b/src/components/TradeDynamicsChart/LongitudinalTradeChart.js @@ -284,7 +284,7 @@ const LongitudinalTradeChart = ({ const y = height - margins.bottom; return ( @@ -431,7 +431,7 @@ const LongitudinalTradeChart = ({ return ( <> { atlasMode, } = props; + const [rows, setRows] = useState(originalRows); const [kind, setKind] = useState(originalKind); + useEffect(() => setRows(originalRows), [originalRows, setRows]); useEffect(() => { setKind(originalKind); @@ -138,7 +140,7 @@ const TradeDynamicsChart = (props) => { ]; const totalRows = Object.entries(rows).reduce( - (sum, [id, count]) => sum + count, + (sum, [id, flexNumber]) => sum + (+flexNumber), 0 ); const renderRow = (row, rowFlex, rowIndex) => { @@ -156,7 +158,7 @@ const TradeDynamicsChart = (props) => { return ( d.kind === kind)} absoluteField="value" regressionField="reg"