[v10.0.x] XYChart: Point size editor should reflect correct default (5) (#71229)
XYChart: Point size editor should reflect correct default (5) (#71126)
fix(xychart): reconcile point size editors
(cherry picked from commit d92d3ede79)
Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com>
This commit is contained in:
co-authored by
Ihor Yeromin
parent
d147af2281
commit
dca52d575e
@@ -12,6 +12,8 @@ import { LineStyleEditor } from '../timeseries/LineStyleEditor';
|
|||||||
|
|
||||||
import { ScatterFieldConfig, ScatterShow } from './types';
|
import { ScatterFieldConfig, ScatterShow } from './types';
|
||||||
|
|
||||||
|
export const DEFAULT_POINT_SIZE = 5;
|
||||||
|
|
||||||
export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOptionsArgs<ScatterFieldConfig> {
|
export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOptionsArgs<ScatterFieldConfig> {
|
||||||
return {
|
return {
|
||||||
standardOptions: {
|
standardOptions: {
|
||||||
@@ -44,7 +46,7 @@ export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOp
|
|||||||
.addSliderInput({
|
.addSliderInput({
|
||||||
path: 'pointSize.fixed',
|
path: 'pointSize.fixed',
|
||||||
name: 'Point size',
|
name: 'Point size',
|
||||||
defaultValue: cfg.pointSize?.fixed,
|
defaultValue: cfg.pointSize?.fixed ?? DEFAULT_POINT_SIZE,
|
||||||
settings: {
|
settings: {
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 100,
|
max: 100,
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import {
|
|||||||
DimensionSupplier,
|
DimensionSupplier,
|
||||||
} from 'app/features/dimensions';
|
} from 'app/features/dimensions';
|
||||||
|
|
||||||
|
import { DEFAULT_POINT_SIZE } from './config';
|
||||||
|
|
||||||
// export enum ScatterLineMode {
|
// export enum ScatterLineMode {
|
||||||
// None = 'none',
|
// None = 'none',
|
||||||
// Linear = 'linear',
|
// Linear = 'linear',
|
||||||
@@ -61,7 +63,7 @@ export const defaultScatterConfig: ScatterFieldConfig = {
|
|||||||
fill: 'solid',
|
fill: 'solid',
|
||||||
},
|
},
|
||||||
pointSize: {
|
pointSize: {
|
||||||
fixed: 5,
|
fixed: DEFAULT_POINT_SIZE,
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 20,
|
max: 20,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { findFieldIndex, getScaledDimensionForField } from 'app/features/dimensi
|
|||||||
|
|
||||||
import { pointWithin, Quadtree, Rect } from '../barchart/quadtree';
|
import { pointWithin, Quadtree, Rect } from '../barchart/quadtree';
|
||||||
|
|
||||||
|
import { DEFAULT_POINT_SIZE } from './config';
|
||||||
import { isGraphable } from './dims';
|
import { isGraphable } from './dims';
|
||||||
import {
|
import {
|
||||||
DimensionValues,
|
DimensionValues,
|
||||||
@@ -140,7 +141,7 @@ function getScatterSeries(
|
|||||||
// Size configs
|
// Size configs
|
||||||
//----------------
|
//----------------
|
||||||
let pointSizeHints = dims.pointSizeConfig;
|
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;
|
let pointSize: DimensionValues<number> = () => pointSizeFixed;
|
||||||
if (dims.pointSizeIndex) {
|
if (dims.pointSizeIndex) {
|
||||||
pointSize = (frame) => {
|
pointSize = (frame) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user