@visactor/vchart-types 1.9.2 → 1.10.0-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.
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/types/component/axis/interface/spec.d.ts +5 -6
- package/types/component/indicator/interface.d.ts +5 -5
- package/types/component/label/base-label.d.ts +4 -4
- package/types/component/label/interface.d.ts +6 -8
- package/types/component/label/util.d.ts +1 -1
- package/types/component/legend/discrete/interface.d.ts +2 -2
- package/types/component/marker/interface.d.ts +6 -6
- package/types/component/marker/mark-area/interface/theme.d.ts +1 -1
- package/types/component/marker/mark-line/interface/theme.d.ts +1 -1
- package/types/component/marker/mark-point/interface/theme.d.ts +1 -1
- package/types/component/title/interface/spec.d.ts +18 -7
- package/types/mark/label.d.ts +2 -2
- package/types/mark/text.d.ts +16 -7
- package/types/series/dot/interface.d.ts +2 -2
- package/types/series/funnel/interface.d.ts +6 -4
- package/types/series/line/interface.d.ts +1 -1
- package/types/series/map/interface.d.ts +2 -5
- package/types/series/pie/interface.d.ts +3 -2
- package/types/series/range-column/interface.d.ts +5 -5
- package/types/series/treemap/interface.d.ts +3 -2
- package/types/series/word-cloud/interface.d.ts +2 -6
- package/types/typings/spec/common.d.ts +16 -7
- package/types/typings/visual.d.ts +10 -5
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { AxisItem, AxisItemStateStyle } from '@visactor/vrender-components';
|
|
2
2
|
import type { IAnimationSpec } from '../../../animation/spec';
|
|
3
|
-
import type { Datum, IPadding, IRectMarkSpec, IRuleMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../../typings';
|
|
3
|
+
import type { Datum, IFormatMethod, IPadding, IRectMarkSpec, IRichTextFormatMethod, IRuleMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../../typings';
|
|
4
4
|
import type { IComponentSpec } from '../../base/interface';
|
|
5
5
|
import type { AxisType, IAxisItem, IBandAxisLayer, ITickCalculationCfg, StyleCallback } from './common';
|
|
6
|
-
import type { IRichTextCharacter } from '@visactor/vrender-core';
|
|
7
6
|
export interface ICommonAxisSpec extends Omit<IComponentSpec, 'orient' | 'center'>, IAnimationSpec<string, string> {
|
|
8
7
|
type?: AxisType;
|
|
9
8
|
visible?: boolean;
|
|
@@ -62,8 +61,8 @@ export interface ISubTick extends IAxisItem<IRuleMarkSpec> {
|
|
|
62
61
|
state?: AxisItemStateStyle<IRuleMarkSpec>;
|
|
63
62
|
}
|
|
64
63
|
export interface ILabel extends IAxisItem<ITextMarkSpec> {
|
|
65
|
-
type?: 'text' | 'rich'
|
|
66
|
-
formatMethod?:
|
|
64
|
+
type?: 'text' | 'rich';
|
|
65
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: Datum]>;
|
|
67
66
|
space?: number;
|
|
68
67
|
inside?: boolean;
|
|
69
68
|
minGap?: number;
|
|
@@ -75,6 +74,8 @@ export interface IDomainLine extends IAxisItem<IRuleMarkSpec> {
|
|
|
75
74
|
state?: AxisItemStateStyle<IRuleMarkSpec>;
|
|
76
75
|
}
|
|
77
76
|
export interface ITitle extends IAxisItem<ITextMarkSpec> {
|
|
77
|
+
type?: 'text' | 'rich';
|
|
78
|
+
text?: ITextMarkSpec['text'] | ReturnType<IRichTextFormatMethod<[]>>;
|
|
78
79
|
position?: 'start' | 'middle' | 'end';
|
|
79
80
|
space?: number;
|
|
80
81
|
padding?: IPadding | number | number[];
|
|
@@ -85,8 +86,6 @@ export interface ITitle extends IAxisItem<ITextMarkSpec> {
|
|
|
85
86
|
space?: number;
|
|
86
87
|
state?: AxisItemStateStyle<Partial<ISymbolMarkSpec>>;
|
|
87
88
|
};
|
|
88
|
-
type?: 'text' | 'rich' | 'html';
|
|
89
|
-
text?: string | string[] | IRichTextCharacter[];
|
|
90
89
|
angle?: number;
|
|
91
90
|
state?: AxisItemStateStyle<Partial<ITextMarkSpec>>;
|
|
92
91
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Datum, IFormatMethod } from '../../typings';
|
|
1
2
|
import type { IPercent } from '../../typings/layout';
|
|
2
3
|
import type { ConvertToMarkStyleSpec, ITextMarkSpec } from '../../typings/visual';
|
|
3
4
|
import type { IComponentSpec } from '../base/interface';
|
|
4
5
|
import type { IComponent } from '../interface';
|
|
5
|
-
import type { IRichTextCharacter } from '@visactor/vrender-core';
|
|
6
6
|
export interface IIndicatorItemSpec {
|
|
7
7
|
visible?: boolean;
|
|
8
8
|
field?: string;
|
|
@@ -12,8 +12,8 @@ export interface IIndicatorItemSpec {
|
|
|
12
12
|
fitPercent?: number;
|
|
13
13
|
fitStrategy?: 'default' | 'inscribed';
|
|
14
14
|
style?: Omit<ConvertToMarkStyleSpec<ITextMarkSpec>, 'visible' | 'text'> & {
|
|
15
|
-
type?: 'text' | 'rich'
|
|
16
|
-
text?:
|
|
15
|
+
type?: 'text' | 'rich';
|
|
16
|
+
text?: IFormatMethod<[activeDatum: Datum]> | ITextMarkSpec['text'] | ReturnType<IFormatMethod<[activeDatum: Datum]>>;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export type IIndicator = IComponent;
|
|
@@ -28,10 +28,10 @@ export interface IIndicatorSpec extends IComponentSpec {
|
|
|
28
28
|
title?: IIndicatorItemSpec;
|
|
29
29
|
content?: IIndicatorItemSpec[] | IIndicatorItemSpec;
|
|
30
30
|
}
|
|
31
|
-
export interface IIndicatorItemTheme extends IIndicatorItemSpec {
|
|
31
|
+
export interface IIndicatorItemTheme extends Omit<IIndicatorItemSpec, 'style'> {
|
|
32
32
|
style?: Omit<ITextMarkSpec, 'visible'>;
|
|
33
33
|
}
|
|
34
|
-
export interface IIndicatorTheme extends IIndicatorSpec {
|
|
34
|
+
export interface IIndicatorTheme extends Omit<IIndicatorSpec, 'content' | 'title'> {
|
|
35
35
|
title?: IIndicatorItemTheme;
|
|
36
36
|
content?: IIndicatorItemTheme;
|
|
37
37
|
}
|
|
@@ -16,10 +16,10 @@ export declare abstract class BaseLabelComponent<T = any> extends BaseComponent<
|
|
|
16
16
|
hover: boolean;
|
|
17
17
|
select: boolean;
|
|
18
18
|
state: {
|
|
19
|
-
hover?: Partial<import("
|
|
20
|
-
hover_reverse?: Partial<import("
|
|
21
|
-
selected?: Partial<import("
|
|
22
|
-
selected_reverse?: Partial<import("
|
|
19
|
+
hover?: Partial<import("../../typings").IComposedTextMarkSpec>;
|
|
20
|
+
hover_reverse?: Partial<import("../../typings").IComposedTextMarkSpec>;
|
|
21
|
+
selected?: Partial<import("../../typings").IComposedTextMarkSpec>;
|
|
22
|
+
selected_reverse?: Partial<import("../../typings").IComposedTextMarkSpec>;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
_compareSpec(spec: T, prevSpec: T): {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BaseLabelAttrs } from '@visactor/vrender-components';
|
|
2
|
-
import type { ConvertToMarkStyleSpec, Datum, ITextMarkSpec } from '../../typings';
|
|
2
|
+
import type { ConvertToMarkStyleSpec, Datum, IComposedTextMarkSpec, IFormatMethod, ITextMarkSpec } from '../../typings';
|
|
3
3
|
import type { IComponentSpec } from '../base/interface';
|
|
4
|
-
import type { IRichTextCharacter } from '@visactor/vrender-core';
|
|
5
4
|
import type { ILabelMark } from '../../mark/label';
|
|
6
5
|
import type { ISeries } from '../../series';
|
|
7
6
|
export interface ILabelFormatMethodContext {
|
|
@@ -10,13 +9,13 @@ export interface ILabelFormatMethodContext {
|
|
|
10
9
|
export interface ILabelSpec extends IComponentSpec {
|
|
11
10
|
visible?: boolean;
|
|
12
11
|
interactive?: boolean;
|
|
13
|
-
textType?:
|
|
14
|
-
formatMethod?:
|
|
12
|
+
textType?: 'text' | 'rich';
|
|
13
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: Datum, ctx?: ILabelFormatMethodContext]>;
|
|
15
14
|
formatter?: string;
|
|
16
15
|
offset?: number;
|
|
17
16
|
position?: string;
|
|
18
|
-
style?: ConvertToMarkStyleSpec<
|
|
19
|
-
state?: LabelStateStyle<Partial<
|
|
17
|
+
style?: ConvertToMarkStyleSpec<IComposedTextMarkSpec>;
|
|
18
|
+
state?: LabelStateStyle<Partial<IComposedTextMarkSpec>>;
|
|
20
19
|
overlap?: BaseLabelAttrs['overlap'];
|
|
21
20
|
smartInvert?: BaseLabelAttrs['smartInvert'];
|
|
22
21
|
animation?: BaseLabelAttrs['animation'];
|
|
@@ -24,7 +23,6 @@ export interface ILabelSpec extends IComponentSpec {
|
|
|
24
23
|
customLayoutFunc?: BaseLabelAttrs['customLayoutFunc'];
|
|
25
24
|
customOverlapFunc?: BaseLabelAttrs['customOverlapFunc'];
|
|
26
25
|
labelLayout?: 'series' | 'region';
|
|
27
|
-
centerOffset?: number;
|
|
28
26
|
support3d?: boolean;
|
|
29
27
|
syncState?: boolean;
|
|
30
28
|
}
|
|
@@ -34,7 +32,7 @@ type LabelStateStyle<T> = {
|
|
|
34
32
|
selected?: T;
|
|
35
33
|
selected_reverse?: T;
|
|
36
34
|
};
|
|
37
|
-
export type ITotalLabelSpec = Pick<ILabelSpec, 'visible' | 'formatMethod' | 'interactive' | 'offset' | 'style' | 'state'>;
|
|
35
|
+
export type ITotalLabelSpec = Pick<ILabelSpec, 'visible' | 'formatMethod' | 'interactive' | 'offset' | 'style' | 'state' | 'textType'>;
|
|
38
36
|
export interface ITotalLabelTheme extends Pick<ILabelSpec, 'visible' | 'interactive' | 'offset' | 'overlap' | 'smartInvert' | 'animation'> {
|
|
39
37
|
style?: ITextMarkSpec;
|
|
40
38
|
}
|
|
@@ -56,7 +56,7 @@ export declare function stackLabel(labelInfo: ILabelInfo): {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
export declare function treemapLabel(labelInfo: ILabelInfo): {
|
|
59
|
-
customLayoutFunc: (labels: LabelItem[]) =>
|
|
59
|
+
customLayoutFunc: (labels: LabelItem[], text: any) => any;
|
|
60
60
|
overlap: boolean;
|
|
61
61
|
};
|
|
62
62
|
export declare function LineLabel(labelInfo: ILabelInfo): {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec } from '../../../typings/visual';
|
|
2
2
|
import type { DiscreteLegendAttrs, LegendItemDatum, LegendItem } from '@visactor/vrender-components';
|
|
3
3
|
import type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface';
|
|
4
|
-
import type { StringOrNumber } from '../../../typings';
|
|
4
|
+
import type { IFormatMethod, StringOrNumber } from '../../../typings';
|
|
5
5
|
import type { IBaseScale } from '@visactor/vscale';
|
|
6
6
|
import type { IGlobalScale } from '../../../scale/interface';
|
|
7
|
-
export type formatterCallback =
|
|
7
|
+
export type formatterCallback = IFormatMethod<[text: StringOrNumber, item: LegendItemDatum, index: number]>;
|
|
8
8
|
export type LegendItemStyleValue<T> = T | ((item: LegendItemDatum, isSelected: boolean, index: number, allItems: LegendItemDatum[]) => T);
|
|
9
9
|
export type LegendItemStyle<T> = {
|
|
10
10
|
style?: T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IPadding } from '@visactor/vutils';
|
|
2
|
-
import type { SymbolType
|
|
3
|
-
import type { IRectMarkSpec,
|
|
2
|
+
import type { SymbolType } from '@visactor/vrender-core';
|
|
3
|
+
import type { IComposedTextMarkSpec, IFormatMethod, IRectMarkSpec, IRichTextFormatMethod, ISymbolMarkSpec, StringOrNumber } from '../../typings';
|
|
4
4
|
import type { IComponentSpec } from '../base/interface';
|
|
5
5
|
import type { Datum } from '@visactor/vrender-components';
|
|
6
6
|
import type { ICartesianSeries } from '../../series/interface';
|
|
@@ -44,10 +44,10 @@ export type IMarkerLabelWithoutRefSpec = {
|
|
|
44
44
|
padding?: IPadding | number[] | number;
|
|
45
45
|
style?: Omit<IRectMarkSpec, 'visible'>;
|
|
46
46
|
};
|
|
47
|
-
type?: '
|
|
48
|
-
text?: string | string[] | number | number[] |
|
|
49
|
-
formatMethod?:
|
|
50
|
-
style?: Omit<
|
|
47
|
+
type?: 'rich' | 'text';
|
|
48
|
+
text?: string | string[] | number | number[] | ReturnType<IRichTextFormatMethod<[]>>;
|
|
49
|
+
formatMethod?: IFormatMethod<[markData: Datum[], seriesData: Datum[]]>;
|
|
50
|
+
style?: Omit<IComposedTextMarkSpec, 'visible'>;
|
|
51
51
|
shape?: {
|
|
52
52
|
visible?: boolean;
|
|
53
53
|
style: Omit<ISymbolMarkSpec, 'visible'>;
|
|
@@ -4,7 +4,7 @@ import type { ILineMarkSpec, ISymbolMarkSpec } from '../../../../typings';
|
|
|
4
4
|
import type { IMarkerLabelSpec, IMarkerRef, IMarkerSymbol } from '../../interface';
|
|
5
5
|
export interface IItemContent extends IMarkerRef {
|
|
6
6
|
type?: 'symbol' | 'text' | 'image' | 'richText';
|
|
7
|
-
position?: IMarkPointItemPosition;
|
|
7
|
+
position?: keyof typeof IMarkPointItemPosition;
|
|
8
8
|
offsetX?: number;
|
|
9
9
|
offsetY?: number;
|
|
10
10
|
confine?: boolean;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { IComponent } from '../../interface';
|
|
2
2
|
import type { ITextGraphicAttribute, IRichTextCharacter, RichTextWordBreak } from '@visactor/vrender-core';
|
|
3
|
-
import type { IOrientType, IPadding
|
|
3
|
+
import type { IOrientType, IPadding } from '../../../typings';
|
|
4
4
|
import type { IComponentSpec } from '../../base/interface';
|
|
5
|
-
|
|
5
|
+
interface ITitleSpecWithoutText extends Omit<IComponentSpec, 'orient'> {
|
|
6
6
|
visible?: boolean;
|
|
7
7
|
orient?: IOrientType;
|
|
8
|
-
text?: string | number | string[] | number[] | IRichTextCharacter[];
|
|
9
|
-
textType?: string;
|
|
10
|
-
subtext?: string | number | string[] | number[] | IRichTextCharacter[];
|
|
11
|
-
subtextType?: string;
|
|
12
8
|
x?: number;
|
|
13
9
|
y?: number;
|
|
14
10
|
width?: number;
|
|
@@ -43,5 +39,20 @@ export interface ITitleSpec extends Omit<IComponentSpec, 'orient'> {
|
|
|
43
39
|
character?: IRichTextCharacter[];
|
|
44
40
|
} & Partial<ITextGraphicAttribute>;
|
|
45
41
|
}
|
|
46
|
-
export type
|
|
42
|
+
export type ITitleTextSpec = {
|
|
43
|
+
textType?: 'text';
|
|
44
|
+
text: string | number | string[] | number[];
|
|
45
|
+
} | {
|
|
46
|
+
textType: 'rich';
|
|
47
|
+
text: IRichTextCharacter[];
|
|
48
|
+
};
|
|
49
|
+
export type ISubTitleTextSpec = {
|
|
50
|
+
subtextType?: 'text';
|
|
51
|
+
subtext?: string | number | string[] | number[];
|
|
52
|
+
} | {
|
|
53
|
+
subtextType?: 'rich';
|
|
54
|
+
subtext?: IRichTextCharacter[];
|
|
55
|
+
};
|
|
56
|
+
export type ITitleSpec = ITitleSpecWithoutText & ITitleTextSpec & ISubTitleTextSpec;
|
|
47
57
|
export type ITitle = IComponent;
|
|
58
|
+
export {};
|
package/types/mark/label.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IComponentMark } from './component';
|
|
2
2
|
import type { IMark } from './interface/common';
|
|
3
3
|
import { MarkTypeEnum } from './interface/type';
|
|
4
|
-
import { TextMark } from './text';
|
|
4
|
+
import { ITextMark, TextMark } from './text';
|
|
5
5
|
export declare class LabelMark extends TextMark implements ILabelMark {
|
|
6
6
|
static readonly type = MarkTypeEnum.text;
|
|
7
7
|
static readonly constructorType = MarkTypeEnum.label;
|
|
@@ -16,7 +16,7 @@ export declare class LabelMark extends TextMark implements ILabelMark {
|
|
|
16
16
|
getComponent(): IMark;
|
|
17
17
|
setComponent(component: IMark): void;
|
|
18
18
|
}
|
|
19
|
-
export interface ILabelMark extends
|
|
19
|
+
export interface ILabelMark extends ITextMark {
|
|
20
20
|
skipEncode: boolean;
|
|
21
21
|
getRule: () => string;
|
|
22
22
|
setRule: (rule: string) => void;
|
package/types/mark/text.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IComposedTextMarkSpec } from '../typings/visual';
|
|
2
2
|
import { BaseMark } from './base/base-mark';
|
|
3
|
-
import type { IMarkRaw, IMarkStyle } from './interface';
|
|
3
|
+
import type { IMarkOption, IMarkRaw, IMarkStyle } from './interface';
|
|
4
4
|
import { MarkTypeEnum } from './interface';
|
|
5
|
-
import
|
|
6
|
-
export type ITextMark = IMarkRaw<
|
|
7
|
-
|
|
5
|
+
import { IMarkSpec } from '../typings/spec/common';
|
|
6
|
+
export type ITextMark = IMarkRaw<IComposedTextMarkSpec> & {
|
|
7
|
+
getTextType: () => 'text' | 'rich';
|
|
8
|
+
};
|
|
9
|
+
export type ITextSpec<T> = IMarkSpec<T> & {
|
|
10
|
+
textType?: 'rich' | 'text';
|
|
11
|
+
};
|
|
12
|
+
export declare class TextMark extends BaseMark<IComposedTextMarkSpec> implements ITextMark {
|
|
8
13
|
static readonly type = MarkTypeEnum.text;
|
|
9
14
|
readonly type = MarkTypeEnum.text;
|
|
10
|
-
protected
|
|
11
|
-
|
|
15
|
+
protected _textType: 'text' | 'rich';
|
|
16
|
+
getTextType(): "text" | "rich";
|
|
17
|
+
constructor(name: string, option: IMarkOption);
|
|
18
|
+
protected _getDefaultStyle(): IMarkStyle<IComposedTextMarkSpec>;
|
|
19
|
+
initStyleWithSpec(spec: ITextSpec<IComposedTextMarkSpec>, key?: string): void;
|
|
20
|
+
compileEncode(): void;
|
|
12
21
|
}
|
|
13
22
|
export declare const registerTextMark: () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ICartesianSeriesSpec, ICartesianSeriesTheme } from '../cartesian/interface';
|
|
2
|
-
import type { IMarkSpec, IMarkTheme } from '../../typings/spec/common';
|
|
2
|
+
import type { IFormatMethod, IMarkSpec, IMarkTheme } from '../../typings/spec/common';
|
|
3
3
|
import type { ISymbolMarkSpec, IRuleMarkSpec, ITextMarkSpec, ConvertToMarkStyleSpec } from '../../typings/visual';
|
|
4
4
|
import type { SeriesMarkNameEnum } from '../interface/type';
|
|
5
5
|
interface ISequenceLabel {
|
|
6
6
|
visible?: boolean;
|
|
7
|
-
formatMethod?:
|
|
7
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: any]>;
|
|
8
8
|
style?: Omit<ConvertToMarkStyleSpec<ITextMarkSpec>, 'visible'>;
|
|
9
9
|
}
|
|
10
10
|
interface ISequenceGrid {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { Datum, IMarkSpec, IMarkTheme, ISeriesSpec, IOrientType, IPathMarkSpec, IPolygonMarkSpec, IRuleMarkSpec, ITextMarkSpec, IPyramid3dMarkSpec, IPercent } from '../../typings';
|
|
1
|
+
import type { Datum, IMarkSpec, IMarkTheme, ISeriesSpec, IOrientType, IPathMarkSpec, IPolygonMarkSpec, IRuleMarkSpec, ITextMarkSpec, IPyramid3dMarkSpec, IPercent, IComposedTextMarkSpec, IFormatMethod } from '../../typings';
|
|
2
2
|
import type { IAnimationSpec } from '../../animation/spec';
|
|
3
3
|
import type { SeriesMarkNameEnum } from '../interface/type';
|
|
4
|
+
import { ILabelSpec } from '../../component';
|
|
5
|
+
import { ITextSpec } from '../../mark/text';
|
|
4
6
|
type FunnelMarks = 'funnel';
|
|
5
7
|
export type FunnelAppearPreset = 'clipIn' | 'fadeIn';
|
|
6
8
|
export interface IFunnelSeriesSpec extends ISeriesSpec, IAnimationSpec<FunnelMarks, FunnelAppearPreset> {
|
|
@@ -25,11 +27,11 @@ export interface IFunnelSeriesSpec extends ISeriesSpec, IAnimationSpec<FunnelMar
|
|
|
25
27
|
[SeriesMarkNameEnum.outerLabel]?: IFunnelOuterLabelSpec;
|
|
26
28
|
[SeriesMarkNameEnum.transformLabel]?: IFunnelLabelSpec;
|
|
27
29
|
}
|
|
28
|
-
interface IFunnelLabelSpec extends
|
|
30
|
+
interface IFunnelLabelSpec extends Omit<ILabelSpec, 'position'> {
|
|
29
31
|
limit?: 'shapeSize' | number;
|
|
30
|
-
formatMethod?: (text: string | string[], datum?: Datum) => string | string[];
|
|
31
32
|
}
|
|
32
|
-
export interface IFunnelOuterLabelSpec extends
|
|
33
|
+
export interface IFunnelOuterLabelSpec extends ITextSpec<IComposedTextMarkSpec> {
|
|
34
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: Datum]>;
|
|
33
35
|
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
34
36
|
spaceWidth?: number;
|
|
35
37
|
alignLabel?: boolean;
|
|
@@ -16,7 +16,7 @@ export interface ILineSeriesSpec extends ICartesianSeriesSpec, IAnimationSpec<Li
|
|
|
16
16
|
[SeriesMarkNameEnum.line]?: IMarkSpec<ILineMarkSpec>;
|
|
17
17
|
[SeriesMarkNameEnum.label]?: ILineLikeLabelSpec;
|
|
18
18
|
[SeriesMarkNameEnum.lineLabel]?: Omit<ILabelSpec, 'position'> & {
|
|
19
|
-
position
|
|
19
|
+
position?: 'start' | 'end';
|
|
20
20
|
};
|
|
21
21
|
seriesMark?: 'line' | 'point';
|
|
22
22
|
activePoint?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IPathMarkSpec, ITextMarkSpec } from '../../typings/visual';
|
|
2
2
|
import type { IMarkSpec, IMarkTheme, ISeriesSpec } from '../../typings/spec/common';
|
|
3
3
|
import type { IAnimationSpec } from '../../animation/spec';
|
|
4
|
+
import { ILabelSpec } from '../../component';
|
|
4
5
|
type LineMarks = 'area';
|
|
5
6
|
export interface IMapSeriesSpec extends ISeriesSpec, IAnimationSpec<LineMarks, 'fadeIn'> {
|
|
6
7
|
type: 'map';
|
|
@@ -14,11 +15,7 @@ export interface IMapSeriesSpec extends ISeriesSpec, IAnimationSpec<LineMarks, '
|
|
|
14
15
|
};
|
|
15
16
|
area?: IMarkSpec<Omit<IPathMarkSpec, 'smoothScale'>>;
|
|
16
17
|
defaultFillColor?: string;
|
|
17
|
-
label?:
|
|
18
|
-
offset?: number;
|
|
19
|
-
position?: string;
|
|
20
|
-
formatMethod?: (text: string | string[], datum?: any) => string | string[];
|
|
21
|
-
};
|
|
18
|
+
label?: Omit<ILabelSpec, 'position'>;
|
|
22
19
|
}
|
|
23
20
|
export interface IMapSeriesTheme {
|
|
24
21
|
defaultFillColor?: string;
|
|
@@ -57,14 +57,15 @@ export interface IArcLabelLayoutSpec {
|
|
|
57
57
|
strategy?: ArcLabelStrategyType;
|
|
58
58
|
tangentConstraint?: boolean;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export type IArcLabelSpec = Omit<ILabelSpec, 'position'> & {
|
|
61
61
|
position?: 'outside' | 'inside';
|
|
62
62
|
showRule?: 'all' | 'max' | 'min' | 'minAndMax' | 'headAndTail';
|
|
63
63
|
coverEnable?: boolean;
|
|
64
64
|
rotate?: boolean;
|
|
65
65
|
spaceWidth?: number;
|
|
66
66
|
layoutArcGap?: number;
|
|
67
|
+
centerOffset?: number;
|
|
67
68
|
style?: ITextMarkSpec;
|
|
68
69
|
line?: IArcLabelLineSpec;
|
|
69
70
|
layout?: IArcLabelLayoutSpec;
|
|
70
|
-
}
|
|
71
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IBarSeriesSpec } from '../bar/interface';
|
|
2
2
|
import type { ICartesianSeriesTheme } from '../cartesian/interface';
|
|
3
|
-
import type { IMarkSpec, IMarkTheme } from '../../typings/spec/common';
|
|
3
|
+
import type { IFormatMethod, IMarkSpec, IMarkTheme } from '../../typings/spec/common';
|
|
4
4
|
import type { IPositionedTextMarkSpec, IRectMarkSpec, ITextMarkSpec } from '../../typings/visual';
|
|
5
5
|
import type { IAnimationSpec } from '../../animation/spec';
|
|
6
6
|
import type { RangeColumnAppearPreset } from './animation';
|
|
@@ -26,16 +26,16 @@ export interface IRangeColumnSeriesSpec extends Omit<IBarSeriesSpec, 'type' | 'l
|
|
|
26
26
|
[SeriesMarkNameEnum.label]?: Partial<ILabelSpec> & {
|
|
27
27
|
position?: PositionEnum;
|
|
28
28
|
[SeriesMarkNameEnum.minLabel]?: IMarkSpec<IPositionedTextMarkSpec> & {
|
|
29
|
-
visible
|
|
29
|
+
visible?: boolean;
|
|
30
30
|
position?: keyof typeof minMaxPositionEnum;
|
|
31
31
|
offset?: number;
|
|
32
|
-
formatMethod?:
|
|
32
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: any]>;
|
|
33
33
|
};
|
|
34
34
|
[SeriesMarkNameEnum.maxLabel]?: IMarkSpec<IPositionedTextMarkSpec> & {
|
|
35
|
-
visible
|
|
35
|
+
visible?: boolean;
|
|
36
36
|
position?: minMaxPositionEnum;
|
|
37
37
|
offset?: number;
|
|
38
|
-
formatMethod?:
|
|
38
|
+
formatMethod?: IFormatMethod<[text: string | string[], datum?: any]>;
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -5,6 +5,7 @@ import type { ICartesianSeriesTheme } from '../cartesian/interface';
|
|
|
5
5
|
import type { IAnimationSpec } from '../../animation/spec';
|
|
6
6
|
import type { TreemapAppearPreset, TreemapMark } from './animation';
|
|
7
7
|
import type { SeriesMarkNameEnum } from '../interface/type';
|
|
8
|
+
import { ILabelSpec } from '../../component';
|
|
8
9
|
export interface ITreemapSeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<TreemapMark, TreemapAppearPreset> {
|
|
9
10
|
type: 'treemap';
|
|
10
11
|
categoryField: string;
|
|
@@ -23,8 +24,8 @@ export interface ITreemapSeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimatio
|
|
|
23
24
|
drillField?: string;
|
|
24
25
|
[SeriesMarkNameEnum.leaf]?: IMarkSpec<IRectMarkSpec>;
|
|
25
26
|
[SeriesMarkNameEnum.nonLeaf]?: IMarkSpec<IRectMarkSpec>;
|
|
26
|
-
[SeriesMarkNameEnum.label]?:
|
|
27
|
-
[SeriesMarkNameEnum.nonLeafLabel]?:
|
|
27
|
+
[SeriesMarkNameEnum.label]?: Omit<ILabelSpec, 'position' | 'overlap'>;
|
|
28
|
+
[SeriesMarkNameEnum.nonLeafLabel]?: Omit<ILabelSpec, 'position' | 'overlap'> & {
|
|
28
29
|
position?: TreemapOptions['labelPosition'];
|
|
29
30
|
padding?: TreemapOptions['labelPadding'];
|
|
30
31
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITextMarkSpec, IMarkSpec, ISeriesSpec } from '../../typings';
|
|
1
|
+
import type { ITextMarkSpec, IMarkSpec, ISeriesSpec, ITextFormatMethod } from '../../typings';
|
|
2
2
|
import type { IAnimationSpec, IMarkAnimateSpec, IStateAnimateSpec } from '../../animation/spec';
|
|
3
3
|
import type { SeriesMarkNameEnum } from '../interface/type';
|
|
4
4
|
import type { WordcloudAppearPreset } from './animation';
|
|
@@ -71,7 +71,7 @@ export interface IWordCloudSeriesBaseSpec extends ISeriesSpec, IAnimationSpec<st
|
|
|
71
71
|
wordCloudShapeConfig?: WordCloudShapeConfigType;
|
|
72
72
|
[SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
|
|
73
73
|
padding?: number;
|
|
74
|
-
formatMethod?:
|
|
74
|
+
formatMethod?: ITextFormatMethod<[datum?: any]>;
|
|
75
75
|
};
|
|
76
76
|
[SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
|
|
77
77
|
padding?: number;
|
|
@@ -87,11 +87,9 @@ export interface IWordCloudSeriesSpec extends IWordCloudSeriesBaseSpec {
|
|
|
87
87
|
export interface IWordCloudSeriesTheme {
|
|
88
88
|
[SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
|
|
89
89
|
padding?: number;
|
|
90
|
-
formatMethod?: (datum?: any) => string;
|
|
91
90
|
};
|
|
92
91
|
[SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
|
|
93
92
|
padding?: number;
|
|
94
|
-
formatMethod?: (datum?: any) => string;
|
|
95
93
|
};
|
|
96
94
|
}
|
|
97
95
|
export interface IWordCloud3dSeriesSpec extends IWordCloudSeriesBaseSpec {
|
|
@@ -102,10 +100,8 @@ export interface IWordCloud3dSeriesSpec extends IWordCloudSeriesBaseSpec {
|
|
|
102
100
|
export interface IWordCloud3dSeriesTheme {
|
|
103
101
|
[SeriesMarkNameEnum.word]?: IMarkSpec<ITextMarkSpec> & {
|
|
104
102
|
padding?: number;
|
|
105
|
-
formatMethod?: (text: string | string[], datum?: any) => string | string[];
|
|
106
103
|
};
|
|
107
104
|
[SeriesMarkNameEnum.fillingWord]?: IMarkSpec<ITextMarkSpec> & {
|
|
108
105
|
padding?: number;
|
|
109
|
-
formatMethod?: (text: string | string[], datum?: any) => string | string[];
|
|
110
106
|
};
|
|
111
107
|
}
|
|
@@ -14,7 +14,7 @@ import type { Datum, StringOrNumber } from '../common';
|
|
|
14
14
|
import type { IInvalidType } from '../data';
|
|
15
15
|
import type { IMorphSeriesSpec } from '../../animation/spec';
|
|
16
16
|
import type { IPlayer } from '../../component/player';
|
|
17
|
-
import
|
|
17
|
+
import { IMarkProgressiveConfig, MarkTypeEnum } from '../../mark/interface';
|
|
18
18
|
import type { IDataZoomSpec, IScrollBarSpec } from '../../component/data-zoom';
|
|
19
19
|
import type { ICrosshairSpec } from '../../component/crosshair/interface';
|
|
20
20
|
import type { ITheme } from '../../theme';
|
|
@@ -23,9 +23,9 @@ import type { IBrushSpec } from '../../component/brush';
|
|
|
23
23
|
import type { ITotalLabelSpec } from '../../component/label';
|
|
24
24
|
import type { ILegendSpec } from '../../component/legend';
|
|
25
25
|
import type { ILayoutOrientPadding, ILayoutPaddingSpec } from '../layout';
|
|
26
|
-
import type { ICustomPath2D } from '@visactor/vrender-core';
|
|
26
|
+
import type { ICustomPath2D, IRichTextCharacter } from '@visactor/vrender-core';
|
|
27
27
|
import type { ICommonAxisSpec } from '../../component/axis';
|
|
28
|
-
import type { IMediaQuerySpec } from '..';
|
|
28
|
+
import type { IComposedTextMarkSpec, IMediaQuerySpec } from '..';
|
|
29
29
|
export type IChartPadding = ILayoutOrientPadding | number;
|
|
30
30
|
export interface IInitOption extends Omit<IRenderOption, 'pluginList'> {
|
|
31
31
|
dom?: string | HTMLElement;
|
|
@@ -235,12 +235,12 @@ export interface IPerformanceHook {
|
|
|
235
235
|
beforeVRenderDraw?: () => void;
|
|
236
236
|
afterVRenderDraw?: () => void;
|
|
237
237
|
}
|
|
238
|
-
export type
|
|
238
|
+
export type IBuiltInMarkSpec = {
|
|
239
239
|
[MarkTypeEnum.group]: IGroupMarkSpec;
|
|
240
240
|
[MarkTypeEnum.symbol]: ISymbolMarkSpec;
|
|
241
241
|
[MarkTypeEnum.rule]: IRuleMarkSpec;
|
|
242
242
|
[MarkTypeEnum.line]: ILineMarkSpec;
|
|
243
|
-
[MarkTypeEnum.text]:
|
|
243
|
+
[MarkTypeEnum.text]: IComposedTextMarkSpec;
|
|
244
244
|
[MarkTypeEnum.rect]: IRectMarkSpec;
|
|
245
245
|
[MarkTypeEnum.rect3d]: IRect3dMarkSpec;
|
|
246
246
|
[MarkTypeEnum.image]: IImageMarkSpec;
|
|
@@ -255,8 +255,8 @@ export type IBuildinMarkSpec = {
|
|
|
255
255
|
[MarkTypeEnum.progressArc]: IProgressArcMarkSpec;
|
|
256
256
|
[MarkTypeEnum.ripple]: IRippleMarkSpec;
|
|
257
257
|
};
|
|
258
|
-
export type EnableMarkType = keyof
|
|
259
|
-
export interface ICustomMarkSpec<T extends EnableMarkType> extends IMarkSpec<
|
|
258
|
+
export type EnableMarkType = keyof IBuiltInMarkSpec;
|
|
259
|
+
export interface ICustomMarkSpec<T extends EnableMarkType> extends IMarkSpec<IBuiltInMarkSpec[T]> {
|
|
260
260
|
type: T;
|
|
261
261
|
dataIndex?: number;
|
|
262
262
|
dataId?: StringOrNumber;
|
|
@@ -273,3 +273,12 @@ export interface IExtensionMarkSpec<T extends Exclude<EnableMarkType, MarkTypeEn
|
|
|
273
273
|
export interface IExtensionGroupMarkSpec extends ICustomMarkSpec<MarkTypeEnum.group> {
|
|
274
274
|
children?: ICustomMarkSpec<EnableMarkType>[];
|
|
275
275
|
}
|
|
276
|
+
export type ITextFormatMethod<T extends any[]> = (...args: T) => ITextMarkSpec['text'] | {
|
|
277
|
+
type: 'text';
|
|
278
|
+
text: ITextMarkSpec['text'];
|
|
279
|
+
};
|
|
280
|
+
export type IRichTextFormatMethod<T extends any[]> = (...args: T) => {
|
|
281
|
+
type: 'rich';
|
|
282
|
+
text: IRichTextCharacter[];
|
|
283
|
+
} | IRichTextCharacter[];
|
|
284
|
+
export type IFormatMethod<T extends any[]> = (...args: T) => ReturnType<ITextFormatMethod<T>> | ReturnType<IRichTextFormatMethod<T>>;
|
|
@@ -6,10 +6,10 @@ import type { ScaleType } from './scale';
|
|
|
6
6
|
import type { ShapeType } from './shape';
|
|
7
7
|
import type { IPoint } from './coordinate';
|
|
8
8
|
import type { IAttributeOpt, IModelMarkAttributeContext } from '../compile/mark';
|
|
9
|
-
import type { Datum
|
|
9
|
+
import type { Datum } from './common';
|
|
10
10
|
import type { IPadding } from '@visactor/vutils';
|
|
11
11
|
import type { IColorKey } from '../theme/color-scheme/interface';
|
|
12
|
-
import type { IRepeatType, TextAlignType, TextBaselineType,
|
|
12
|
+
import type { IRepeatType, TextAlignType, TextBaselineType, IRichTextAttribute, IGraphicStyle } from '@visactor/vrender-core';
|
|
13
13
|
export interface IVisualSpecBase<D, T> {
|
|
14
14
|
type: ScaleType;
|
|
15
15
|
domain: D[];
|
|
@@ -80,6 +80,7 @@ export interface ICommonSpec {
|
|
|
80
80
|
texturePadding?: number;
|
|
81
81
|
outerBorder?: IBorder;
|
|
82
82
|
innerBorder?: IBorder;
|
|
83
|
+
html?: IMarkHtmlSpec;
|
|
83
84
|
[key: string]: any;
|
|
84
85
|
}
|
|
85
86
|
export interface IFillMarkSpec extends ICommonSpec {
|
|
@@ -87,6 +88,7 @@ export interface IFillMarkSpec extends ICommonSpec {
|
|
|
87
88
|
fillOpacity?: number;
|
|
88
89
|
background?: string | HTMLImageElement | HTMLCanvasElement | null;
|
|
89
90
|
}
|
|
91
|
+
export type IMarkHtmlSpec = Partial<IGraphicStyle['html']>;
|
|
90
92
|
export interface ISymbolMarkSpec extends IFillMarkSpec {
|
|
91
93
|
dx?: number;
|
|
92
94
|
dy?: number;
|
|
@@ -116,8 +118,7 @@ export interface IRuleMarkSpec extends ILineMarkSpec {
|
|
|
116
118
|
y1?: number;
|
|
117
119
|
}
|
|
118
120
|
export interface ITextMarkSpec extends IFillMarkSpec {
|
|
119
|
-
|
|
120
|
-
text?: StringOrNumber | string[] | IRichTextCharacter[] | Function;
|
|
121
|
+
text?: string | number | string[] | number[];
|
|
121
122
|
dx?: number;
|
|
122
123
|
dy?: number;
|
|
123
124
|
fontSize?: number;
|
|
@@ -129,13 +130,17 @@ export interface ITextMarkSpec extends IFillMarkSpec {
|
|
|
129
130
|
maxLineWidth?: number;
|
|
130
131
|
ellipsis?: string;
|
|
131
132
|
suffixPosition?: 'start' | 'end' | 'middle';
|
|
132
|
-
lineBreak?: string;
|
|
133
133
|
underline?: boolean;
|
|
134
134
|
lineThrough?: boolean;
|
|
135
135
|
lineHeight?: number | string;
|
|
136
136
|
poptip?: PopTipAttributes;
|
|
137
137
|
direction?: 'horizontal' | 'vertical';
|
|
138
138
|
}
|
|
139
|
+
export type IRichTextMarkSpec = IRichTextAttribute & IFillMarkSpec & {
|
|
140
|
+
type: 'rich';
|
|
141
|
+
text: IRichTextAttribute['textConfig'];
|
|
142
|
+
};
|
|
143
|
+
export type IComposedTextMarkSpec = ITextMarkSpec | IRichTextMarkSpec;
|
|
139
144
|
export type IPositionedTextMarkSpec = Omit<ITextMarkSpec, 'align' | 'textAlign' | 'baseline' | 'textBaseline'>;
|
|
140
145
|
export interface IRectMarkSpec extends IFillMarkSpec {
|
|
141
146
|
cornerRadius?: number | number[];
|