Skip to content

Commit

Permalink
apply minor papercuts
Browse files Browse the repository at this point in the history
  • Loading branch information
robindemourat committed Aug 2, 2024
1 parent 0dde8ab commit 24dbc79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/TradeDynamicsChart/LongitudinalTradeChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const LongitudinalTradeChart = ({
const y = height - margins.bottom;
return (
<g
key={i}
key={year}
className="axis-group"
transform={`translate(${x}, ${y})`}
>
Expand Down Expand Up @@ -431,7 +431,7 @@ const LongitudinalTradeChart = ({
return (
<>
<circle
key={index}
key={index + "a"}
{...{
cx: x,
cy: y,
Expand All @@ -446,7 +446,7 @@ const LongitudinalTradeChart = ({
data-html={true}
/>
<circle
key={index + "a"}
key={index + "b"}
{...{
cx: x,
cy: y,
Expand Down
6 changes: 4 additions & 2 deletions src/components/TradeDynamicsChart/TradeDynamicsChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ const TradeDynamicsChart = (props) => {
atlasMode,
} = props;


const [rows, setRows] = useState(originalRows);
const [kind, setKind] = useState(originalKind);


useEffect(() => setRows(originalRows), [originalRows, setRows]);
useEffect(() => {
setKind(originalKind);
Expand Down Expand Up @@ -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) => {
Expand All @@ -156,7 +158,7 @@ const TradeDynamicsChart = (props) => {
return (
<LongitudinalTradeChart
width={width}
height={fixSvgDimension((height / totalRows) * rowFlex)}
height={fixSvgDimension((height / (totalRows)) * rowFlex)}
data={frenchData.filter((d) => d.kind === kind)}
absoluteField="value"
regressionField="reg"
Expand Down

0 comments on commit 24dbc79

Please sign in to comment.