diff --git a/web/src/Components/Bridging/BridgeContainer.tsx b/web/src/Components/Bridging/BridgeContainer.tsx index ac27055..6c89702 100644 --- a/web/src/Components/Bridging/BridgeContainer.tsx +++ b/web/src/Components/Bridging/BridgeContainer.tsx @@ -41,8 +41,7 @@ export default ({ bridges, mode, setMode, bridgeValue, setValue }: BridgeContain useEffect(() => { if (bridges['Bridge'].length && sizeFractions.length) { - const x = findGraphData(sizeFractions, { Bridge: bridges['Bridge'] }) - setOptimalBridgeGraphData(x) + setOptimalBridgeGraphData(findGraphData(sizeFractions, { Bridge: bridges['Bridge'] })) } }, [bridges, sizeFractions]) diff --git a/web/src/Components/Bridging/Graphs/BridgeGraph.tsx b/web/src/Components/Bridging/Graphs/BridgeGraph.tsx index a2ac51b..f7efea9 100644 --- a/web/src/Components/Bridging/Graphs/BridgeGraph.tsx +++ b/web/src/Components/Bridging/Graphs/BridgeGraph.tsx @@ -1,7 +1,6 @@ import React, { useContext, useEffect, useState } from 'react' import { Area, AreaChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts' import { ParticleSizeContext } from '../../../Context' -import { findGraphData } from '../../../Utils' import { bridgeColor, graphColors } from '../styles' import { Bridge, GraphData } from '../../../Types' import { Typography } from '@equinor/eds-core-react' @@ -14,6 +13,25 @@ type BridgeGraphProps = { showBridge?: boolean } +const CustomTooltip = ({ active, payload, label }) => { + if (active && payload && payload.length) { + console.log(payload) + console.log(label) + return ( +
+
{`Particle size : ${label}µm`}
+
+ {payload.map((graphData: any) => ( +
{`${graphData.name}: ${graphData.value}%`}
+ ))} +
+
+ ) + } + + return null +} + export function BridgeGraph({ title, graphData, sizeFractions, bridges, showBridge = true }: BridgeGraphProps) { const [particleFromPercentage, setParticleFromPercentage] = useState('0%') const [particleToPercentage, setParticleToPercentage] = useState('100%') @@ -68,7 +86,7 @@ export function BridgeGraph({ title, graphData, sizeFractions, bridges, showBrid height={70} /> - + {Object.entries(bridges).map(([name, cumulative], index) => (