Add errors when log on graphs with negative domain

This commit is contained in:
Sam Nolan 2022-06-23 03:21:24 +00:00
parent c42c646838
commit 3983fa8f0f

View File

@ -76,13 +76,19 @@ export const DistributionChart: React.FC<DistributionChartProps> = ({
return ( return (
<div style={{ width: widthProp }}> <div style={{ width: widthProp }}>
<Vega {!(isLogX && massBelow0) ? (
spec={spec} <Vega
data={{ con: shape.value.continuous, dis: shape.value.discrete }} spec={spec}
width={widthProp - 10} data={{ con: shape.value.continuous, dis: shape.value.discrete }}
height={height} width={widthProp - 10}
actions={false} height={height}
/> actions={false}
/>
) : (
<ErrorAlert heading="Log Domain Error">
Cannot graph distribution with negative values on logarithmic scale.
</ErrorAlert>
)}
<div className="flex justify-center"> <div className="flex justify-center">
{showSummary && <SummaryTable distribution={distribution} />} {showSummary && <SummaryTable distribution={distribution} />}
</div> </div>