Skip to content

Commit

Permalink
Heatmap: Fix log scale editor (#68132)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantxu committed May 9, 2023
1 parent f100a4c commit 4ee894b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/grafana-ui/src/options/builder/axis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}>
Expand All @@ -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,
});
}}
/>
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 4ee894b

Please sign in to comment.