@publishfx/publish-chart 2.0.3 → 2.1.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/adapters/DataAdapter.d.ts +7 -3
  3. package/dist/adapters/DataAdapter.js +61 -0
  4. package/dist/components/g2/base/G2BarChart.d.ts +4 -3
  5. package/dist/components/g2/base/G2BarChart.js +194 -53
  6. package/dist/components/g2/base/G2BarLegend.d.ts +17 -0
  7. package/dist/components/g2/base/G2BarLegend.js +196 -0
  8. package/dist/components/g2/base/G2CombineChart.d.ts +9 -0
  9. package/dist/components/g2/base/G2CombineChart.js +305 -0
  10. package/dist/components/g2/base/G2GroupBarChart.d.ts +9 -0
  11. package/dist/components/g2/base/G2GroupBarChart.js +227 -0
  12. package/dist/components/g2/base/G2IndicatorCardChart.d.ts +43 -0
  13. package/dist/components/g2/base/G2IndicatorCardChart.js +156 -0
  14. package/dist/components/g2/base/G2LineChart.d.ts +4 -3
  15. package/dist/components/g2/base/G2LineChart.js +207 -104
  16. package/dist/components/g2/base/G2PieChart.d.ts +9 -0
  17. package/dist/components/g2/base/G2PieChart.js +189 -0
  18. package/dist/components/g2/base/g2Helpers.d.ts +293 -0
  19. package/dist/components/g2/base/g2Helpers.js +167 -0
  20. package/dist/components/g2/base/g2bar.d.ts +64 -0
  21. package/dist/components/g2/base/g2bar.js +191 -0
  22. package/dist/components/g2/base/g2combine.d.ts +71 -0
  23. package/dist/components/g2/base/g2combine.js +322 -0
  24. package/dist/components/g2/base/g2groupbar.d.ts +69 -0
  25. package/dist/components/g2/base/g2groupbar.js +188 -0
  26. package/dist/components/g2/base/g2line.d.ts +77 -0
  27. package/dist/components/g2/base/g2line.js +208 -0
  28. package/dist/components/g2/shared/G2CompareTooltip.d.ts +23 -0
  29. package/dist/components/g2/shared/G2CompareTooltip.js +93 -0
  30. package/dist/components/g2/shared/useG2TooltipContainer.d.ts +1 -0
  31. package/dist/components/g2/shared/useG2TooltipContainer.js +16 -0
  32. package/dist/components/shared/NodeDetail.js +1 -1
  33. package/dist/components/shared/NodePopover.d.ts +1 -0
  34. package/dist/components/shared/NodePopover.js +3 -2
  35. package/dist/core/ChartTypes.d.ts +4 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +5 -1
  38. package/dist/utils/chartHelpers.d.ts +1 -1
  39. package/dist/utils/chartHelpers.js +2 -2
  40. package/package.json +15 -13
