fix: scatter series size scale

This commit is contained in:
Howard Zhang 2023-06-19 04:10:40 +08:00
parent 3bddacf7d4
commit 3f71a6fa58
5 changed files with 10 additions and 11 deletions

2
.vscode/launch.json vendored
View File

@ -5,7 +5,7 @@
"name": "unit test",
"type": "pwa-node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"program": "${workspaceFolder}/packages/vchart/node_modules/.bin/jest",
"args": ["${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"

View File

@ -1,4 +1,4 @@
import { isNil, merge } from '@visactor/vutils';
import { array, isNil, merge } from '@visactor/vutils';
import type { IMark } from '../interface';
/** 跟随 mark 一起存储的信息 */
@ -59,8 +59,9 @@ export class MarkSet {
return [...this._children];
}
getMarksInType(type: string): IMark[] {
return this._children.filter(m => m.type === type);
getMarksInType(type: string | string[]): IMark[] {
const types = array(type);
return this._children.filter(m => types.includes(m.type));
}
getMarkInId(markId: number): IMark | undefined {

View File

@ -703,11 +703,10 @@ export abstract class BaseSeries<T extends ISeriesSpec> extends BaseModel implem
return this.getMarks().filter(m => !m.name.includes('seriesGroup'));
}
getMarksInType(type: string | string[]): IMark[] {
const typeList = array(type);
return this.getMarks().filter(m => typeList.includes(m.type));
return this._marks.getMarksInType(type);
}
getMarkInName(name: string): IMark | undefined {
return this.getMarks().find(m => m.name === name);
return this._marks.get(name);
}
getMarkInId(markId: number): IMark | undefined {
return this.getMarks().find(m => m.id === markId);

View File

@ -44,7 +44,7 @@ export interface IScatterSeriesSpec
}
export interface IScatterSeriesTheme extends ICartesianSeriesTheme {
size: number;
shape: ShapeType;
size?: number;
shape?: ShapeType;
[SeriesMarkNameEnum.point]?: Partial<IMarkTheme<ISymbolMarkSpec>>;
}

View File

@ -2,11 +2,10 @@ import type { IScatterSeriesTheme } from '../../../../series/scatter/interface';
import { THEME_CONSTANTS } from '../constants';
export const scatter: IScatterSeriesTheme = {
size: 10,
shape: 'circle',
point: {
style: {
size: 8,
symbolType: 'circle',
lineWidth: 0,
fillOpacity: 0.8
}