don't allow log scale for ranges with negative values (b/c of problem with graph library)

This commit is contained in:
mantikoros 2022-07-01 13:38:13 -04:00
parent c339253507
commit c8bf333877

View File

@ -186,7 +186,7 @@ export function NewContract(props: {
min, min,
max, max,
initialValue, initialValue,
isLogScale, isLogScale: (min ?? 0) < 0 ? false : isLogScale,
groupId: selectedGroup?.id, groupId: selectedGroup?.id,
tags: category ? [category] : undefined, tags: category ? [category] : undefined,
}) })
@ -289,14 +289,16 @@ export function NewContract(props: {
/> />
</Row> </Row>
<Row className="mt-1 ml-2 mb-2 items-center"> {!(min !== undefined && min < 0) && (
<span className="mr-2 text-sm">Log scale</span>{' '} <Row className="mt-1 ml-2 mb-2 items-center">
<input <span className="mr-2 text-sm">Log scale</span>{' '}
type="checkbox" <input
checked={isLogScale} type="checkbox"
onChange={() => setIsLogScale(!isLogScale)} checked={isLogScale}
/> onChange={() => setIsLogScale(!isLogScale)}
</Row> />
</Row>
)}
{min !== undefined && max !== undefined && min >= max && ( {min !== undefined && max !== undefined && min >= max && (
<div className="mt-2 mb-2 text-sm text-red-500"> <div className="mt-2 mb-2 text-sm text-red-500">