@visactor/vchart-types 1.7.3 → 1.7.5

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.
@@ -1,7 +1,8 @@
1
+ import type { ITickDataOpt } from '@visactor/vutils-extension';
1
2
  import type { IBaseScale } from '@visactor/vscale';
2
3
  import type { IGroup, IGraphic } from '@visactor/vrender-core';
3
4
  import type { AxisItem } from '@visactor/vrender-components';
4
- import type { IOrientType, IPolarOrientType, StringOrNumber } from '../../typings';
5
+ import type { IOrientType, IPolarOrientType, StringOrNumber, CoordinateType } from '../../typings';
5
6
  import { BaseComponent } from '../base/base-component';
6
7
  import type { IPolarAxisCommonTheme } from './polar/interface';
7
8
  import type { ICartesianAxisCommonTheme } from './cartesian/interface';
@@ -9,7 +10,7 @@ import type { CompilableData } from '../../compile/data';
9
10
  import type { IAxis, ICommonAxisSpec, ITick } from './interface';
10
11
  import type { IComponentOption } from '../interface';
11
12
  import type { ISeries } from '../../series/interface';
12
- import type { ITransformOptions } from '@visactor/vdataset';
13
+ import { DataView, type ITransformOptions } from '@visactor/vdataset';
13
14
  import { type IComponentMark } from '../../mark/component';
14
15
  export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<string, any> = any> extends BaseComponent<T> implements IAxis {
15
16
  static specKey: string;
@@ -118,6 +119,8 @@ export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<s
118
119
  style: any;
119
120
  };
120
121
  };
122
+ protected _initTickDataSet<T extends ITickDataOpt>(options: T): DataView;
123
+ protected _tickTransformOption(coordinateType: CoordinateType): ITickDataOpt;
121
124
  addTransformToTickData(options: ITransformOptions, execute?: boolean): void;
122
125
  dataToPosition(values: any[]): number;
123
126
  }
@@ -11,6 +11,7 @@ import type { ILayoutRect, ILayoutType } from '../../../typings/layout';
11
11
  import type { IComponentOption } from '../../interface';
12
12
  import { ComponentTypeEnum } from '../../interface/type';
13
13
  import type { IAxis, ITick } from '../interface';
14
+ import type { ICartesianTickDataOpt, CoordinateType } from '@visactor/vutils-extension';
14
15
  import type { DataSet } from '@visactor/vdataset';
15
16
  import { AxisComponent } from '../base-axis';
16
17
  import type { IGraphic } from '@visactor/vrender-core';
@@ -69,7 +70,7 @@ export declare abstract class CartesianAxis<T extends ICartesianAxisCommonSpec =
69
70
  init(option: IModelInitOption): void;
70
71
  setAttrFromSpec(): void;
71
72
  protected getSeriesStatisticsField(s: ICartesianSeries): string[];
72
- protected _initTickData(sampling: boolean): void;
73
+ protected _tickTransformOption(coordinateType: CoordinateType): ICartesianTickDataOpt;
73
74
  protected _initData(): void;
74
75
  protected axisHelper(): IAxisHelper;
75
76
  afterCompile(): void;
@@ -2,6 +2,7 @@ import type { IBaseScale } from '@visactor/vscale';
2
2
  import type { IPolarAxis, IPolarAxisCommonSpec, IPolarAxisCommonTheme } from './interface';
3
3
  import type { IComponentOption } from '../../interface';
4
4
  import { ComponentTypeEnum } from '../../interface/type';
5
+ import type { IPolarTickDataOpt, CoordinateType } from '@visactor/vutils-extension';
5
6
  import type { IPolarSeries } from '../../../series/interface';
6
7
  import type { IPoint, IPolarOrientType, IPolarPoint, StringOrNumber, ILayoutType } from '../../../typings';
7
8
  import type { IEffect } from '../../../model/interface';
@@ -41,6 +42,7 @@ export declare abstract class PolarAxis<T extends IPolarAxisCommonSpec = IPolarA
41
42
  onRender(ctx: any): void;
42
43
  changeRegions(): void;
43
44
  protected _initData(): void;
45
+ protected _tickTransformOption(coordinateType: CoordinateType): IPolarTickDataOpt;
44
46
  afterCompile(): void;
45
47
  protected updateScaleRange(): boolean;
