@visactor/vchart-types 1.12.15 → 1.13.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 +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/types/chart/base/base-chart.d.ts +1 -0
- package/types/chart/index.d.ts +5 -3
- package/types/chart/interface/chart.d.ts +1 -0
- package/types/chart/interface/type.d.ts +2 -1
- package/types/chart/pictogram/index.d.ts +3 -0
- package/types/chart/pictogram/interface.d.ts +6 -0
- package/types/chart/pictogram/pictogram-transformer.d.ts +8 -0
- package/types/chart/pictogram/pictogram.d.ts +12 -0
- package/types/component/tooltip/interface/theme.d.ts +2 -2
- package/types/core/vchart.d.ts +4 -1
- package/types/data/transforms/pictogram.d.ts +84 -0
- package/types/mark/group.d.ts +3 -2
- package/types/mark/interface/type.d.ts +2 -1
- package/types/plugin/components/tooltip-handler/base.d.ts +4 -6
- package/types/plugin/components/tooltip-handler/canvas-tooltip-handler.d.ts +26 -0
- package/types/plugin/components/tooltip-handler/constants.d.ts +7 -8
- package/types/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +42 -0
- package/types/plugin/components/tooltip-handler/index.d.ts +2 -2
- package/types/plugin/components/tooltip-handler/interface/index.d.ts +15 -2
- package/types/plugin/components/tooltip-handler/utils/attribute.d.ts +9 -2
- package/types/plugin/components/tooltip-handler/utils/common.d.ts +1 -12
- package/types/plugin/components/tooltip-handler/utils/style.d.ts +18 -0
- package/types/plugin/components/tooltip-handler/utils/svg.d.ts +2 -0
- package/types/series/base/base-series.d.ts +22 -6
- package/types/series/interface/type.d.ts +4 -2
- package/types/series/pictogram/constant.d.ts +2 -0
- package/types/series/pictogram/interface.d.ts +15 -0
- package/types/series/pictogram/pictogram-transformer.d.ts +5 -0
- package/types/series/pictogram/pictogram.d.ts +77 -0
- package/types/series/pictogram/svg-source.d.ts +7 -0
- package/types/series/pictogram/tooltip-helper.d.ts +9 -0
- package/types/series/sankey/interface.d.ts +1 -0
- package/types/typings/spec/common.d.ts +1 -0
- package/types/typings/tooltip/common.d.ts +3 -1
|
@@ -99,6 +99,7 @@ export declare class BaseChart<T extends IChartSpec> extends CompilableBase impl
|
|
|
99
99
|
getModelByUserId(userId: StringOrNumber): IModel | undefined;
|
|
100
100
|
getAllMarks(): IMark[];
|
|
101
101
|
getMarkById(id: number): IMark | undefined;
|
|
102
|
+
getMarkByUserName(name: string): IMark[];
|
|
102
103
|
updateData(id: StringOrNumber, data: unknown, updateGlobalScale?: boolean, options?: IParserOptions): void;
|
|
103
104
|
updateFullData(data: IDataValues | IDataValues[], updateGlobalScale?: boolean): void;
|
|
104
105
|
onRender(option: IChartRenderOption): void;
|
package/types/chart/index.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ import type { IVennChartSpec } from './venn';
|
|
|
59
59
|
import { VennChart, registerVennChart } from './venn';
|
|
60
60
|
import type { IMosaicChartSpec } from './mosaic';
|
|
61
61
|
import { MosaicChart, registerMosaicChart } from './mosaic';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export
|
|
62
|
+
import { IPictogramChartSpec } from './pictogram/interface';
|
|
63
|
+
import { PictogramChart, registerPictogramChart } from './pictogram/pictogram';
|
|
64
|
+
export { AreaChart, BarChart, Bar3dChart, BoxPlotChart, CirclePackingChart, CommonChart, FunnelChart, Funnel3dChart, GaugeChart, HeatmapChart, HistogramChart, Histogram3dChart, LineChart, MapChart, PieChart, Pie3dChart, CircularProgressChart, LinearProgressChart, RadarChart, RangeColumnChart, RangeColumn3dChart, RangeAreaChart, RoseChart, SankeyChart, ScatterChart, SunburstChart, SequenceChart, WaterfallChart, CorrelationChart, LiquidChart, WordCloudChart, WordCloud3dChart, TreemapChart, VennChart, BaseChart, MosaicChart, PictogramChart };
|
|
65
|
+
export { registerLineChart, registerAreaChart, registerBarChart, registerBar3dChart, registerBoxplotChart, registerCirclePackingChart, registerCircularProgressChart, registerCommonChart, registerFunnelChart, registerFunnel3dChart, registerGaugeChart, registerHeatmapChart, registerHistogramChart, registerHistogram3dChart, registerLinearProgressChart, registerMapChart, registerPie3dChart, registerPieChart, registerRadarChart, registerRangeAreaChart, registerRangeColumn3dChart, registerRangeColumnChart, registerRoseChart, registerSankeyChart, registerScatterChart, registerSequenceChart, registerSunburstChart, registerTreemapChart, registerWaterfallChart, registerWordCloud3dChart, registerWordCloudChart, registerCorrelationChart, registerLiquidChart, registerWordCloudShapeChart, registerVennChart, registerMosaicChart, registerPictogramChart };
|
|
66
|
+
export type { IAreaChartSpec, IBarChartSpec, IBar3dChartSpec, IBoxPlotChartSpec, ICirclePackingChartSpec, ICommonChartSpec, IFunnelChartSpec, IFunnel3dChartSpec, IGaugeChartSpec, IHeatmapChartSpec, IHistogramChartSpec, IHistogram3dChartSpec, ILineChartSpec, IMapChartSpec, IPieChartSpec, IPie3dChartSpec, ICircularProgressChartSpec, ILinearProgressChartSpec, IRadarChartSpec, IRangeColumnChartSpec, IRangeColumn3dChartSpec, IRangeAreaChartSpec, IRoseChartSpec, IScatterChartSpec, ISankeyChartSpec, ISequenceChartSpec, ISunburstChartSpec, ITreemapChartSpec, IWaterfallChartSpec, ICorrelationChartSpec, ILiquidChartSpec, IWordCloud3dChartSpec, IWordCloudChartSpec, IPolarChartSpec, ICartesianChartSpec, IVennChartSpec, IMosaicChartSpec, IPictogramChartSpec };
|
|
@@ -79,6 +79,7 @@ export interface IChart extends ICompilable {
|
|
|
79
79
|
getAllModels: () => IModel[];
|
|
80
80
|
getMarkById: (id: number) => IMark | undefined;
|
|
81
81
|
getAllMarks: () => IMark[];
|
|
82
|
+
getMarkByUserName: (name: string) => IMark[];
|
|
82
83
|
updateSpec: (spec: any) => IUpdateSpecResult;
|
|
83
84
|
updateState: (state: Record<string, Omit<IMarkStateSpec<unknown>, 'style'>>, filter?: (series: ISeries, mark: IMark, stateKey: string) => boolean) => void;
|
|
84
85
|
setSelected: (datum: MaybeArray<any> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IPictogramSeriesSpec } from '../../series/pictogram/interface';
|
|
2
|
+
import type { IChartExtendsSeriesSpec, IChartSpec } from '../../typings/spec/common';
|
|
3
|
+
export interface IPictogramChartSpec extends IChartSpec, IChartExtendsSeriesSpec<any> {
|
|
4
|
+
type: 'pictogram';
|
|
5
|
+
series?: IPictogramSeriesSpec[];
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPictogramSeriesSpec } from '../../series/pictogram/interface';
|
|
2
|
+
import { BaseChartSpecTransformer } from '../base';
|
|
3
|
+
import type { IPictogramChartSpec } from './interface';
|
|
4
|
+
export declare class PictogramChartSpecTransformer<T extends IPictogramChartSpec = IPictogramChartSpec> extends BaseChartSpecTransformer<T> {
|
|
5
|
+
protected _isValidSeries(type: string): boolean;
|
|
6
|
+
protected _getDefaultSeriesSpec(spec: IPictogramChartSpec): IPictogramSeriesSpec;
|
|
7
|
+
transformSpec(spec: T): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseChart } from '../base/base-chart';
|
|
2
|
+
import type { IPictogramChartSpec } from './interface';
|
|
3
|
+
import { PictogramChartSpecTransformer } from './pictogram-transformer';
|
|
4
|
+
export declare class PictogramChart<T extends IPictogramChartSpec = IPictogramChartSpec> extends BaseChart<T> {
|
|
5
|
+
static readonly type: string;
|
|
6
|
+
static readonly seriesType: string;
|
|
7
|
+
static readonly transformerConstructor: typeof PictogramChartSpecTransformer;
|
|
8
|
+
readonly transformerConstructor: typeof PictogramChartSpecTransformer;
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly seriesType: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const registerPictogramChart: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ITextAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import type { ITooltipShapePattern, StringOrNumber, TextAlign, TextBaseLine } from '../../../typings';
|
|
2
|
+
import type { ILayoutNumber, ITooltipShapePattern, StringOrNumber, TextAlign, TextBaseLine } from '../../../typings';
|
|
3
3
|
import type { Padding } from '@visactor/vrender-components';
|
|
4
4
|
import type { ITokenKey } from '../../../theme/token';
|
|
5
5
|
export interface ITooltipTextTheme<ColorType = string> {
|
|
@@ -42,7 +42,7 @@ export interface ITooltipTheme<ColorType = string> {
|
|
|
42
42
|
keyLabel?: Omit<ITooltipTextTheme<ColorType>, 'autoWidth'>;
|
|
43
43
|
valueLabel?: ITooltipTextTheme<ColorType>;
|
|
44
44
|
spaceRow?: number;
|
|
45
|
-
maxContentHeight?:
|
|
45
|
+
maxContentHeight?: ILayoutNumber;
|
|
46
46
|
offset?: {
|
|
47
47
|
x?: number;
|
|
48
48
|
y?: number;
|
package/types/core/vchart.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ILayoutConstructor, LayoutCallBack } from '../layout/interface';
|
|
|
3
3
|
import type { IDataValues, IMarkStateSpec, IInitOption } from '../typings/spec/common';
|
|
4
4
|
import { RenderModeEnum } from '../typings/spec/common';
|
|
5
5
|
import type { ISeriesConstructor } from '../series/interface';
|
|
6
|
-
import type
|
|
6
|
+
import { type DimensionIndexOption, type IChart, type IChartConstructor, type IChartOption, type IChartSpecInfo } from '../chart/interface';
|
|
7
7
|
import type { IComponentConstructor } from '../component/interface';
|
|
8
8
|
import type { EventCallback, EventParams, EventQuery, EventType } from '../event/interface';
|
|
9
9
|
import type { IParserOptions, Transform } from '@visactor/vdataset';
|
|
@@ -38,6 +38,9 @@ export declare class VChart implements IVChart {
|
|
|
38
38
|
static registerMap(key: string, source: GeoSourceType, option?: GeoSourceOption): void;
|
|
39
39
|
static unregisterMap(key: string): void;
|
|
40
40
|
static getMap(key: string): GeoSourceType;
|
|
41
|
+
static registerSVG(key: string, source: GeoSourceType, option?: GeoSourceOption): void;
|
|
42
|
+
static unregisterSVG(key: string): void;
|
|
43
|
+
static getSVG(key: string): any;
|
|
41
44
|
static hideTooltip(excludeId?: MaybeArray<number>): void;
|
|
42
45
|
static getLogger(): ILogger;
|
|
43
46
|
static readonly InstanceManager: typeof InstanceManager;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { DataView } from '@visactor/vdataset';
|
|
2
|
+
export declare const graphicAttributeTransform: {
|
|
3
|
+
group: (attributes: Record<string, any>) => {
|
|
4
|
+
visibleAll: boolean;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
fillStrokeOrder: boolean;
|
|
8
|
+
fill: any;
|
|
9
|
+
lineWidth: number;
|
|
10
|
+
stroke: any;
|
|
11
|
+
};
|
|
12
|
+
rule: (attributes: Record<string, any>) => {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
x1: number;
|
|
16
|
+
y1: number;
|
|
17
|
+
fillStrokeOrder: boolean;
|
|
18
|
+
fill: any;
|
|
19
|
+
lineWidth: number;
|
|
20
|
+
stroke: any;
|
|
21
|
+
};
|
|
22
|
+
rect: (attributes: Record<string, any>) => {
|
|
23
|
+
fill: any;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
fillStrokeOrder: boolean;
|
|
29
|
+
lineWidth: number;
|
|
30
|
+
stroke: any;
|
|
31
|
+
};
|
|
32
|
+
polygon: (attributes: Record<string, any>) => {
|
|
33
|
+
fill: any;
|
|
34
|
+
points: any;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
fillStrokeOrder: boolean;
|
|
38
|
+
lineWidth: number;
|
|
39
|
+
stroke: any;
|
|
40
|
+
};
|
|
41
|
+
line: (attributes: Record<string, any>) => {
|
|
42
|
+
points: any;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
fillStrokeOrder: boolean;
|
|
46
|
+
fill: any;
|
|
47
|
+
lineWidth: number;
|
|
48
|
+
stroke: any;
|
|
49
|
+
};
|
|
50
|
+
path: (attributes: Record<string, any>) => {
|
|
51
|
+
path: any;
|
|
52
|
+
fillStrokeOrder: boolean;
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
fill: any;
|
|
56
|
+
lineWidth: number;
|
|
57
|
+
stroke: any;
|
|
58
|
+
};
|
|
59
|
+
arc: (attributes: Record<string, any>) => {
|
|
60
|
+
outerRadius: any;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
startAngle: number;
|
|
64
|
+
endAngle: number;
|
|
65
|
+
scaleX: number;
|
|
66
|
+
fill: any;
|
|
67
|
+
fillStrokeOrder: boolean;
|
|
68
|
+
lineWidth: number;
|
|
69
|
+
stroke: any;
|
|
70
|
+
};
|
|
71
|
+
text: (attributes: Record<string, any>, value: string) => {
|
|
72
|
+
text: string;
|
|
73
|
+
textAlign: any;
|
|
74
|
+
textBaseLine: any;
|
|
75
|
+
anchor: number[];
|
|
76
|
+
fill: any;
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
fillStrokeOrder: boolean;
|
|
80
|
+
lineWidth: number;
|
|
81
|
+
stroke: any;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export declare const pictogram: (data: DataView[]) => {};
|
package/types/mark/group.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface IGroupMark extends IMarkRaw<IGroupMarkSpec> {
|
|
|
11
11
|
getMarks: () => IMark[];
|
|
12
12
|
getMarkInType: (type: MarkType) => IMark[];
|
|
13
13
|
getMarkInId: (id: number) => IMark | undefined;
|
|
14
|
-
getMarkInName: (name: string) => IMark
|
|
14
|
+
getMarkInName: (name: string) => IMark[];
|
|
15
15
|
}
|
|
16
16
|
export declare class GroupMark extends BaseMark<IGroupMarkSpec> implements IGroupMark {
|
|
17
17
|
static readonly type = MarkTypeEnum.group;
|
|
@@ -26,7 +26,8 @@ export declare class GroupMark extends BaseMark<IGroupMarkSpec> implements IGrou
|
|
|
26
26
|
removeMark(mark: IMark): boolean;
|
|
27
27
|
getMarkInType(type: MarkType): IMark[];
|
|
28
28
|
getMarkInId(id: number): IMark;
|
|
29
|
-
|
|
29
|
+
getMarkInUserId(id: string | number): IMark;
|
|
30
|
+
getMarkInName(name: string): IMark[];
|
|
30
31
|
protected _compileProduct(option?: IMarkCompileOption): void;
|
|
31
32
|
}
|
|
32
33
|
export declare const registerGroupMark: () => void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Options } from './constants';
|
|
2
1
|
import type { Maybe, RenderMode } from '../../../typings';
|
|
3
2
|
import type { TooltipData, ITooltipActual, TooltipActiveType, ITooltipHandler, ITooltipPositionActual } from '../../../typings/tooltip';
|
|
4
3
|
import type { IGroup } from '@visactor/vrender-core';
|
|
@@ -9,7 +8,7 @@ import type { ITooltipSpec, Tooltip, TooltipHandlerParams } from '../../../compo
|
|
|
9
8
|
import { TooltipResult } from '../../../component/tooltip';
|
|
10
9
|
import type { IComponentPlugin, IComponentPluginService } from '../interface';
|
|
11
10
|
import { BasePlugin } from '../../base/base-plugin';
|
|
12
|
-
import type {
|
|
11
|
+
import type { ITooltipHandlerOptions } from './interface';
|
|
13
12
|
type ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => TooltipResult;
|
|
14
13
|
type ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => TooltipResult;
|
|
15
14
|
export declare abstract class BaseTooltipHandler extends BasePlugin implements ITooltipHandler, IComponentPlugin {
|
|
@@ -17,12 +16,11 @@ export declare abstract class BaseTooltipHandler extends BasePlugin implements I
|
|
|
17
16
|
static readonly specKey = "tooltip";
|
|
18
17
|
readonly type: string;
|
|
19
18
|
protected _visible: boolean;
|
|
20
|
-
protected _option:
|
|
19
|
+
protected _option: ITooltipHandlerOptions;
|
|
21
20
|
protected _chartOption: IChartOption;
|
|
22
21
|
protected _env: RenderMode;
|
|
23
22
|
get env(): "desktop-browser" | "mobile-browser" | "node" | "worker" | "miniApp" | "wx" | "tt" | "harmony" | "desktop-miniApp" | "lynx";
|
|
24
23
|
protected _component: Tooltip;
|
|
25
|
-
protected _attributes?: ITooltipAttributes | null;
|
|
26
24
|
protected _chartContainer: Maybe<HTMLElement>;
|
|
27
25
|
protected _compiler: Compiler;
|
|
28
26
|
protected _container: Maybe<IGroup | HTMLElement>;
|
|
@@ -35,9 +33,9 @@ export declare abstract class BaseTooltipHandler extends BasePlugin implements I
|
|
|
35
33
|
release(): void;
|
|
36
34
|
protected abstract _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
|
|
37
35
|
protected abstract _removeTooltip(): void;
|
|
38
|
-
protected
|
|
36
|
+
protected abstract _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
|
|
37
|
+
protected _getDefaultOption(): ITooltipHandlerOptions;
|
|
39
38
|
protected _getActualTooltipPosition: (actualTooltip: ITooltipActual, params: TooltipHandlerParams, tooltipBoxSize: IContainerSize | undefined) => ITooltipPositionActual;
|
|
40
|
-
protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
|
|
41
39
|
protected _getParentElement(spec: ITooltipSpec): HTMLElement;
|
|
42
40
|
getTooltipContainer(): HTMLElement | IGroup;
|
|
43
41
|
protected _initFromSpec(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseTooltipHandler } from './base';
|
|
2
|
+
import { Tooltip as TooltipComponent } from '@visactor/vrender-components';
|
|
3
|
+
import type { TooltipHandlerParams } from '../../../component/tooltip';
|
|
4
|
+
import type { IComponentPluginService } from '../interface';
|
|
5
|
+
import type { ITooltipActual } from '../../../typings';
|
|
6
|
+
import type { IContainerSize } from '@visactor/vrender-components';
|
|
7
|
+
import type { ITooltipAttributes } from './interface';
|
|
8
|
+
export declare class CanvasTooltipHandler extends BaseTooltipHandler {
|
|
9
|
+
static readonly type: string;
|
|
10
|
+
readonly type: string;
|
|
11
|
+
private _layer;
|
|
12
|
+
protected _el?: HTMLCanvasElement;
|
|
13
|
+
protected _tooltipCanvasId?: string;
|
|
14
|
+
protected _tooltipComponent: TooltipComponent;
|
|
15
|
+
protected _attributes?: ITooltipAttributes | null;
|
|
16
|
+
constructor();
|
|
17
|
+
onAdd(service: IComponentPluginService<any>): void;
|
|
18
|
+
private _initTooltipComponent;
|
|
19
|
+
private _getLayer;
|
|
20
|
+
protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
|
|
21
|
+
protected _removeTooltip(): void;
|
|
22
|
+
protected _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
|
|
23
|
+
isTooltipShown(): boolean;
|
|
24
|
+
release(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare const registerCanvasTooltipHandler: () => void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { ITooltipHandlerOptions } from './interface';
|
|
2
|
+
export declare const TOOLTIP_PREFIX = "vchart-tooltip";
|
|
3
|
+
export declare const TOOLTIP_CONTAINER_EL_CLASS_NAME: string;
|
|
4
|
+
export declare const TOOLTIP_TITLE_CLASS_NAME: string;
|
|
5
|
+
export declare const TOOLTIP_CONTENT_BOX_CLASS_NAME: string;
|
|
3
6
|
export declare const TOOLTIP_EMPTY_STRING = "";
|
|
4
|
-
export declare const DEFAULT_OPTIONS:
|
|
5
|
-
|
|
6
|
-
offsetY: number;
|
|
7
|
-
sanitize: typeof escapeHTML;
|
|
8
|
-
};
|
|
9
|
-
export type Options = typeof DEFAULT_OPTIONS;
|
|
7
|
+
export declare const DEFAULT_OPTIONS: ITooltipHandlerOptions;
|
|
8
|
+
export declare const DEFAULT_TOOLTIP_Z_INDEX = "99999999999999";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';
|
|
2
|
+
import { BaseTooltipHandler } from './base';
|
|
3
|
+
import { type Maybe } from '@visactor/vutils';
|
|
4
|
+
import type { IContainerSize } from '@visactor/vrender-components';
|
|
5
|
+
import type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';
|
|
6
|
+
import type { IComponentPluginService } from '../interface';
|
|
7
|
+
import type { ILayoutPoint } from '../../../typings';
|
|
8
|
+
export declare class DomTooltipHandler extends BaseTooltipHandler {
|
|
9
|
+
static readonly type: string;
|
|
10
|
+
readonly type: string;
|
|
11
|
+
protected _tooltipContainer: HTMLElement;
|
|
12
|
+
protected _domStyle: {
|
|
13
|
+
panelPadding?: number[];
|
|
14
|
+
panel: Partial<CSSStyleDeclaration>;
|
|
15
|
+
row: Partial<CSSStyleDeclaration>;
|
|
16
|
+
title: Partial<CSSStyleDeclaration>;
|
|
17
|
+
shape: Partial<CSSStyleDeclaration>;
|
|
18
|
+
key: Partial<CSSStyleDeclaration>;
|
|
19
|
+
value: Partial<CSSStyleDeclaration>;
|
|
20
|
+
};
|
|
21
|
+
protected _rootDom?: HTMLElement;
|
|
22
|
+
protected _tooltipActual?: ITooltipActual;
|
|
23
|
+
protected _container: Maybe<HTMLDivElement>;
|
|
24
|
+
protected _domString?: string;
|
|
25
|
+
protected _cacheCustomTooltipPosition: ILayoutPoint;
|
|
26
|
+
getVisibility(): boolean;
|
|
27
|
+
setVisibility(_value: boolean): void;
|
|
28
|
+
constructor();
|
|
29
|
+
onAdd(service: IComponentPluginService<any>): void;
|
|
30
|
+
initEl(): void;
|
|
31
|
+
protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
|
|
32
|
+
protected _removeTooltip(): void;
|
|
33
|
+
protected _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
|
|
34
|
+
protected _initStyle(): void;
|
|
35
|
+
protected _updateDomStringByCol(actualTooltip?: ITooltipActual): void;
|
|
36
|
+
protected _updateDomStyle(sizeKey?: 'width' | 'height'): void;
|
|
37
|
+
protected _getParentElement(spec: ITooltipSpec): HTMLElement;
|
|
38
|
+
isTooltipShown(): boolean;
|
|
39
|
+
reInit(): void;
|
|
40
|
+
protected _updatePosition({ x, y }: ITooltipPositionActual): void;
|
|
41
|
+
}
|
|
42
|
+
export declare const registerDomTooltipHandler: () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './dom';
|
|
2
|
-
export * from './canvas';
|
|
1
|
+
export * from './dom-tooltip-handler';
|
|
2
|
+
export * from './canvas-tooltip-handler';
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { TooltipAttributes } from '@visactor/vrender-components';
|
|
2
|
+
import type { ITextAttribute, IFillStyle } from '@visactor/vrender-core';
|
|
3
|
+
export interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {
|
|
4
|
+
spacing?: number;
|
|
5
|
+
multiLine?: boolean;
|
|
6
|
+
maxWidth?: number;
|
|
7
|
+
autoWidth?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ITooltipAttributes extends TooltipAttributes {
|
|
10
|
+
align?: 'left' | 'right';
|
|
11
|
+
}
|
|
12
|
+
export interface ITooltipHandlerOptions {
|
|
13
|
+
offsetX?: number;
|
|
14
|
+
offsetY?: number;
|
|
15
|
+
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import type { TooltipPanelAttrs } from '@visactor/vrender-components';
|
|
2
|
-
import type { ITooltipActual } from '../../../../typings';
|
|
1
|
+
import type { TooltipPanelAttrs, TooltipRichTextAttrs } from '@visactor/vrender-components';
|
|
2
|
+
import type { ITooltipActual, MaybeArray } from '../../../../typings';
|
|
3
3
|
import type { ITooltipAttributes, ITooltipTextStyle } from '../interface';
|
|
4
4
|
import type { ITheme } from '../../../../theme';
|
|
5
5
|
import type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';
|
|
6
|
+
interface ITooltipTextInfo {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;
|
|
10
|
+
}
|
|
11
|
+
export declare const measureTooltipText: (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle) => ITooltipTextInfo;
|
|
6
12
|
export declare function getTextAttributes(style?: ITooltipTextTheme, globalTheme?: ITheme, defaultAttributes?: Partial<ITooltipTextStyle>): ITooltipTextStyle;
|
|
7
13
|
export declare const getPanelAttributes: (style: ITooltipTheme['panel']) => TooltipPanelAttrs;
|
|
8
14
|
export declare const getTooltipAttributes: (actualTooltip: ITooltipActual, spec: ITooltipSpec, globalTheme: ITheme) => ITooltipAttributes;
|
|
15
|
+
export {};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import type { MaybeArray } from '../../../../typings';
|
|
2
|
-
import type { ITooltipTextStyle } from '../interface/style';
|
|
3
|
-
import type { TooltipRichTextAttrs } from '@visactor/vrender-components';
|
|
4
1
|
export declare function escapeHTML(value: any): string;
|
|
5
|
-
export declare function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined;
|
|
6
|
-
export declare function convertToColorString(color: any, defaultColor?: string): string;
|
|
7
2
|
export declare const getScale: (element: HTMLElement, boundingClientRect?: DOMRect) => number;
|
|
8
|
-
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;
|
|
12
|
-
}
|
|
13
|
-
export declare const measureTooltipText: (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle) => ITooltipTextInfo;
|
|
14
|
-
export {};
|
|
3
|
+
export declare const formatContent: (content: any) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';
|
|
2
|
+
export declare const getPixelPropertyStr: (num?: number | number[], defaultStr?: string) => string;
|
|
3
|
+
export declare const getTextStyle: (style?: ITooltipTextTheme) => Partial<CSSStyleDeclaration>;
|
|
4
|
+
export declare const getDomStyle: (spec?: ITooltipSpec) => {
|
|
5
|
+
panelPadding: number[];
|
|
6
|
+
row: Partial<CSSStyleDeclaration>;
|
|
7
|
+
panel: Partial<CSSStyleDeclaration>;
|
|
8
|
+
title: Partial<CSSStyleDeclaration>;
|
|
9
|
+
shape: Partial<CSSStyleDeclaration>;
|
|
10
|
+
key: Partial<CSSStyleDeclaration>;
|
|
11
|
+
value: Partial<CSSStyleDeclaration>;
|
|
12
|
+
};
|
|
13
|
+
export declare const getPanelStyle: (style: ITooltipTheme['panel']) => {
|
|
14
|
+
panelStyle: Partial<CSSStyleDeclaration>;
|
|
15
|
+
panelPadding?: number[];
|
|
16
|
+
};
|
|
17
|
+
export declare function setStyleToDom(dom: HTMLElement, style: Partial<CSSStyleDeclaration>): void;
|
|
18
|
+
export declare function cssToStyleString(style: Partial<CSSStyleDeclaration>): string;
|
|
@@ -7,7 +7,7 @@ import { BaseModel } from '../../model/base-model';
|
|
|
7
7
|
import type { ISeriesOption, ISeries, ISeriesMarkInitOption, ISeriesStackData, ISeriesTooltipHelper, SeriesMarkMap, ISeriesMarkInfo, ISeriesSpecInfo, ISeriesStackDataLeaf, ISeriesStackDataMeta, ISeriesSeriesInfo } from '../interface';
|
|
8
8
|
import type { IModelEvaluateOption, IModelRenderOption, IUpdateSpecResult } from '../../model/interface';
|
|
9
9
|
import type { AddVChartPropertyContext } from '../../data/transforms/add-property';
|
|
10
|
-
import type { IBaseInteractionSpec } from '../../interaction/interface';
|
|
10
|
+
import type { IBaseInteractionSpec, IHoverSpec, ISelectSpec } from '../../interaction/interface';
|
|
11
11
|
import type { StatisticOperations } from '../../data/transforms/dimension-statistics';
|
|
12
12
|
import { SeriesData } from './series-data';
|
|
13
13
|
import type { IGroupMark } from '../../mark/group';
|
|
@@ -141,9 +141,6 @@ export declare abstract class BaseSeries<T extends ISeriesSpec> extends BaseMode
|
|
|
141
141
|
triggerOff: EventType;
|
|
142
142
|
blurState: STATE_VALUE_ENUM;
|
|
143
143
|
highlightState: STATE_VALUE_ENUM;
|
|
144
|
-
reverseState?: undefined;
|
|
145
|
-
state?: undefined;
|
|
146
|
-
isMultiple?: undefined;
|
|
147
144
|
} | {
|
|
148
145
|
type: string;
|
|
149
146
|
seriesId: number;
|
|
@@ -154,9 +151,28 @@ export declare abstract class BaseSeries<T extends ISeriesSpec> extends BaseMode
|
|
|
154
151
|
reverseState: STATE_VALUE_ENUM;
|
|
155
152
|
state: STATE_VALUE_ENUM;
|
|
156
153
|
isMultiple: boolean;
|
|
157
|
-
blurState?: undefined;
|
|
158
|
-
highlightState?: undefined;
|
|
159
154
|
})[];
|
|
155
|
+
protected _defaultHoverConfig(selector: string[], finalHoverSpec: IHoverSpec): {
|
|
156
|
+
seriesId: number;
|
|
157
|
+
regionId: number;
|
|
158
|
+
selector: string[];
|
|
159
|
+
type: string;
|
|
160
|
+
trigger: EventType;
|
|
161
|
+
triggerOff: EventType;
|
|
162
|
+
blurState: STATE_VALUE_ENUM;
|
|
163
|
+
highlightState: STATE_VALUE_ENUM;
|
|
164
|
+
};
|
|
165
|
+
protected _defaultSelectConfig(selector: string[], finalSelectSpec: ISelectSpec): {
|
|
166
|
+
type: string;
|
|
167
|
+
seriesId: number;
|
|
168
|
+
regionId: number;
|
|
169
|
+
selector: string[];
|
|
170
|
+
trigger: EventType;
|
|
171
|
+
triggerOff: EventType;
|
|
172
|
+
reverseState: STATE_VALUE_ENUM;
|
|
173
|
+
state: STATE_VALUE_ENUM;
|
|
174
|
+
isMultiple: boolean;
|
|
175
|
+
};
|
|
160
176
|
protected _parseInteractionConfig(mainMarks?: IMark[]): void;
|
|
161
177
|
initInteraction(): void;
|
|
162
178
|
initAnimation(): void;
|
|
@@ -34,7 +34,8 @@ export declare enum SeriesTypeEnum {
|
|
|
34
34
|
correlation = "correlation",
|
|
35
35
|
liquid = "liquid",
|
|
36
36
|
venn = "venn",
|
|
37
|
-
mosaic = "mosaic"
|
|
37
|
+
mosaic = "mosaic",
|
|
38
|
+
pictogram = "pictogram"
|
|
38
39
|
}
|
|
39
40
|
export declare const enum SeriesMarkNameEnum {
|
|
40
41
|
label = "label",
|
|
@@ -99,5 +100,6 @@ export declare const enum SeriesMarkNameEnum {
|
|
|
99
100
|
liquidOutline = "liquidOutline",
|
|
100
101
|
circle = "circle",
|
|
101
102
|
overlap = "overlap",
|
|
102
|
-
overlapLabel = "overlapLabel"
|
|
103
|
+
overlapLabel = "overlapLabel",
|
|
104
|
+
pictogram = "pictogram"
|
|
103
105
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IPathMarkSpec } from '../../typings/visual';
|
|
2
|
+
import type { IMarkSpec, IMarkTheme, ISeriesSpec } from '../../typings/spec/common';
|
|
3
|
+
import type { IAnimationSpec } from '../../animation/spec';
|
|
4
|
+
export interface IPictogramSeriesSpec extends ISeriesSpec, IAnimationSpec<'pictogram', 'fadeIn'> {
|
|
5
|
+
type: 'pictogram';
|
|
6
|
+
svg: string;
|
|
7
|
+
nameField?: string;
|
|
8
|
+
valueField?: string;
|
|
9
|
+
pictogram?: IMarkSpec<Omit<IPathMarkSpec, 'smoothScale'>>;
|
|
10
|
+
defaultFillColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IPictogramThemeSpec {
|
|
13
|
+
defaultFillColor?: string;
|
|
14
|
+
pictogram?: Partial<IMarkTheme<Omit<IPathMarkSpec, 'smoothScale'>>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ISeriesSpec } from '../../typings';
|
|
2
|
+
import { BaseSeriesSpecTransformer } from '../base';
|
|
3
|
+
export declare class PictogramSeriesSpecTransformer<T extends ISeriesSpec, K> extends BaseSeriesSpecTransformer<T, K> {
|
|
4
|
+
protected _getDefaultSpecFromChart(chartSpec: any): any;
|
|
5
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { SVGParsedElement, SVGParserResult } from '@visactor/vdataset';
|
|
2
|
+
import { PanEventParam, ZoomEventParam } from '../../core';
|
|
3
|
+
import { GeoSeries } from '../geo/geo';
|
|
4
|
+
import { ISeriesSeriesInfo, SeriesMarkMap, SeriesTypeEnum } from '../interface';
|
|
5
|
+
import type { IPictogramSeriesSpec } from './interface';
|
|
6
|
+
import { GroupMark } from '../../mark';
|
|
7
|
+
import { PictogramSeriesSpecTransformer } from './pictogram-transformer';
|
|
8
|
+
import { IMatrix } from '@visactor/vutils';
|
|
9
|
+
import type { Datum } from '../../typings';
|
|
10
|
+
import type { Group } from '@visactor/vrender-core';
|
|
11
|
+
import { IHoverSpec, ISelectSpec } from '../../interaction/interface';
|
|
12
|
+
import { STATE_VALUE_ENUM } from '../../compile/mark';
|
|
13
|
+
import { EventType } from '@visactor/vgrammar-core';
|
|
14
|
+
import { IMark } from '../../mark/interface';
|
|
15
|
+
import type { IPoint } from '../../typings/coordinate';
|
|
16
|
+
export interface SVGParsedElementExtend extends SVGParsedElement {
|
|
17
|
+
_finalAttributes: Record<string, any>;
|
|
18
|
+
_uniqueId: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class PictogramSeries<T extends IPictogramSeriesSpec = IPictogramSeriesSpec> extends GeoSeries<T> {
|
|
21
|
+
static readonly type: string;
|
|
22
|
+
type: SeriesTypeEnum;
|
|
23
|
+
static readonly mark: SeriesMarkMap;
|
|
24
|
+
static readonly transformerConstructor: typeof PictogramSeriesSpecTransformer;
|
|
25
|
+
svg: string;
|
|
26
|
+
protected _pictogramMark: GroupMark;
|
|
27
|
+
protected _parsedSvgResult: SVGParserResult;
|
|
28
|
+
private _labelMark;
|
|
29
|
+
setAttrFromSpec(): void;
|
|
30
|
+
getDatumCenter(datum: SVGParsedElementExtend): [number, number];
|
|
31
|
+
getDatumName(datum: SVGParsedElementExtend): string;
|
|
32
|
+
getMarksWithoutRoot(): IMark[];
|
|
33
|
+
protected _buildMarkAttributeContext(): void;
|
|
34
|
+
protected _defaultHoverConfig(selector: string[], finalHoverSpec: IHoverSpec): {
|
|
35
|
+
seriesId: number;
|
|
36
|
+
regionId: number;
|
|
37
|
+
selector: string[];
|
|
38
|
+
type: string;
|
|
39
|
+
trigger: EventType;
|
|
40
|
+
triggerOff: EventType;
|
|
41
|
+
blurState: STATE_VALUE_ENUM;
|
|
42
|
+
highlightState: STATE_VALUE_ENUM;
|
|
43
|
+
};
|
|
44
|
+
protected _defaultSelectConfig(selector: string[], finalSelectSpec: ISelectSpec): {
|
|
45
|
+
type: string;
|
|
46
|
+
seriesId: number;
|
|
47
|
+
regionId: number;
|
|
48
|
+
selector: string[];
|
|
49
|
+
trigger: EventType;
|
|
50
|
+
triggerOff: EventType;
|
|
51
|
+
reverseState: STATE_VALUE_ENUM;
|
|
52
|
+
state: STATE_VALUE_ENUM;
|
|
53
|
+
isMultiple: boolean;
|
|
54
|
+
};
|
|
55
|
+
initMark(): void;
|
|
56
|
+
private _initLabelMark;
|
|
57
|
+
initLabelMarkStyle(): void;
|
|
58
|
+
initMarkStyle(): void;
|
|
59
|
+
protected _validElement(element: SVGParsedElement): string;
|
|
60
|
+
protected initTooltip(): void;
|
|
61
|
+
dataToPosition(datum: Datum, global?: boolean): IPoint;
|
|
62
|
+
coordToPosition(point: IPoint): IPoint | undefined;
|
|
63
|
+
getRootMatrix(): IMatrix;
|
|
64
|
+
getPictogramRootGraphic(): Group;
|
|
65
|
+
initData(): void;
|
|
66
|
+
mapViewDataUpdate(): void;
|
|
67
|
+
onLayoutEnd(ctx: any): void;
|
|
68
|
+
updateSVGSize(): void;
|
|
69
|
+
protected initEvent(): void;
|
|
70
|
+
handleZoom(e: ZoomEventParam): void;
|
|
71
|
+
handlePan(e: PanEventParam): void;
|
|
72
|
+
getMarkData(datum: Datum): any;
|
|
73
|
+
getMeasureField(): string[];
|
|
74
|
+
getDimensionField(): string[];
|
|
75
|
+
protected _getSeriesInfo(field: string, keys: string[]): ISeriesSeriesInfo[];
|
|
76
|
+
}
|
|
77
|
+
export declare const registerPictogramSeries: () => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataView } from '@visactor/vdataset';
|
|
2
|
+
import type { ISVGSourceOption } from '@visactor/vdataset';
|
|
3
|
+
export declare const svgSourceMap: Map<string, DataView>;
|
|
4
|
+
export declare function registerSVGSource(key: string, source: ISVGSourceOption): void;
|
|
5
|
+
export declare function unregisterSVGSource(key: string): void;
|
|
6
|
+
export declare function getSVGSource(type: string): DataView;
|
|
7
|
+
export declare function clearSVGSource(): void;
|