@@ -0,0 +1,189 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef } from "react";
3
+ import { Chart } from "@antv/g2";
4
+ import { useChartContext } from "../../../core/ChartContext.js";
5
+ import { DataAdapter } from "../../../adapters/DataAdapter.js";
6
+ const newThemeColors = [
7
+ '#5B8FF9',
8
+ '#5AD8A6',
9
+ '#5D7092',
10
+ '#F6BD16',
11
+ '#6F5EF9',
12
+ '#6DC8EC',
13
+ '#945FB9',
14
+ '#FF9845',
15
+ '#1E9493',
16
+ '#FF99C3',
17
+ '#8CD85A',
18
+ '#FE765E',
19
+ '#67A1FF',
20
+ '#D85ACB',
21
+ '#F95B8F'
22
+ ];
23
+ const G2PieChart = ({ height = 400, data, x = '', y = '', indicatorMap, onChartClick, config })=>{
24
+ const { formatter, dataTransform, config: contextConfig } = useChartContext();
25
+ const safeIndicatorMap = indicatorMap || contextConfig.indicatorMap || {};
26
+ const chartConfig = config || {};
27
+ const { innerRadius = 0.6, outerRadius = 0.7, minLabelPercentage = 3 } = chartConfig || {};
28
+ const transformedData = useMemo(()=>{
29
+ if (!data || 0 === data.length) return [];
30
+ const result = DataAdapter.transform(data, 'line', {
31
+ type: 'line',
32
+ x,
33
+ y
34
+ });
35
+ return result.map((item)=>dataTransform.processNodeInfo(item, contextConfig.nodeMap)).filter((item)=>{
36
+ const value = item[y];
37
+ return '-' !== value && null != value && !isNaN(Number(value));
38
+ });
39
+ }, [
40
+ data,
41
+ x,
42
+ y,
43
+ dataTransform,
44
+ contextConfig.nodeMap
45
+ ]);
46
+ const totalValue = useMemo(()=>transformedData.reduce((sum, item)=>{
47
+ const value = Number(item[y]) || 0;
48
+ return sum + value;
49
+ }, 0), [
50
+ transformedData,
51
+ y
52
+ ]);
53
+ const containerRef = useRef(null);
54
+ const chartRef = useRef(null);
55
+ const centerTextRef = useRef(null);
56
+ useEffect(()=>{
57
+ if (!containerRef.current || !transformedData.length) return;
58
+ if (chartRef.current) chartRef.current.destroy();
59
+ if (centerTextRef.current && centerTextRef.current.parentNode) centerTextRef.current.parentNode.removeChild(centerTextRef.current);
60
+ const chart = new Chart({
61
+ container: containerRef.current,
62
+ autoFit: true,
63
+ height: height
64
+ });
65
+ if (containerRef.current) containerRef.current.style.position = 'relative';
66
+ chart.data(transformedData);
67
+ chart.coordinate({
68
+ type: 'theta',
69
+ innerRadius: innerRadius,
70
+ outerRadius: outerRadius,
71
+ startAngle: -Math.PI / 2
72
+ });
73
+ chart.scale({
74
+ [y]: {
75
+ nice: true
76
+ },
77
+ [x]: {
78
+ type: 'cat'
79
+ }
80
+ });
81
+ chart.legend('color', {
82
+ position: 'bottom',
83
+ itemHeight: 14,
84
+ maxItemWidth: 1,
85
+ gridRow: 1
86
+ });
87
+ chart.interaction('poptip', true);
88
+ const interval = chart.interval().encode('y', y).encode('color', x).scale('color', {
89
+ type: 'ordinal',
90
+ range: newThemeColors
91
+ }).transform({
92
+ type: 'stackY'
93
+ });
94
+ const currentTotalValue = totalValue;
95
+ interval.label({
96
+ text: (d)=>{
97
+ const value = Number(d[y]) || 0;
98
+ const percentage = currentTotalValue > 0 ? value / currentTotalValue * 100 : 0;
99
+ const percentageStr = percentage.toFixed(2);
100
+ const indicatorInfo = safeIndicatorMap[y];
101
+ const formattedValue = formatter.formatIndicator(value, indicatorInfo);
102
+ const categoryName = safeIndicatorMap[d[x]]?.indicatorName || d[x] || '';
103
+ const maxCategoryLength = percentage >= 10 ? 20 : percentage >= 5 ? 15 : 12;
104
+ const truncatedCategory = categoryName.length > maxCategoryLength ? categoryName.substring(0, maxCategoryLength - 3) + '...' : categoryName;
105
+ return `${percentageStr}%(${formattedValue})\n${truncatedCategory}`;
106
+ },
107
+ position: 'spider',
108
+ offset: 20,
109
+ connector: true,
110
+ connectorDistance: 0,
111
+ labelHeight: 32,
112
+ connectorStroke: (_d, index)=>{
113
+ const color = newThemeColors[index];
114
+ return color;
115
+ },
116
+ fontSize: (d, _index)=>{
117
+ const value = Number(d[y]) || 0;
118
+ const percentage = currentTotalValue > 0 ? value / currentTotalValue * 100 : 0;
119
+ if (percentage >= 10) return 12;
120
+ return 12;
121
+ },
122
+ transform: [
123
+ {
124
+ type: 'dodgeY'
125
+ }
126
+ ]
127
+ });
128
+ chart.render();
129
+ const visibleTotalValue = transformedData.reduce((sum, item)=>{
130
+ const value = Number(item[y]) || 0;
131
+ return sum + value;
132
+ }, 0);
133
+ const indicatorInfo = safeIndicatorMap[y];
134
+ const formattedTotal = formatter.formatIndicator(visibleTotalValue, indicatorInfo);
135
+ const centerTextContainer = document.createElement('div');
136
+ centerTextContainer.style.position = 'absolute';
137
+ centerTextContainer.style.left = '50%';
138
+ centerTextContainer.style.top = '50%';
139
+ centerTextContainer.style.transform = 'translate(-50%, -50%)';
140
+ centerTextContainer.style.textAlign = 'center';
141
+ centerTextContainer.style.pointerEvents = 'none';
142
+ const totalLabelEl = document.createElement('div');
143
+ totalLabelEl.textContent = 'total';
144
+ totalLabelEl.style.fontSize = '14px';
145
+ totalLabelEl.style.color = '#86909c';
146
+ totalLabelEl.style.marginBottom = '5px';
147
+ const totalValueEl = document.createElement('div');
148
+ totalValueEl.textContent = formattedTotal;
149
+ totalValueEl.style.fontSize = '20px';
150
+ totalValueEl.style.color = '#1d2129';
151
+ totalValueEl.style.fontWeight = 'bold';
152
+ centerTextContainer.appendChild(totalLabelEl);
153
+ centerTextContainer.appendChild(totalValueEl);
154
+ containerRef.current?.appendChild(centerTextContainer);
155
+ centerTextRef.current = centerTextContainer;
156
+ chartRef.current = chart;
157
+ if (onChartClick) chart.on('element:click', (e)=>{
158
+ const data = e.data?.data;
159
+ if (data) onChartClick(data);
160
+ });
161
+ return ()=>{
162
+ if (chartRef.current) {
163
+ chartRef.current.destroy();
164
+ chartRef.current = null;
165
+ }
166
+ };
167
+ }, [
168
+ transformedData,
169
+ height,
170
+ x,
171
+ y,
172
+ innerRadius,
173
+ outerRadius,
174
+ minLabelPercentage,
175
+ totalValue,
176
+ safeIndicatorMap,
177
+ formatter,
178
+ onChartClick
179
+ ]);
180
+ return /*#__PURE__*/ jsx("div", {
181
+ ref: containerRef,
182
+ style: {
183
+ width: '100%',
184
+ height: `${height}px`
185
+ }
186
+ });
187
+ };
188
+ const base_G2PieChart = G2PieChart;
189
+ export { base_G2PieChart as default, newThemeColors };
@@ -0,0 +1,293 @@
1
+ /**
2
+ * G2 图表通用函数式 API
3
+ * 折线图、柱状图等可复用:创建图表、坐标轴、图例、辅助线、按 groupType 取色等
4
+ */
5
+ import { Chart } from '@antv/g2';
6
+ export interface CreateChartOptions {
7
+ container: HTMLElement;
8
+ height?: number;
9
+ autoFit?: boolean;
10
+ padding?: [number, number, number, number];
11
+ margin?: [number, number, number, number];
12
+ }
13
+ /** 创建 G2 Chart 实例,可被折线/柱状等复用 */
14
+ export declare function createChart(options: CreateChartOptions): Chart;
15
+ /** 获取主绘图 view(spaceLayer 下第一个 view),折线/柱状共用 */
16
+ export declare function getMainView(chart: Chart): import("@antv/g2/lib/api/extend").CompositionAPI<{
17
+ 'data.fetch': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/fetch").FetchOptions>;
18
+ 'data.inline': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/inline").InlineOptions>;
19
+ 'data.sortBy': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/sortBy").SortByOptions>;
20
+ 'data.sort': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/sort").SortOptions>;
21
+ 'data.filter': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/filter").FilterDataOptions>;
22
+ 'data.pick': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/pick").PickOptions>;
23
+ 'data.rename': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/rename").RenameOptions>;
24
+ 'data.fold': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/fold").FoldOptions>;
25
+ 'data.slice': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/slice").SliceOptions>;
26
+ 'data.custom': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/custom").CustomOptions>;
27
+ 'data.map': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/map").MapOptions>;
28
+ 'data.join': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/join").JoinOptions>;
29
+ 'data.kde': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/kde").KDEOptions>;
30
+ 'data.log': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/log").LogDataOptions>;
31
+ 'data.wordCloud': import("@antv/g2/lib/runtime/index").DataComponent<Partial<import("@antv/g2/lib/data/wordCloud").WordCloudOptions>>;
32
+ 'data.ema': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/ema").EMAOptions>;
33
+ 'transform.stackY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").StackYOptions>;
34
+ 'transform.binX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").BinXOptions>;
35
+ 'transform.bin': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").BinOptions>;
36
+ 'transform.dodgeX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").DodgeXOptions>;
37
+ 'transform.jitter': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").JitterOptions>;
38
+ 'transform.jitterX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").JitterXOptions>;
39
+ 'transform.jitterY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").JitterYOptions>;
40
+ 'transform.symmetryY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SymmetryYOptions>;
41
+ 'transform.diffY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").DiffYOptions>;
42
+ 'transform.stackEnter': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").StackEnterOptions>;
43
+ 'transform.normalizeY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").NormalizeYOptions>;
44
+ 'transform.select': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SelectOptions>;
45
+ 'transform.selectX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SelectXOptions>;
46
+ 'transform.selectY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SelectYOptions>;
47
+ 'transform.groupX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").GroupXOptions>;
48
+ 'transform.groupY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").GroupYOptions>;
49
+ 'transform.groupColor': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").GroupColorOptions>;
50
+ 'transform.group': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").GroupOptions>;
51
+ 'transform.sortX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SortXOptions>;
52
+ 'transform.sortY': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SortYOptions>;
53
+ 'transform.sortColor': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SortColorOptions>;
54
+ 'transform.flexX': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").FlexXOptions>;
55
+ 'transform.pack': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").PackOptions>;
56
+ 'transform.sample': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").SampleOptions>;
57
+ 'transform.filter': import("@antv/g2/lib/runtime/index").TransformComponent<import("@antv/g2").FilterOptions>;
58
+ 'coordinate.cartesian': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2/lib/coordinate/cartesian").CartesianOptions>;
59
+ 'coordinate.polar': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2/lib/coordinate/polar").PolarOptions>;
60
+ 'coordinate.transpose': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2/lib/coordinate/transpose").TransposeOptions>;
61
+ 'coordinate.theta': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2").ThetaCoordinate>;
62
+ 'coordinate.parallel': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2/lib/coordinate/parallel").ParallelOptions>;
63
+ 'coordinate.fisheye': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2").FisheyeCoordinate>;
64
+ 'coordinate.radial': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2/lib/coordinate/radial").RadialOptions>;
65
+ 'coordinate.radar': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2").RadarCoordinate>;
66
+ 'coordinate.helix': import("@antv/g2/lib/runtime/index").CoordinateComponent<import("@antv/g2").HelixCoordinate>;
67
+ 'encode.constant': import("@antv/g2/lib/runtime/index").EncodeComponent<import("@antv/g2/lib/encode/constant").ConstantOptions>;
68
+ 'encode.field': import("@antv/g2/lib/runtime/index").EncodeComponent<import("@antv/g2/lib/encode/field").FieldOptions>;
69
+ 'encode.transform': import("@antv/g2/lib/runtime/index").EncodeComponent<import("@antv/g2/lib/encode/transform").TransformOptions>;
70
+ 'encode.column': import("@antv/g2/lib/runtime/index").EncodeComponent<import("@antv/g2/lib/encode/column").ColumnOptions>;
71
+ 'mark.interval': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/interval").IntervalOptions>;
72
+ 'mark.rect': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/rect").RectOptions>;
73
+ 'mark.line': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/line").LineOptions>;
74
+ 'mark.point': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/point").PointOptions>;
75
+ 'mark.text': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/text").TextOptions>;
76
+ 'mark.cell': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/cell").CellOptions>;
77
+ 'mark.area': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/area").AreaOptions>;
78
+ 'mark.link': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/link").LinkOptions>;
79
+ 'mark.image': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/image").ImageOptions>;
80
+ 'mark.polygon': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/polygon").PolygonOptions>;
81
+ 'mark.box': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/box").BoxOptions>;
82
+ 'mark.vector': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/vector").VectorOptions>;
83
+ 'mark.lineX': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/lineX").LineXOptions>;
84
+ 'mark.lineY': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/lineY").LineYOptions>;
85
+ 'mark.connector': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/connector").ConnectorOptions>;
86
+ 'mark.range': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/range").RangeOptions>;
87
+ 'mark.rangeX': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/rangeX").RangeXOptions>;
88
+ 'mark.rangeY': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/rangeY").RangeYOptions>;
89
+ 'mark.path': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/path").PathOptions>;
90
+ 'mark.shape': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/shape").ShapeOptions>;
91
+ 'mark.density': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/density").DensityOptions>;
92
+ 'mark.heatmap': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/heatmap").HeatmapOptions>;
93
+ 'mark.wordCloud': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/wordCloud").WordCloudOptions>;
94
+ 'mark.beeswarm': import("@antv/g2").MarkComponent<import("@antv/g2/lib/mark/beeswarm").BeeswarmOptions>;
95
+ 'palette.category10': import("@antv/g2/lib/runtime/index").PaletteComponent<import("@antv/g2/lib/palette/category10").Category10Options>;
96
+ 'palette.category20': import("@antv/g2/lib/runtime/index").PaletteComponent<import("@antv/g2/lib/palette/category20").Category20Options>;
97
+ 'scale.linear': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/linear").LinearOptions>;
98
+ 'scale.ordinal': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/ordinal").OrdinalOptions>;
99
+ 'scale.band': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/band").BandOptions>;
100
+ 'scale.identity': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/identity").IdentityOptions>;
101
+ 'scale.point': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/point").PointOptions>;
102
+ 'scale.time': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/time").TimeOptions>;
103
+ 'scale.log': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/log").LogOptions>;
104
+ 'scale.pow': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/pow").PowOptions>;
105
+ 'scale.sqrt': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/sqrt").SqrtOptions>;
106
+ 'scale.threshold': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/threshold").ThresholdOptions>;
107
+ 'scale.quantile': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/quantile").QuantileOptions>;
108
+ 'scale.quantize': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/quantize").QuantizeOptions>;
109
+ 'scale.sequential': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/sequential").SequentialOptions>;
110
+ 'scale.constant': import("@antv/g2/lib/runtime/index").ScaleComponent<import("@antv/g2/lib/scale/constant").ConstantOptions>;
111
+ 'theme.classic': import("@antv/g2/lib/runtime/index").ThemeComponent<import("@antv/g2/lib/runtime/index").G2Theme>;
112
+ 'theme.classicDark': import("@antv/g2/lib/runtime/index").ThemeComponent<import("@antv/g2/lib/runtime/index").G2Theme>;
113
+ 'theme.academy': import("@antv/g2/lib/runtime/index").ThemeComponent<import("@antv/g2/lib/runtime/index").G2Theme>;
114
+ 'theme.light': import("@antv/g2/lib/runtime/index").ThemeComponent<import("@antv/g2/lib/runtime/index").G2Theme>;
115
+ 'theme.dark': import("@antv/g2/lib/runtime/index").ThemeComponent<import("@antv/g2/lib/runtime/index").G2Theme>;
116
+ 'component.axisX': import("@antv/g2").GuideComponentComponent<import("@antv/g2").AxisOptions>;
117
+ 'component.axisY': import("@antv/g2").GuideComponentComponent<import("@antv/g2").AxisOptions>;
118
+ 'component.legendCategory': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/legendCategory").LegendCategoryOptions>;
119
+ 'component.legendContinuous': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/legendContinuous").LegendContinuousOptions>;
120
+ 'component.legends': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/legends").LegendsOptions>;
121
+ 'component.title': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/runtime/index").G2Title>;
122
+ 'component.sliderX': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/slider").SliderOptions>;
123
+ 'component.sliderY': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/slider").SliderOptions>;
124
+ 'component.scrollbarX': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/scrollbar").ScrollbarOptions>;
125
+ 'component.scrollbarY': import("@antv/g2").GuideComponentComponent<import("@antv/g2/lib/component/scrollbar").ScrollbarOptions>;
126
+ 'animation.scaleInX': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
127
+ 'animation.scaleOutX': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
128
+ 'animation.scaleInY': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
129
+ 'animation.scaleOutY': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
130
+ 'animation.waveIn': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
131
+ 'animation.fadeIn': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
132
+ 'animation.fadeOut': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
133
+ 'animation.zoomIn': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
134
+ 'animation.zoomOut': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
135
+ 'animation.pathIn': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
136
+ 'animation.morphing': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/morphing").MorphingOptions>;
137
+ 'animation.growInX': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
138
+ 'animation.growInY': import("@antv/g2/lib/runtime/index").AnimationComponent<import("@antv/g2/lib/animation/types").Animation>;
139
+ 'interaction.elementHighlight': typeof import("@antv/g2/lib/interaction/elementHighlight").ElementHighlight;
140
+ 'interaction.elementHighlightByX': typeof import("@antv/g2/lib/interaction/elementHighlightByX").ElementHighlightByX;
141
+ 'interaction.elementHighlightByColor': typeof import("@antv/g2/lib/interaction/elementHighlightByColor").ElementHighlightByColor;
142
+ 'interaction.elementHoverScale': typeof import("@antv/g2/lib/interaction/elementHoverScale").ElementHoverScale;
143
+ 'interaction.elementSelect': typeof import("@antv/g2/lib/interaction/elementSelect").ElementSelect;
144
+ 'interaction.elementSelectByX': typeof import("@antv/g2/lib/interaction/elementSelectByX").ElementSelectByX;
145
+ 'interaction.elementSelectByColor': typeof import("@antv/g2/lib/interaction/elementSelectByColor").ElementSelectByColor;
146
+ 'interaction.fisheye': typeof import("@antv/g2/lib/interaction/fisheye").Fisheye;
147
+ 'interaction.chartIndex': typeof import("@antv/g2/lib/interaction/chartIndex").ChartIndex;
148
+ 'interaction.tooltip': typeof import("@antv/g2/lib/interaction/tooltip").Tooltip;
149
+ 'interaction.legendFilter': typeof import("@antv/g2/lib/interaction/legendFilter").LegendFilter;
150
+ 'interaction.legendHighlight': typeof import("@antv/g2/lib/interaction/legendHighlight").LegendHighlight;
151
+ 'interaction.brushHighlight': typeof import("@antv/g2/lib/interaction/brushHighlight").BrushHighlight;
152
+ 'interaction.brushXHighlight': typeof import("@antv/g2/lib/interaction/brushXHighlight").BrushXHighlight;
153
+ 'interaction.brushYHighlight': typeof import("@antv/g2/lib/interaction/brushYHighlight").BrushYHighlight;
154
+ 'interaction.brushAxisHighlight': typeof import("@antv/g2/lib/interaction/brushAxisHighlight").BrushAxisHighlight;
155
+ 'interaction.brushFilter': typeof import("@antv/g2/lib/interaction/brushFilter").BrushFilter;
156
+ 'interaction.brushXFilter': typeof import("@antv/g2/lib/interaction/brushXFilter").BrushXFilter;
157
+ 'interaction.brushYFilter': typeof import("@antv/g2/lib/interaction/brushYFilter").BrushYFilter;
158
+ 'interaction.sliderFilter': typeof import("@antv/g2/lib/interaction/sliderFilter").SliderFilter;
159
+ 'interaction.sliderWheel': typeof import("@antv/g2/lib/interaction/sliderWheel").SliderWheel;
160
+ 'interaction.scrollbarFilter': typeof import("@antv/g2/lib/interaction/scrollbarFilter").ScrollbarFilter;
161
+ 'interaction.poptip': typeof import("@antv/g2/lib/interaction/poptip").Poptip;
162
+ 'interaction.treemapDrillDown': typeof import("@antv/g2/lib/interaction/treemapDrillDown").TreemapDrillDown;
163
+ 'interaction.drillDown': typeof import("@antv/g2/lib/interaction/drillDown").DrillDown;
164
+ 'interaction.elementPointMove': typeof import("@antv/g2/lib/interaction/elementPointMove").ElementPointMove;
165
+ 'composition.spaceLayer': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/spaceLayer").SpaceLayerOptions>;
166
+ 'composition.spaceFlex': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/spaceFlex").SpaceFlexOptions>;
167
+ 'composition.facetRect': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/facetRect").FacetRectOptions>;
168
+ 'composition.repeatMatrix': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2").RepeatMatrixComposition>;
169
+ 'composition.facetCircle': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2").FacetCircleComposition>;
170
+ 'composition.timingKeyframe': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/timingKeyframe").TimingKeyframeOptions>;
171
+ 'labelTransform.overlapHide': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/overlapHide").OverlapHideOptions>;
172
+ 'labelTransform.overlapDodgeY': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/overlapDodgeY").OverlapDodgeYOptions>;
173
+ 'labelTransform.overflowHide': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/overflowHide").OverflowHideOptions>;
174
+ 'labelTransform.contrastReverse': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/contrastReverse").ContrastReverseOptions>;
175
+ 'labelTransform.overflowStroke': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/overflowStroke").OverflowStrokeOptions>;
176
+ 'labelTransform.exceedAdjust': import("@antv/g2/lib/runtime/index").LabelTransformComponent<import("@antv/g2/lib/label-transform/exceedAdjust").ExceedAdjustOptions>;
177
+ 'data.venn': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/venn").VennOptions>;
178
+ 'mark.boxplot': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/boxplot").BoxPlotOptions>;
179
+ 'mark.gauge': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/gauge").GaugeOptions>;
180
+ 'mark.liquid': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/liquid").LiquidOptions>;
181
+ 'data.arc': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/arc").ArcOptions>;
182
+ 'data.cluster': import("@antv/g2/lib/runtime/index").DataComponent<import("@antv/g2/lib/data/cluster").ClusterOptions>;
183
+ 'mark.forceGraph': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/forceGraph").ForceGraphOptions>;
184
+ 'mark.tree': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/tree").TreeOptions>;
185
+ 'mark.pack': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/mark/pack").PackOptions>;
186
+ 'mark.sankey': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/sankey").SankeyOptions>;
187
+ 'mark.chord': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/chord").ChordOptions>;
188
+ 'mark.treemap': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/mark/treemap").TreemapOptions>;
189
+ 'mark.partition': import("@antv/g2/lib/runtime/index").CompositeMarkComponent<import("@antv/g2/lib/mark/partition").PartitionOptions>;
190
+ 'composition.geoView': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/geoView").GeoViewOptions>;
191
+ 'composition.geoPath': import("@antv/g2/lib/runtime/index").CompositionComponent<import("@antv/g2/lib/composition/geoPath").GeoPathOptions>;
192
+ } & {
193
+ 'composition.mark': any;
194
+ 'composition.view': any;
195
+ }>;
196
+ export interface ScaleYLinearOptions {
197
+ field?: string;
198
+ domainMin?: number;
199
+ domainMax?: number;
200
+ nice?: boolean;
201
+ clamp?: boolean;
202
+ /** Y 轴刻度数量(G2 scale tickCount),默认 5 */
203
+ tickCount?: number;
204
+ /**
205
+ * 严格模式刻度下界。来源:@antv/scale 的 ScaleConfig(非 G2 文档),传入后由底层 scale 走 strictLimit,在 [minLimit, maxLimit] 上均匀生成恰好 tickCount 个刻度
206
+ */
207
+ minLimit?: number;
208
+ /**
209
+ * 严格模式刻度上界。来源:@antv/scale 的 ScaleConfig(非 G2 文档),与 minLimit 同时设置时生效
210
+ */
211
+ maxLimit?: number;
212
+ /** 刻度算法:'wilkinson-extended'(默认)| 'd3-linear' | 'r-pretty',或自定义函数 */
213
+ tickMethod?: string | ((cfg: any) => number[]);
214
+ }
215
+ /** 为 view 设置 Y 轴线性比例尺,控制显示范围与刻度数 */
216
+ export declare function applyScaleYLinear(view: any, options?: ScaleYLinearOptions): void;
217
+ export interface ApplyAxisXOptions {
218
+ title?: boolean;
219
+ labelAutoHide?: 'greedy' | 'equidistant' | boolean;
220
+ /** 为 true 时刻度过多会自动旋转为垂直;为 false 时保持水平,依赖 labelAutoHide 避免重叠。默认 false */
221
+ labelAutoRotate?: boolean;
222
+ grid?: boolean;
223
+ gridStroke?: string;
224
+ gridLineWidth?: number;
225
+ gridLineDash?: number[];
226
+ gridFilter?: (val: any) => boolean;
227
+ }
228
+ /** 配置 X 轴,挂载在 mark 上(如 line / interval) */
229
+ export declare function applyAxisX(mark: any, options?: ApplyAxisXOptions): void;
230
+ export interface ApplyAxisYOptions {
231
+ title?: boolean;
232
+ labelAutoRotate?: boolean;
233
+ grid?: boolean;
234
+ gridStroke?: string;
235
+ gridLineWidth?: number;
236
+ gridStrokeOpacity?: number;
237
+ gridLineDash?: number[];
238
+ labelFormatter?: (val: any) => string;
239
+ }
240
+ /** 配置 Y 轴 */
241
+ export declare function applyAxisY(mark: any, options?: ApplyAxisYOptions): void;
242
+ export interface ApplyLegendColorOptions {
243
+ position?: 'top' | 'bottom' | 'left' | 'right';
244
+ crossPadding?: number;
245
+ /**
246
+ * 图例宽度(position 为 top/bottom 时生效)。
247
+ * G2 源码:inferComponentShape() 中 length = userDefinedLength || defaultLength || bboxLength;
248
+ * LegendCategory 无 defaultLength,不传 length 时 length=bbox.width。
249
+ * bbox 来自 layout:placePaddingArea 里对 type.startsWith('legend') 的组件用 crossSizeOf(..., totalSize),
250
+ * bottom 时 totalSize=plotWidth,即 图表宽度 - marginLeft - marginRight。故不传 length 时图例宽度 = 整块绘图区水平宽度。
251
+ */
252
+ length?: number;
253
+ /**
254
+ * 图例高度(position 为 top/bottom 时为单行高度;left/right 时为整体高度)。
255
+ * G2:inferComponentShape 中 size = userDefinedSize || defaultSize(40) || bboxSize。
256
+ */
257
+ size?: number;
258
+ /** 根据图例项 id(如 groupType)返回描边色 */
259
+ getStroke?: (id: string) => string;
260
+ /** 根据 id 返回展示文案 */
261
+ getLabelText?: (id: string) => string;
262
+ /** 根据 id 返回线型(折线用),如 [3,3] 虚线 */
263
+ getLineDash?: (id: string) => number[];
264
+ /** 根据 id 返回填充色 */
265
+ getFill?: (id: string) => string;
266
+ /** 图例 marker 类型,如 'line' / 'dash' */
267
+ itemMarker?: string | ((datum: any, index: number) => string);
268
+ }
269
+ /** 配置 color 图例,挂载在 view 上 */
270
+ export declare function applyLegendColor(view: any, options?: ApplyLegendColorOptions): void;
271
+ export interface AuxiliaryLineItem {
272
+ name: string;
273
+ value: number;
274
+ }
275
+ export interface ApplyAuxiliaryLineYOptions {
276
+ stroke?: string;
277
+ strokeOpacity?: number;
278
+ labelMaxLength?: number;
279
+ }
280
+ /** 在 view 上添加多条 lineY 辅助线 */
281
+ export declare function applyAuxiliaryLineY(view: any, lines: AuxiliaryLineItem[], options?: ApplyAuxiliaryLineYOptions): void;
282
+ export interface GetColorByGroupTypeOptions {
283
+ themeColors: string[];
284
+ /** 主指标 key,与 groupType 一致时用 themeColors[0] */
285
+ primaryKey: string;
286
+ /** 多指标顺序,用于 index 取 themeColors[index] */
287
+ indicators?: string[];
288
+ }
289
+ /**
290
+ * 根据 groupType(或去掉 _compare 后的 baseKey)返回颜色,折线 stroke / 柱状 fill 共用
291
+ */
292
+ export declare function getColorByGroupType(groupType: string, options: GetColorByGroupTypeOptions): string;
293
+ export declare function applyHighlightDate(view: any, x: string, data: any, highlightDate: string[]): void;