46
48
  protected collectData(depth: number): {
@@ -26,11 +26,12 @@ export declare class Label<T extends ILabelSpec = ILabelSpec> extends BaseLabelC
26
26
  name: string;
27
27
  layoutZIndex: number;
28
28
  protected _labelInfoMap: Map<IRegion, ILabelInfo[]>;
29
- protected _labelComponentMap: Map<IComponentMark, ILabelInfo | ILabelInfo[]>;
29
+ protected _labelComponentMap: Map<IComponentMark, () => ILabelInfo | ILabelInfo[]>;
30
30
  protected _layoutRule: 'series' | 'region';
31
31
  constructor(spec: T, options: IComponentOption);
32
32
  static createComponent(spec: any, options: IComponentOption): Label<any>[];
33
33
  init(option: IModelInitOption): void;
34
+ reInit(theme?: any): void;
34
35
  initEvent(): void;
35
36
  protected _delegateLabelEvent(component: IGroup): void;
36
37
  protected _initTextMark(): void;
@@ -11,15 +11,8 @@ export declare const labelRuleMap: {
11
11
  stackLabel: typeof stackLabel;
12
12
  line: typeof LineLabel;
13
13
  area: typeof LineLabel;
14
+ rect3d: typeof barLabel;
14
15
  };
15
- export declare enum LabelRule {
16
- rect = "rect",
17
- symbol = "symbol",
18
- arc = "arc",
19
- point = "point",
20
- stackLabel = "stackLabel",
21
- line = "line"
22
- }
23
16
  export declare function textAttribute(labelInfo: ILabelInfo, datum: Datum, formatMethod?: ILabelSpec['formatMethod'], formatter?: ILabelSpec['formatter']): any;
24
17
  export declare function symbolLabel(labelInfo: ILabelInfo): {
25
18
  position: string | ((datum: Datum) => any);
@@ -45,7 +45,8 @@ export declare enum LayoutZIndex {
45
45
  Title = 500,
46
46
  Label = 500,
47
47
  Brush = 500,
48
- CustomMark = 500
48
+ CustomMark = 500,
49
+ Interaction = 700
49
50
  }
50
51
  export declare enum LayoutLevel {
51
52
  Indicator = 10,
@@ -5,3 +5,4 @@ import type { CoordinateType, ILayoutPoint } from '../../../../typings';
5
5
  export declare const isInRegionBound: (chart: IChart, axis: AxisComponent, pos: ILayoutPoint) => boolean;
6
6
  export declare const isSameDimensionInfo: (a?: IDimensionInfo, b?: IDimensionInfo) => boolean;
7
7
  export declare const getDimensionData: (value: any, axis: AxisComponent, coordinate: CoordinateType, getDimensionField: (series: any) => string | string[]) => IDimensionData[];
8
+ export declare const getAxis: <T extends AxisComponent<any>>(chart: IChart, filter: (cmp: T) => boolean, pos: ILayoutPoint) => T[];
@@ -1,4 +1,5 @@
1
1
  import { DimensionHoverEvent, DimensionClickEvent } from './dimension';
2
+ export * from './dimension';
2
3
  export declare const ComposedEventMapper: {
3
4
  dimensionHover: typeof DimensionHoverEvent;
4
5
  dimensionClick: typeof DimensionClickEvent;
@@ -0,0 +1,2 @@
1
+ export * from './event';
2
+ export * from './events';
package/types/index.d.ts CHANGED
@@ -7,3 +7,4 @@ export * from './mark';
7
7
  export * from './component';
8
8
  export * from './layout';
9
9
  export * from './env';
10
+ export * from './event';
@@ -28,6 +28,7 @@ export interface IRegion extends ILayoutModel {
28
28
  getSeriesInDataName: (dataName: string) => ISeries[];
29
29
  getMarks: () => IMark[];
30
30
  getGroupMark: () => IGroupMark;
31
+ getInteractionMark: () => IGroupMark;
31
32
  }
32
33
  export type ISeriesFilter = {
33
34
  name?: string;
@@ -24,6 +24,8 @@ export declare class Region<T extends IRegionSpec = IRegionSpec> extends LayoutM
24
24
  setMaxHeight(value: number): void;
25
25
  protected _groupMark: IGroupMark;
26
26
  getGroupMark(): IGroupMark;
27
+ protected _interactionMark: IGroupMark;
28
+ getInteractionMark(): IGroupMark;
27
29
  getStackInverse(): boolean;
28
30
  protected _backgroundMark?: IRectMark;
29
31
  protected _foregroundMark?: IRectMark;
@@ -32,6 +34,7 @@ export declare class Region<T extends IRegionSpec = IRegionSpec> extends LayoutM
32
34
  protected _getClipDefaultValue(): boolean;
33
35
  _initTheme(): void;
34
36
  created(): void;
37
+ private _createGroupMark;
35
38
  init(option: any): void;
36
39
  initMark(): void;
37
40
  protected _initBackgroundMarkStyle(): void;
@@ -9,8 +9,8 @@ import type { IDataSamping, IMarkOverlap, IMarkProgressiveConfig } from '../../m
9
9
  import type { ILabelSpec } from '../../component';
10
10
  export interface IAreaSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<string, AreaAppearPreset>, IMarkProgressiveConfig, IDataSamping, IMarkOverlap {
11
11
  type: 'area';
12
- xField: string | string[];
13
- yField: string | string[];
12
+ xField?: string | string[];
13
+ yField?: string | string[];
14
14
  [SeriesMarkNameEnum.point]?: IMarkSpec<ISymbolMarkSpec>;
15
15
  [SeriesMarkNameEnum.line]?: IMarkSpec<ILineMarkSpec>;
16
16
  [SeriesMarkNameEnum.area]?: IMarkSpec<IAreaMarkSpec>;
@@ -10,8 +10,8 @@ import type { Functional } from '@visactor/vrender-components';
10
10
  type BarMarks = 'bar';
11
11
  export interface IBarSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<BarMarks, BarAppearPreset>, IMarkProgressiveConfig, IDataSamping {
12
12
  type: 'bar';
13
- xField: string | string[];
14
- yField: string | string[];
13
+ xField?: string | string[];
14
+ yField?: string | string[];
15
15
  [SeriesMarkNameEnum.bar]?: IMarkSpec<IRectMarkSpec>;
16
16
  [SeriesMarkNameEnum.barBackground]?: IMarkSpec<IRectMarkSpec>;
17
17
  [SeriesMarkNameEnum.label]?: Omit<ILabelSpec, 'position'> & {
@@ -10,8 +10,8 @@ import type { ILabelSpec } from '../../component';
10
10
  type LineMarks = 'point' | 'line';
11
11
  export interface ILineSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<LineMarks, LineAppearPreset>, IMarkProgressiveConfig, IDataSamping, IMarkOverlap {
12
12
  type: 'line';
13
- xField: string | string[];
14
- yField: string | string[];
13
+ xField?: string | string[];
14
+ yField?: string | string[];
15
15
  [SeriesMarkNameEnum.point]?: IMarkSpec<ISymbolMarkSpec>;
16
16
  [SeriesMarkNameEnum.line]?: IMarkSpec<ILineMarkSpec>;
17
17
  [SeriesMarkNameEnum.label]?: ILineLikeLabelSpec;
@@ -33,6 +33,8 @@ export declare class BasePieSeries<T extends IBasePieSeriesSpec> extends PolarSe
33
33
  setAttrFromSpec(): void;
34
34
  initData(): void;
35
35
  initMark(): void;
36
+ private startAngleScale;
37
+ private endAngleScale;
36
38
  initMarkStyle(): void;
37
39
  protected initTooltip(): void;
38
40
  initMarkStyleWithSpec(mark?: IMark, spec?: any, key?: string): void;
@@ -17,8 +17,11 @@ export declare class RoseSeries<T extends IRoseSeriesSpec = IRoseSeriesSpec> ext
17
17
  protected _labelMark: ITextMark | null;
18
18
  initMark(): void;
19
19
  initMarkStyle(): void;
20
+ protected _buildMarkAttributeContext(): void;
20
21
  private initRoseMark;
21
22
  private getRoseAngle;
23
+ private startAngleScale;
24
+ private endAngleScale;
22
25
  private initRoseMarkStyle;
23
26
  protected initTooltip(): void;
24
27
  initLabelMarkStyle(textMark: ILabelMark): void;
@@ -8,8 +8,8 @@ import type { SeriesMarkNameEnum } from '../interface/type';
8
8
  import type { ILineLikeLabelSpec } from '../mixin/line-mixin';
9
9
  export interface IScatterSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<ScatterMarks, ScatterAppearPreset>, IMarkProgressiveConfig {
10
10
  type: 'scatter';
11
- xField: string | string[];
12
- yField: string | string[];
11
+ xField?: string | string[];
12
+ yField?: string | string[];
13
13
  [SeriesMarkNameEnum.point]?: IMarkSpec<ISymbolMarkSpec>;
14
14
  sizeField?: string;
15
15
  size?: number | number[] | FunctionType<number> | IVisualSpecBase<unknown, number>;
@@ -21,6 +21,7 @@ export declare class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IB
21
21
  protected _colorList: string[];
22
22
  protected _rotateAngles?: number[];
23
23
  protected _fontWeightRange?: [number, number];
24
+ protected _textField?: string;
24
25
  protected _fontSizeRange?: [number, number];
25
26
  setFontSizeRange(fontSizeRange: [number, number]): void;
26
27
  protected _maskShape?: string | WordCloudShapeType;
@@ -46,6 +47,8 @@ export declare class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IB
46
47
  field: string;
47
48
  };
48
49
  compile(): void;
50
+ protected _wordCloudTransformOption(): Object;
51
+ protected _wordCloudShapeTransformOption(): Object;
49
52
  getStatisticFields(): {
50
53
  key: string;
51
54
  operations: Array<'max' | 'min' | 'values'>;
@@ -4,7 +4,28 @@ import { BaseWordCloudSeries } from './base';
4
4
  export declare class WordCloud3dSeries<T extends IWordCloud3dSeriesSpec = IWordCloud3dSeriesSpec> extends BaseWordCloudSeries<T> {
5
5
  static readonly type: string;
6
6
  type: SeriesTypeEnum;
7
- compile(): void;
7
+ protected _wordCloudTransformOption(): {
8
+ postProjection: "StereographicProjection";
9
+ depth_3d: number;
10
+ constructor: Function;
11
+ toString(): string;
12
+ toLocaleString(): string;
13
+ valueOf(): Object;
14
+ hasOwnProperty(v: PropertyKey): boolean;
15
+ isPrototypeOf(v: Object): boolean;
16
+ propertyIsEnumerable(v: PropertyKey): boolean;
17
+ };
18
+ protected _wordCloudShapeTransformOption(): {
19
+ postProjection: "StereographicProjection";
20
+ depth_3d: number;
21
+ constructor: Function;
22
+ toString(): string;
23
+ toLocaleString(): string;
24
+ valueOf(): Object;
25
+ hasOwnProperty(v: PropertyKey): boolean;
26
+ isPrototypeOf(v: Object): boolean;
27
+ propertyIsEnumerable(v: PropertyKey): boolean;
28
+ };
8
29
  initMark(): void;
9
30
  initMarkStyle(): void;
10
31
  initAnimation(): void;
@@ -24,6 +24,7 @@ import type { ITreemapChartSpec } from '../../chart/treemap';
24
24
  import type { IWaterfallChartSpec } from '../../chart/waterfall';
25
25
  import type { ICorrelationChartSpec } from '../../chart/correlation';
26
26
  import type { IWordCloudChartSpec, IWordCloud3dChartSpec } from '../../chart/word-cloud';
27
+ import type { IChartSpec } from './common';
27
28
  export interface ChartSpecMap {
28
29
  readonly common: ICommonChartSpec;
29
30
  readonly area: IAreaChartSpec;
@@ -58,4 +59,4 @@ export interface ChartSpecMap {
58
59
  readonly heatmap: IHeatmapChartSpec;
59
60
  readonly correlation: ICorrelationChartSpec;
60
61
  }
61
- export type ISpec = ChartSpecMap[keyof ChartSpecMap];
62
+ export type ISpec = ChartSpecMap[keyof ChartSpecMap] | IChartSpec;
@@ -2,3 +2,4 @@ import type { IRegion, ISeriesFilter } from '../region/interface';
2
2
  import type { ISeries } from '../series/interface';
3
3
  export declare function eachSeries(regions: IRegion[], callback: (s: ISeries) => boolean | void, filter?: ISeriesFilter): boolean;
4
4
  export declare function getSeries(regions: IRegion[], filter?: ISeriesFilter): ISeries[];
5
+ export declare const getFirstSeries: (regions: IRegion[], coordinateType?: 'cartesian' | 'polar') => ISeries;