@visactor/vchart-types 1.13.21-alpha.1 → 1.13.21-alpha.3

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.
@@ -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[];
@@ -1,3 +1,4 @@
1
1
  export * from './media-query';
2
2
  export * from './formatter';
3
3
  export * from './register';
4
+ export * from './scroll';
@@ -6,6 +6,7 @@ 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;
@@ -1,4 +1,4 @@
1
- import type { IGroup } from '@visactor/vrender-core';
1
+ import type { IGroup, IRectGraphicAttribute } from '@visactor/vrender-core';
2
2
  import { BasePlugin } from '../../base/base-plugin';
3
3
  import type { IChartPluginService } from '../interface';
4
4
  import type { IScrollPlugin } from './interface';
@@ -6,11 +6,15 @@ export declare class ScrollPlugin extends BasePlugin implements IScrollPlugin {
6
6
  static readonly pluginType: 'chart';
7
7
  static readonly type: string;
8
8
  readonly type: string;
9
+ readonly name: string;
9
10
  private _service;
10
11
  private _spec;
12
+ private _lastScrollX;
13
+ private _lastScrollY;
11
14
  private _scrollLimit;
12
15
  private _xScrollComponent;
13
16
  private _yScrollComponent;
17
+ private _event;
14
18
  constructor();
15
19
  onInit(service: IChartPluginService, chartSpec: any): void;
16
20
  onLayoutRectUpdate(service: IChartPluginService): void;
@@ -19,9 +23,19 @@ export declare class ScrollPlugin extends BasePlugin implements IScrollPlugin {
19
23
  protected _bindEvent(service: IChartPluginService): void;
20
24
  protected getRootMark(): IGroup;
21
25
  protected onWheel: (e: WheelEvent) => void;
26
+ private _computeFinalScrollY;
27
+ private _computeFinalScrollX;
22
28
  private _updateScrollY;
23
29
  private _getYScrollComponent;
24
30
  private _updateScrollX;
25
31
  private _getXScrollComponent;
32
+ scrollTo({ x, y }: {
33
+ x?: number;
34
+ y?: number;
35
+ }): void;
26
36
  }
27
- export declare const registerScrollPlugin: () => void;
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 {
@@ -34,6 +36,7 @@ export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimation
34
36
  maxLinkHeight?: number;
35
37
  iterations?: number;
36
38
  nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);
39
+ depthKey?: string | number | ((datum: SankeyNodeDatum) => string | number);
37
40
  linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;
38
41
  nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;
39
42
  setNodeLayer?: (datum: SankeyNodeDatum) => number;
@@ -53,6 +56,7 @@ export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimation
53
56
  };
54
57
  [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];
55
58
  overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
59
+ customLayout?: (layout: SankeyLayout, originalData: SankeyData, view: ReturnType<ISankeyOpt['view']>) => ReturnType<SankeyLayout['layout']>;
56
60
  }
57
61
  export interface SankeyLinkDatum {
58
62
  source: string | number;