Heatmap: Fix log scale editor (#68132)

This commit is contained in:
Ryan McKinley 2023-05-09 14:29:52 -07:00 committed by GitHub
parent f100a4c680
commit 4ee894b0be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,6 +150,7 @@ const LOG_DISTRIBUTION_OPTIONS: Array<SelectableValue<number>> = [
*/
export const ScaleDistributionEditor = ({ value, onChange }: StandardEditorProps<ScaleDistributionConfig>) => {
const type = value?.type ?? ScaleDistribution.Linear;
const log = value?.log ?? 2;
return (
<>
<div style={{ marginBottom: 16 }}>
@ -160,7 +161,7 @@ export const ScaleDistributionEditor = ({ value, onChange }: StandardEditorProps
onChange({
...value,
type: v!,
log: v === ScaleDistribution.Linear ? undefined : value.log ?? 2,
log: v === ScaleDistribution.Linear ? undefined : log,
});
}}
/>
@ -169,7 +170,7 @@ export const ScaleDistributionEditor = ({ value, onChange }: StandardEditorProps
<Field label="Log base">
<Select
options={LOG_DISTRIBUTION_OPTIONS}
value={value.log ?? 2}
value={log}
onChange={(v) => {
onChange({
...value,
@ -183,7 +184,7 @@ export const ScaleDistributionEditor = ({ value, onChange }: StandardEditorProps
<Field label="Linear threshold">
<Input
placeholder="1"
value={value.linearThreshold}
value={value?.linearThreshold}
onChange={(v) => {
onChange({
...value,