8000 feat: add vchart updateSpec option by xuefei1313 · Pull Request #271 · VisActor/VStory · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add vchart updateSpec option #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class CharacterChart<T extends IChartGraphicAttribute>
ticker: this._ticker,
zIndex: this._config.zIndex ?? 0,
vchartBoundsMode: this._config.options.initOption?.vchartBoundsMode ?? 'clip',
updateSpecMorphConfig: this._config.options.initOption?.updateSpecMorphConfig ?? {},
chartInitOptions: mergeChartOption(
{
performanceHook: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { IAABBBounds, IBoundsLike } from '@visactor/vutils';
import { Bounds, pointInAABB, transformBoundsWithMatrix } from '@visactor/vutils';
import { mergeChartOption } from '../../../utils/chart';
import { isBoundsLikeEqual } from '../../../utils/equal';
import type { IMorphConfig } from '@visactor/vchart-types/types/animation/spec';

export interface IChartGraphicAttribute {
renderCanvas: HTMLCanvasElement;
Expand Down Expand Up @@ -33,6 +34,7 @@ export interface IChartGraphicAttribute {
zIndex?: number;
panel?: Partial<IRectGraphicAttribute>;
vchartBoundsMode?: 'clip' | 'auto';
updateSpecMorphConfig?: IMorphConfig;
}

export const CHART_NUMBER_TYPE = genNumberType();
Expand Down Expand Up @@ -189,7 +191,12 @@ export class VChartGraphic extends Rect {
this.updateVChartGraphicViewBox(attrs.viewBox);
}
if (attrs.spec) {
this._vchart.updateSpecSync(attrs.spec, false, {}, { reMake: true, change: true });
this._vchart.updateSpecSync(
attrs.spec,
false,
{ ...(this.attribute.updateSpecMorphConfig ?? {}) },
{ reMake: true, change: true }
);
}
}

Expand Down
7 changes: 6 additions & 1 deletion packages/vstory-core/src/interface/dsl/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ITextGraphicAttribute } from '@visactor/vrender-core';
import type { ChartSpecMap, IInitOption, IMarkAreaSpec, IMarkLineSpec, IMarkPointSpec, ISpec } from '@visactor/vchart';
import type { ICharacterConfigBase } from './dsl';
import type { IFormatConfig } from './common';
import type { IMorphConfig } from '@visactor/vchart-types/types/animation/spec';

export const StroyAllDataGroup = '_STORY_ALL_DATA_GROUP';

Expand Down Expand Up @@ -43,6 +44,10 @@ export interface IChartCharacterInitOption {
vchartBoundsMode?: 'clip' | 'auto';
}

export interface IUpdateSpecMorphConfig {
updateSpecMorphConfig?: IMorphConfig;
}

// 模块选择器
// number => model.getSpecIndex(); 模块的 specIndex
// * => chart.getAllModelInType(); 所有模块
Expand Down Expand Up @@ -80,7 +85,7 @@ export interface IChartCharacterConfig extends ICharacterConfigBase {
/**
* 初始化参数
*/
initOption?: IInitOption & IChartCharacterInitOption;
initOption?: IInitOption & IChartCharacterInitOption & IUpdateSpecMorphConfig;
/**
* 边距
*/
Expand Down
Loading
0