@visactor/vchart-types 1.13.19 → 1.13.21-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ import type { IView } from '@visactor/vgrammar-core';
5
5
  import type { IBoundsLike } from '@visactor/vutils';
6
6
  import type { ISeriesSpecInfo } from '../../series/interface';
7
7
  import type { IRegionSpecInfo } from '../../region/interface';
8
+ import type { IChartPluginService } from '../../plugin/chart/interface';
8
9
  export interface ILayoutParams {
9
10
  srView?: IView;
10
11
  group?: any;
@@ -20,6 +21,7 @@ export interface IChartOption extends Omit<IModelOption, 'getChartViewRect' | 'g
20
21
  viewBox?: IBoundsLike;
21
22
  layout?: LayoutCallBack;
22
23
  disableTriggerEvent?: boolean;
24
+ chartPluginApply?: (funcName: keyof IChartPluginService, ...args: any[]) => any;
23
25
  }
24
26
  export interface IChartSpecTransformerOption extends Partial<IChartOption> {
25
27
  seriesType?: string;
@@ -22,6 +22,7 @@ import { Compiler } from '../compile/compiler';
22
22
  import type { IMorphConfig } from '../animation/spec';
23
23
  import type { DataLinkAxis, DataLinkSeries, IGlobalConfig, IVChart, IVChartRenderOption } from './interface';
24
24
  import { InstanceManager } from './instance-manager';
25
+ import type { IChartPluginService } from '../plugin/chart/interface';
25
26
  export declare class VChart implements IVChart {
26
27
  readonly id: number;
27
28
  static useRegisters(comps: (() => void)[]): void;
@@ -77,6 +78,7 @@ export declare class VChart implements IVChart {
77
78
  private _context;
78
79
  private _isReleased;
79
80
  private _chartPlugin?;
81
+ get chartPlugin(): IChartPluginService<any>;
80
82
  private _onResize?;
81
83
  constructor(spec: ISpec, options: IInitOption);
82
84
  private _setNewSpec;
@@ -1,4 +1,5 @@
1
1
  import type { SankeyOptions, SankeyData } from '@visactor/vgrammar-sankey';
2
+ import { SankeyLayout } from '@visactor/vgrammar-sankey';
2
3
  export interface ISankeyOpt extends SankeyOptions {
3
4
  targetField: string;
4
5
  sourceField: string;
@@ -9,6 +10,7 @@ export interface ISankeyOpt extends SankeyOptions {
9
10
  y0: number;
10
11
  y1: number;
11
12
  };
13
+ customLayout?: (layout: SankeyLayout, originalData: SankeyData, view: ReturnType<ISankeyOpt['view']>, option: ISankeyOpt) => ReturnType<SankeyLayout['layout']>;
12
14
  }
13
15
  export declare const collectHierarchyField: (set: Set<any>, data: any[], field: string) => void;
14
16
  export declare const sankeyFormat: (data: any[]) => SankeyData[];
@@ -8,6 +8,8 @@ export interface IChartPlugin<T extends IChartPluginService = any> extends IBase
8
8
  onAfterChartSpecTransform?: (service: T, chartSpec: any, actionSource: VChartRenderActionSource) => MaybePromise<void>;
9
9
  onAfterModelSpecTransform?: (service: T, chartSpec: any, chartSpecInfo: IChartSpecInfo, actionSource: VChartRenderActionSource) => MaybePromise<void>;
10
10
  onBeforeInitChart?: (service: T, chartSpec: any, actionSource: VChartRenderActionSource) => MaybePromise<void>;
11
+ onLayoutRectUpdate?: (service: T) => void;
12
+ onAfterRender?: (service: T) => void;
11
13
  }
12
14
  export interface IChartPluginConstructor {
13
15
  readonly pluginType: 'chart';
@@ -22,4 +24,6 @@ export interface IChartPluginService<T extends IChartPlugin = any> extends IBase
22
24
  onAfterChartSpecTransform?: (chartSpec: any, actionSource: VChartRenderActionSource) => MaybePromise<void>;
23
25
  onAfterModelSpecTransform?: (chartSpec: any, chartSpecInfo: IChartSpecInfo, actionSource: VChartRenderActionSource) => MaybePromise<void>;
24
26
  onBeforeInitChart?: (chartSpec: any, actionSource: VChartRenderActionSource) => MaybePromise<void>;
27
+ onLayoutRectUpdate?: () => void;
28
+ onAfterRender?: () => void;
25
29
  }
@@ -6,10 +6,13 @@ import type { IChartSpecInfo } from '../../chart/interface/common';
6
6
  export declare class ChartPluginService<T extends IChartPlugin = IChartPlugin> extends BasePluginService<T> implements IChartPluginService<T> {
7
7
  globalInstance: IVChart;
8
8
  constructor(globalInstance: IVChart);
9
+ getPlugin(name: string): T | undefined;
9
10
  onInit(chartSpec: any): void;
10
11
  onBeforeResize(width: number, height: number): void;
11
12
  onAfterChartSpecTransform(chartSpec: any, actionSource: VChartRenderActionSource): void;
12
13
  onAfterModelSpecTransform(chartSpec: any, chartSpecInfo: IChartSpecInfo, actionSource: VChartRenderActionSource): void;
13
14
  onBeforeInitChart(chartSpec: any, actionSource: VChartRenderActionSource): void;
15
+ onLayoutRectUpdate(): void;
16
+ onAfterRender(): void;
14
17
  releaseAll(): void;
15
18
  }
@@ -0,0 +1,2 @@
1
+ export * from './scroll';
2
+ export * from './interface';
@@ -0,0 +1,11 @@
1
+ import type { ScrollBarAttributes } from '@visactor/vrender-components';
2
+ import type { IChartPlugin } from '../interface';
3
+ export type IScrollPlugin = IChartPlugin;
4
+ export interface IScrollPluginSpec {
5
+ x?: {
6
+ enable: boolean;
7
+ } & Omit<ScrollBarAttributes, 'direction' | 'range'>;
8
+ y?: {
9
+ enable: boolean;
10
+ } & Omit<ScrollBarAttributes, 'direction' | 'range'>;
11
+ }
@@ -0,0 +1,41 @@
1
+ import type { IGroup, IRectGraphicAttribute } from '@visactor/vrender-core';
2
+ import { BasePlugin } from '../../base/base-plugin';
3
+ import type { IChartPluginService } from '../interface';
4
+ import type { IScrollPlugin } from './interface';
5
+ export declare class ScrollPlugin extends BasePlugin implements IScrollPlugin {
6
+ static readonly pluginType: 'chart';
7
+ static readonly type: string;
8
+ readonly type: string;
9
+ readonly name: string;
10
+ private _service;
11
+ private _spec;
12
+ private _lastScrollX;
13
+ private _lastScrollY;
14
+ private _scrollLimit;
15
+ private _xScrollComponent;
16
+ private _yScrollComponent;
17
+ private _event;
18
+ constructor();
19
+ onInit(service: IChartPluginService, chartSpec: any): void;
20
+ onLayoutRectUpdate(service: IChartPluginService): void;
21
+ onAfterRender(): void;
22
+ release(): void;
23
+ protected _bindEvent(service: IChartPluginService): void;
24
+ protected getRootMark(): IGroup;
25
+ protected onWheel: (e: WheelEvent) => void;
26
+ private _computeFinalScrollY;
27
+ private _computeFinalScrollX;
28
+ private _updateScrollY;
29
+ private _getYScrollComponent;
30
+ private _updateScrollX;
31
+ private _getXScrollComponent;
32
+ scrollTo({ x, y }: {
33
+ x?: number;
34
+ y?: number;
35
+ }): void;
36
+ }
37
+ export declare const registerScrollPlugin: (theme?: {
38
+ size?: number;
39
+ railStyle?: Omit<IRectGraphicAttribute, 'width' | 'height'>;
40
+ sliderStyle?: Omit<IRectGraphicAttribute, 'width' | 'height'>;
41
+ }) => void;
@@ -4,6 +4,8 @@ import type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';
4
4
  import type { IAnimationSpec } from '../../animation/spec';
5
5
  import type { SeriesMarkNameEnum } from '../interface/type';
6
6
  import type { ILabelSpec } from '../../component/label/interface';
7
+ import type { SankeyLayout } from '@visactor/vgrammar-sankey';
8
+ import type { ISankeyOpt } from '../../data/transforms/sankey';
7
9
  export type SankeyMark = 'node' | 'link' | 'label';
8
10
  export type SankeyAppearPreset = 'growIn' | 'fadeIn';
9
11
  export interface ISankeyAnimationParams {
@@ -53,6 +55,7 @@ export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimation
53
55
  };
54
56
  [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];
55
57
  overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
58
+ customLayout?: (layout: SankeyLayout, originalData: SankeyData, view: ReturnType<ISankeyOpt['view']>) => ReturnType<SankeyLayout['layout']>;
56
59
  }
57
60
  export interface SankeyLinkDatum {
58
61
  source: string | number;