XYChart: Point size editor should reflect correct default (5) (#71126)

fix(xychart): reconcile point size editors
This commit is contained in:
Ihor Yeromin 2023-07-07 18:43:49 +02:00 committed by GitHub
parent 2075dc4f2b
commit d92d3ede79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,8 @@ import { LineStyleEditor } from '../timeseries/LineStyleEditor';
import { ScatterFieldConfig, ScatterShow } from './types';
export const DEFAULT_POINT_SIZE = 5;
export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOptionsArgs<ScatterFieldConfig> {
return {
standardOptions: {
@ -72,7 +74,7 @@ export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOp
.addSliderInput({
path: 'pointSize.fixed',
name: 'Point size',
defaultValue: cfg.pointSize?.fixed,
defaultValue: cfg.pointSize?.fixed ?? DEFAULT_POINT_SIZE,
settings: {
min: 1,
max: 100,

View File

@ -14,6 +14,8 @@ import {
DimensionSupplier,
} from 'app/features/dimensions';
import { DEFAULT_POINT_SIZE } from './config';
// export enum ScatterLineMode {
// None = 'none',
// Linear = 'linear',
@ -61,7 +63,7 @@ export const defaultScatterConfig: ScatterFieldConfig = {
fill: 'solid',
},
pointSize: {
fixed: 5,
fixed: DEFAULT_POINT_SIZE,
min: 1,
max: 20,
},

View File

@ -28,6 +28,7 @@ import { findFieldIndex, getScaledDimensionForField } from 'app/features/dimensi
import { pointWithin, Quadtree, Rect } from '../barchart/quadtree';
import { DEFAULT_POINT_SIZE } from './config';
import { isGraphable } from './dims';
import {
DimensionValues,
@ -140,7 +141,7 @@ function getScatterSeries(
// Size configs
//----------------
let pointSizeHints = dims.pointSizeConfig;
let pointSizeFixed = dims.pointSizeConfig?.fixed ?? y.config.custom?.pointSize?.fixed ?? 5;
let pointSizeFixed = dims.pointSizeConfig?.fixed ?? y.config.custom?.pointSize?.fixed ?? DEFAULT_POINT_SIZE;
let pointSize: DimensionValues<number> = () => pointSizeFixed;
if (dims.pointSizeIndex) {
pointSize = (frame) => {