@damoqiongqiu/ice-chart 0.30.12 → 0.30.13
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/README.md +13 -4
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/ICEChart.d.mts +41 -0
- package/dist/types/ICEChart.d.ts +41 -0
- package/dist/types/components/Axis.d.mts +13 -0
- package/dist/types/components/Axis.d.ts +13 -0
- package/dist/types/components/Crosshair.d.mts +7 -1
- package/dist/types/components/Crosshair.d.ts +7 -1
- package/dist/types/components/Tooltip.d.mts +6 -1
- package/dist/types/components/Tooltip.d.ts +6 -1
- package/dist/types/components/series/BeeswarmSeries.d.mts +23 -0
- package/dist/types/components/series/BeeswarmSeries.d.ts +23 -0
- package/dist/types/components/series/ViolinSeries.d.mts +34 -0
- package/dist/types/components/series/ViolinSeries.d.ts +34 -0
- package/dist/types/components/series/index.d.mts +2 -0
- package/dist/types/components/series/index.d.ts +2 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interaction/HitResolver.d.mts +19 -2
- package/dist/types/interaction/HitResolver.d.ts +19 -2
- package/dist/types/internal.d.mts +33 -0
- package/dist/types/internal.d.ts +33 -0
- package/dist/types/layout/density.d.mts +62 -0
- package/dist/types/layout/density.d.ts +62 -0
- package/dist/types/layout/panels.d.mts +35 -0
- package/dist/types/layout/panels.d.ts +35 -0
- package/dist/types/types.d.mts +53 -1
- package/dist/types/types.d.ts +53 -1
- package/dist/types/util/color.d.mts +8 -0
- package/dist/types/util/color.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ICE, ICEGroup } from 'ice-render';
|
|
2
2
|
import type { AnnotationDiagnostic, ChartMarkHandle, ChartMarkSpec, ChartOption, DataItem } from './types.mjs';
|
|
3
3
|
import type { ChartLayout, InternalSeries, NormalizedOption } from './internal.mjs';
|
|
4
|
+
import { type Scale } from './scale.mjs';
|
|
4
5
|
import { GridLines } from './components/GridLines.mjs';
|
|
5
6
|
import { Annotation } from './components/Annotation.mjs';
|
|
6
7
|
import { PlotArea } from './components/PlotArea.mjs';
|
|
@@ -81,6 +82,17 @@ export declare class ICEChart {
|
|
|
81
82
|
axisX: Axis;
|
|
82
83
|
/** y 轴组件,与 norm.yAxes 一一对应(axisYList[0] 是主 y 轴)。 */
|
|
83
84
|
axisYList: Axis[];
|
|
85
|
+
/** 每个面板一份网格(`grids[0]` 就是 `this.grid`;单面板时长度为 1)。 */
|
|
86
|
+
grids: GridLines[];
|
|
87
|
+
/** 每列一份 x 轴(面板矩阵的外圈轴;`panelAxisX[0]` 就是 `this.axisX`)。 */
|
|
88
|
+
panelAxisX: Axis[];
|
|
89
|
+
/** 每行一份 y 轴(面板矩阵的外圈轴;`panelAxisY[0]` 就是 `this.axisYList[0]`)。 */
|
|
90
|
+
panelAxisY: Axis[];
|
|
91
|
+
/** 每个面板的比例尺:域共享、range 按各自面板矩形。`panelScales[0]` 即 `norm.*.scale`。 */
|
|
92
|
+
panelScales: Array<{
|
|
93
|
+
x: Scale;
|
|
94
|
+
ys: Scale[];
|
|
95
|
+
}>;
|
|
84
96
|
legend: Legend | null;
|
|
85
97
|
titleComponent: Title | null;
|
|
86
98
|
tooltip: Tooltip | null;
|
|
@@ -465,6 +477,35 @@ export declare class ICEChart {
|
|
|
465
477
|
* 表达式系列 / 等比坐标由 `canApplyView` 挡下来,照旧整条重跑。
|
|
466
478
|
*/
|
|
467
479
|
private rebuild;
|
|
480
|
+
/** 系列所属面板下标(没有 matrix、或下标越界时都退回 0)。 */
|
|
481
|
+
private panelIndexOf;
|
|
482
|
+
/** 系列所属面板的矩形(图表坐标系)。非直角坐标 / 单面板时就是整块绘图区。 */
|
|
483
|
+
private panelRectOf;
|
|
484
|
+
/** 系列所属面板的组件盒(`createSeriesComponent` 的入参形状)。 */
|
|
485
|
+
private panelBoxOf;
|
|
486
|
+
/** 系列所属面板的比例尺(域共享、range 按面板)。 */
|
|
487
|
+
private panelScalesOf;
|
|
488
|
+
/** 数据坐标图元所属的面板下标(`spec.panel`,默认 0;越界夹回)。 */
|
|
489
|
+
private markPanelIndex;
|
|
490
|
+
/**
|
|
491
|
+
* 同步一份网格线到给定矩形 / 比例尺。
|
|
492
|
+
*
|
|
493
|
+
* 单面板时就是从前那段代码逐字搬过来;多面板时每个面板各来一遍。
|
|
494
|
+
*
|
|
495
|
+
* 抽稀后的竖线位置是**同一批**(域共享),所以 `xTicks` 直接从布局那张表取,各面板不必重算。
|
|
496
|
+
*/
|
|
497
|
+
private syncGrid;
|
|
498
|
+
/**
|
|
499
|
+
* 面板矩阵的组件池:每个面板一份网格、每行一份 y 轴、每列一份 x 轴。
|
|
500
|
+
*
|
|
501
|
+
* 三条纪律:
|
|
502
|
+
* 1. **`matrix` 缺席时全部退回单实例**(`grids[0]` 就是 `this.grid`、`panelAxisX[0]` 就是
|
|
503
|
+
* `this.axisX`),旧路径一行都不用改,也不会多建组件;
|
|
504
|
+
* 2. 多出来的组件**按需创建、用完回收**(`setOption` 从矩阵切回单图时不留孤儿);
|
|
505
|
+
* 3. 外圈轴的刻度表**只算一次**:域共享 → 每行/每列的刻度与标签完全相同,
|
|
506
|
+
* 这里只是把同一条轴画到不同的矩形上(`Axis.plot`)。
|
|
507
|
+
*/
|
|
508
|
+
private syncPanelComponents;
|
|
468
509
|
private buildScales;
|
|
469
510
|
private syncComponents;
|
|
470
511
|
/** 当前 x 数据域在完整数据域中的比例窗口(0~1),供 dataZoom 滑块显示。 */
|
package/dist/types/ICEChart.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ICE, ICEGroup } from 'ice-render';
|
|
2
2
|
import type { AnnotationDiagnostic, ChartMarkHandle, ChartMarkSpec, ChartOption, DataItem } from './types';
|
|
3
3
|
import type { ChartLayout, InternalSeries, NormalizedOption } from './internal';
|
|
4
|
+
import { type Scale } from './scale';
|
|
4
5
|
import { GridLines } from './components/GridLines';
|
|
5
6
|
import { Annotation } from './components/Annotation';
|
|
6
7
|
import { PlotArea } from './components/PlotArea';
|
|
@@ -81,6 +82,17 @@ export declare class ICEChart {
|
|
|
81
82
|
axisX: Axis;
|
|
82
83
|
/** y 轴组件,与 norm.yAxes 一一对应(axisYList[0] 是主 y 轴)。 */
|
|
83
84
|
axisYList: Axis[];
|
|
85
|
+
/** 每个面板一份网格(`grids[0]` 就是 `this.grid`;单面板时长度为 1)。 */
|
|
86
|
+
grids: GridLines[];
|
|
87
|
+
/** 每列一份 x 轴(面板矩阵的外圈轴;`panelAxisX[0]` 就是 `this.axisX`)。 */
|
|
88
|
+
panelAxisX: Axis[];
|
|
89
|
+
/** 每行一份 y 轴(面板矩阵的外圈轴;`panelAxisY[0]` 就是 `this.axisYList[0]`)。 */
|
|
90
|
+
panelAxisY: Axis[];
|
|
91
|
+
/** 每个面板的比例尺:域共享、range 按各自面板矩形。`panelScales[0]` 即 `norm.*.scale`。 */
|
|
92
|
+
panelScales: Array<{
|
|
93
|
+
x: Scale;
|
|
94
|
+
ys: Scale[];
|
|
95
|
+
}>;
|
|
84
96
|
legend: Legend | null;
|
|
85
97
|
titleComponent: Title | null;
|
|
86
98
|
tooltip: Tooltip | null;
|
|
@@ -465,6 +477,35 @@ export declare class ICEChart {
|
|
|
465
477
|
* 表达式系列 / 等比坐标由 `canApplyView` 挡下来,照旧整条重跑。
|
|
466
478
|
*/
|
|
467
479
|
private rebuild;
|
|
480
|
+
/** 系列所属面板下标(没有 matrix、或下标越界时都退回 0)。 */
|
|
481
|
+
private panelIndexOf;
|
|
482
|
+
/** 系列所属面板的矩形(图表坐标系)。非直角坐标 / 单面板时就是整块绘图区。 */
|
|
483
|
+
private panelRectOf;
|
|
484
|
+
/** 系列所属面板的组件盒(`createSeriesComponent` 的入参形状)。 */
|
|
485
|
+
private panelBoxOf;
|
|
486
|
+
/** 系列所属面板的比例尺(域共享、range 按面板)。 */
|
|
487
|
+
private panelScalesOf;
|
|
488
|
+
/** 数据坐标图元所属的面板下标(`spec.panel`,默认 0;越界夹回)。 */
|
|
489
|
+
private markPanelIndex;
|
|
490
|
+
/**
|
|
491
|
+
* 同步一份网格线到给定矩形 / 比例尺。
|
|
492
|
+
*
|
|
493
|
+
* 单面板时就是从前那段代码逐字搬过来;多面板时每个面板各来一遍。
|
|
494
|
+
*
|
|
495
|
+
* 抽稀后的竖线位置是**同一批**(域共享),所以 `xTicks` 直接从布局那张表取,各面板不必重算。
|
|
496
|
+
*/
|
|
497
|
+
private syncGrid;
|
|
498
|
+
/**
|
|
499
|
+
* 面板矩阵的组件池:每个面板一份网格、每行一份 y 轴、每列一份 x 轴。
|
|
500
|
+
*
|
|
501
|
+
* 三条纪律:
|
|
502
|
+
* 1. **`matrix` 缺席时全部退回单实例**(`grids[0]` 就是 `this.grid`、`panelAxisX[0]` 就是
|
|
503
|
+
* `this.axisX`),旧路径一行都不用改,也不会多建组件;
|
|
504
|
+
* 2. 多出来的组件**按需创建、用完回收**(`setOption` 从矩阵切回单图时不留孤儿);
|
|
505
|
+
* 3. 外圈轴的刻度表**只算一次**:域共享 → 每行/每列的刻度与标签完全相同,
|
|
506
|
+
* 这里只是把同一条轴画到不同的矩形上(`Axis.plot`)。
|
|
507
|
+
*/
|
|
508
|
+
private syncPanelComponents;
|
|
468
509
|
private buildScales;
|
|
469
510
|
private syncComponents;
|
|
470
511
|
/** 当前 x 数据域在完整数据域中的比例窗口(0~1),供 dataZoom 滑块显示。 */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent.mjs';
|
|
2
2
|
import type { ChartTheme } from '../types.mjs';
|
|
3
3
|
import type { ChartLayout, InternalAxis } from '../internal.mjs';
|
|
4
|
+
import type { Rect } from '../internal.mjs';
|
|
4
5
|
/** 刻度平滑过渡时长:缩放 / 平移 / 数据更新时,标签滑动到新位置而不是瞬间跳。 */
|
|
5
6
|
export declare const AXIS_MORPH_DURATION = 240;
|
|
6
7
|
/**
|
|
@@ -17,6 +18,11 @@ export declare class Axis extends ChartComponent {
|
|
|
17
18
|
/** y 轴下标(对应 norm.yAxes);x 轴恒为 0。 */
|
|
18
19
|
axisIndex: number;
|
|
19
20
|
position: 'left' | 'right';
|
|
21
|
+
/**
|
|
22
|
+
* 这条轴负责的绘图区矩形;`null` = 用图表整体的 `layout.plot`(默认路径,逐像素不变)。
|
|
23
|
+
* 面板矩阵里给每条外圈轴指定它该负责的那一块面板。
|
|
24
|
+
*/
|
|
25
|
+
plot: Rect | null;
|
|
20
26
|
axis: InternalAxis | null;
|
|
21
27
|
layout: ChartLayout | null;
|
|
22
28
|
theme: ChartTheme | null;
|
|
@@ -33,6 +39,13 @@ export declare class Axis extends ChartComponent {
|
|
|
33
39
|
});
|
|
34
40
|
/** y 轴轴线的 x 坐标(含同侧多层偏移)。 */
|
|
35
41
|
private edgeX;
|
|
42
|
+
/**
|
|
43
|
+
* 这条轴要画的绘图区矩形。
|
|
44
|
+
*
|
|
45
|
+
* 默认就是图表的绘图区(与从前逐字一致);面板矩阵里由 Chart 给每条外圈轴指定
|
|
46
|
+
* **它该负责的那一块面板** —— 同一个组件画到不同矩形上,不再为每个面板复制一份轴逻辑。
|
|
47
|
+
*/
|
|
48
|
+
private plotRect;
|
|
36
49
|
private axisLayoutOf;
|
|
37
50
|
/** 当前刻度 + 目标位置 + 标签(抽稀规则见 `buildAxisLayout`,那边是唯一来源)。 */
|
|
38
51
|
private tickEntries;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent';
|
|
2
2
|
import type { ChartTheme } from '../types';
|
|
3
3
|
import type { ChartLayout, InternalAxis } from '../internal';
|
|
4
|
+
import type { Rect } from '../internal';
|
|
4
5
|
/** 刻度平滑过渡时长:缩放 / 平移 / 数据更新时,标签滑动到新位置而不是瞬间跳。 */
|
|
5
6
|
export declare const AXIS_MORPH_DURATION = 240;
|
|
6
7
|
/**
|
|
@@ -17,6 +18,11 @@ export declare class Axis extends ChartComponent {
|
|
|
17
18
|
/** y 轴下标(对应 norm.yAxes);x 轴恒为 0。 */
|
|
18
19
|
axisIndex: number;
|
|
19
20
|
position: 'left' | 'right';
|
|
21
|
+
/**
|
|
22
|
+
* 这条轴负责的绘图区矩形;`null` = 用图表整体的 `layout.plot`(默认路径,逐像素不变)。
|
|
23
|
+
* 面板矩阵里给每条外圈轴指定它该负责的那一块面板。
|
|
24
|
+
*/
|
|
25
|
+
plot: Rect | null;
|
|
20
26
|
axis: InternalAxis | null;
|
|
21
27
|
layout: ChartLayout | null;
|
|
22
28
|
theme: ChartTheme | null;
|
|
@@ -33,6 +39,13 @@ export declare class Axis extends ChartComponent {
|
|
|
33
39
|
});
|
|
34
40
|
/** y 轴轴线的 x 坐标(含同侧多层偏移)。 */
|
|
35
41
|
private edgeX;
|
|
42
|
+
/**
|
|
43
|
+
* 这条轴要画的绘图区矩形。
|
|
44
|
+
*
|
|
45
|
+
* 默认就是图表的绘图区(与从前逐字一致);面板矩阵里由 Chart 给每条外圈轴指定
|
|
46
|
+
* **它该负责的那一块面板** —— 同一个组件画到不同矩形上,不再为每个面板复制一份轴逻辑。
|
|
47
|
+
*/
|
|
48
|
+
private plotRect;
|
|
36
49
|
private axisLayoutOf;
|
|
37
50
|
/** 当前刻度 + 目标位置 + 标签(抽稀规则见 `buildAxisLayout`,那边是唯一来源)。 */
|
|
38
51
|
private tickEntries;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent.mjs';
|
|
2
2
|
import type { ChartTheme, CrosshairOption } from '../types.mjs';
|
|
3
|
-
import type { ChartLayout } from '../internal.mjs';
|
|
3
|
+
import type { ChartLayout, Rect } from '../internal.mjs';
|
|
4
4
|
/**
|
|
5
5
|
* 准星跟随时长:**距离越大走得越快**,上限 `maxDuration`(0 = 立即跟随)。
|
|
6
6
|
*
|
|
@@ -14,6 +14,12 @@ export declare function crosshairGlideDuration(distance: number, maxDuration: nu
|
|
|
14
14
|
/** 十字准星:跟随活动数据列的辅助线 + 坐标轴数值标签。 */
|
|
15
15
|
export declare class Crosshair extends ChartComponent {
|
|
16
16
|
layout: ChartLayout | null;
|
|
17
|
+
/**
|
|
18
|
+
* 准星画在哪块绘图区里;`null` = 图表整体的 `layout.plot`(默认路径)。
|
|
19
|
+
* 面板矩阵里由 InteractionController 设成**指针所在面板** —— 准星只在那块里画,
|
|
20
|
+
* 否则一条线会横穿所有面板,指代不清。
|
|
21
|
+
*/
|
|
22
|
+
plot: Rect | null;
|
|
17
23
|
theme: ChartTheme | null;
|
|
18
24
|
option: CrosshairOption;
|
|
19
25
|
pixelX: number | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent';
|
|
2
2
|
import type { ChartTheme, CrosshairOption } from '../types';
|
|
3
|
-
import type { ChartLayout } from '../internal';
|
|
3
|
+
import type { ChartLayout, Rect } from '../internal';
|
|
4
4
|
/**
|
|
5
5
|
* 准星跟随时长:**距离越大走得越快**,上限 `maxDuration`(0 = 立即跟随)。
|
|
6
6
|
*
|
|
@@ -14,6 +14,12 @@ export declare function crosshairGlideDuration(distance: number, maxDuration: nu
|
|
|
14
14
|
/** 十字准星:跟随活动数据列的辅助线 + 坐标轴数值标签。 */
|
|
15
15
|
export declare class Crosshair extends ChartComponent {
|
|
16
16
|
layout: ChartLayout | null;
|
|
17
|
+
/**
|
|
18
|
+
* 准星画在哪块绘图区里;`null` = 图表整体的 `layout.plot`(默认路径)。
|
|
19
|
+
* 面板矩阵里由 InteractionController 设成**指针所在面板** —— 准星只在那块里画,
|
|
20
|
+
* 否则一条线会横穿所有面板,指代不清。
|
|
21
|
+
*/
|
|
22
|
+
plot: Rect | null;
|
|
17
23
|
theme: ChartTheme | null;
|
|
18
24
|
option: CrosshairOption;
|
|
19
25
|
pixelX: number | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent.mjs';
|
|
2
2
|
import type { ChartTheme, TooltipOption } from '../types.mjs';
|
|
3
|
-
import type { ChartLayout } from '../internal.mjs';
|
|
3
|
+
import type { ChartLayout, Rect } from '../internal.mjs';
|
|
4
4
|
export interface TooltipRow {
|
|
5
5
|
name: string;
|
|
6
6
|
value: string;
|
|
@@ -18,6 +18,11 @@ export declare class Tooltip extends ChartComponent {
|
|
|
18
18
|
theme: ChartTheme | null;
|
|
19
19
|
option: TooltipOption;
|
|
20
20
|
layout: ChartLayout | null;
|
|
21
|
+
/**
|
|
22
|
+
* 提示框的避让边界;`null` = 整块绘图区(默认路径)。
|
|
23
|
+
* 面板矩阵里由 InteractionController 设成指针所在的那块面板。
|
|
24
|
+
*/
|
|
25
|
+
plot: Rect | null;
|
|
21
26
|
content: TooltipContent | null;
|
|
22
27
|
anchor: [number, number];
|
|
23
28
|
/** 是否让提示框跟随指针(axis 触发器常关掉,让它固定在数据列上方)。 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartComponent } from './ChartComponent';
|
|
2
2
|
import type { ChartTheme, TooltipOption } from '../types';
|
|
3
|
-
import type { ChartLayout } from '../internal';
|
|
3
|
+
import type { ChartLayout, Rect } from '../internal';
|
|
4
4
|
export interface TooltipRow {
|
|
5
5
|
name: string;
|
|
6
6
|
value: string;
|
|
@@ -18,6 +18,11 @@ export declare class Tooltip extends ChartComponent {
|
|
|
18
18
|
theme: ChartTheme | null;
|
|
19
19
|
option: TooltipOption;
|
|
20
20
|
layout: ChartLayout | null;
|
|
21
|
+
/**
|
|
22
|
+
* 提示框的避让边界;`null` = 整块绘图区(默认路径)。
|
|
23
|
+
* 面板矩阵里由 InteractionController 设成指针所在的那块面板。
|
|
24
|
+
*/
|
|
25
|
+
plot: Rect | null;
|
|
21
26
|
content: TooltipContent | null;
|
|
22
27
|
anchor: [number, number];
|
|
23
28
|
/** 是否让提示框跟随指针(axis 触发器常关掉,让它固定在数据列上方)。 */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SeriesBase } from './SeriesBase.mjs';
|
|
2
|
+
import type { SeriesType } from '../../types.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* 蜂群图(抖动条带):每个观测一个点,同一类目里挤在一起的点横向错开。
|
|
5
|
+
*
|
|
6
|
+
* 与散点图的关系:数据形态、绘制、命中判定都是散点那一套(逐点 `[x, y]`),
|
|
7
|
+
* 唯一的区别是 x 不是直接映射出来的,而是**在 band 内避让之后**的位置。
|
|
8
|
+
* 避让发生在像素空间,所以算在 `rebuildPixels()` 里 —— 归一化阶段没有比例尺。
|
|
9
|
+
*/
|
|
10
|
+
export declare class BeeswarmSeries extends SeriesBase {
|
|
11
|
+
seriesType: SeriesType;
|
|
12
|
+
protected supportsSampling: boolean;
|
|
13
|
+
protected clipToBox: boolean;
|
|
14
|
+
private swarmKey;
|
|
15
|
+
/** 标记的形状与配色(与散点同一套字段,别各写一份)。 */
|
|
16
|
+
private symbolStyle;
|
|
17
|
+
/**
|
|
18
|
+
* 像素缓存 = 避让后的点位置,**绘制与命中共用这一份**(铁律 2)。
|
|
19
|
+
*/
|
|
20
|
+
protected rebuildPixels(): void;
|
|
21
|
+
hitTestIndex(localX: number, localY: number): number;
|
|
22
|
+
protected doRender(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SeriesBase } from './SeriesBase';
|
|
2
|
+
import type { SeriesType } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* 蜂群图(抖动条带):每个观测一个点,同一类目里挤在一起的点横向错开。
|
|
5
|
+
*
|
|
6
|
+
* 与散点图的关系:数据形态、绘制、命中判定都是散点那一套(逐点 `[x, y]`),
|
|
7
|
+
* 唯一的区别是 x 不是直接映射出来的,而是**在 band 内避让之后**的位置。
|
|
8
|
+
* 避让发生在像素空间,所以算在 `rebuildPixels()` 里 —— 归一化阶段没有比例尺。
|
|
9
|
+
*/
|
|
10
|
+
export declare class BeeswarmSeries extends SeriesBase {
|
|
11
|
+
seriesType: SeriesType;
|
|
12
|
+
protected supportsSampling: boolean;
|
|
13
|
+
protected clipToBox: boolean;
|
|
14
|
+
private swarmKey;
|
|
15
|
+
/** 标记的形状与配色(与散点同一套字段,别各写一份)。 */
|
|
16
|
+
private symbolStyle;
|
|
17
|
+
/**
|
|
18
|
+
* 像素缓存 = 避让后的点位置,**绘制与命中共用这一份**(铁律 2)。
|
|
19
|
+
*/
|
|
20
|
+
protected rebuildPixels(): void;
|
|
21
|
+
hitTestIndex(localX: number, localY: number): number;
|
|
22
|
+
protected doRender(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SeriesBase } from './SeriesBase.mjs';
|
|
2
|
+
import type { SeriesType } from '../../types.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* 小提琴图:每个数据项是**一组原始观测值**,轮廓由核密度曲线镜像而来。
|
|
5
|
+
*
|
|
6
|
+
* 几何口径:
|
|
7
|
+
* - 密度曲线在**数据空间**算(归一化里的 `computeKdeProfile`,纯函数可单测),
|
|
8
|
+
* 组件只做「数据空间 → 像素」的映射 —— 与函数绘图同一条思路:几何来自公式,不是逐点数据;
|
|
9
|
+
* - 轮廓宽度按密度**归一化**到「band 内的半宽」,所以峰值贴着最宽处、尾巴收成一条线;
|
|
10
|
+
* - 命中就是**这片轮廓的内部**(与渲染共用同一份多边形,铁律 1 + 铁律 2)。
|
|
11
|
+
*/
|
|
12
|
+
export declare class ViolinSeries extends SeriesBase {
|
|
13
|
+
seriesType: SeriesType;
|
|
14
|
+
protected supportsSampling: boolean;
|
|
15
|
+
protected clipToBox: boolean;
|
|
16
|
+
private geometryKey;
|
|
17
|
+
private pixelKey;
|
|
18
|
+
private polygons;
|
|
19
|
+
/** 轮廓的半宽(像素):`barWidth` 与箱线同口径,0~1 的小数是 band 占比。 */
|
|
20
|
+
private halfWidth;
|
|
21
|
+
/**
|
|
22
|
+
* 每条轮廓的像素几何(本地坐标)。
|
|
23
|
+
*
|
|
24
|
+
* 缓存键必须带坐标系指纹与绘图区尺寸(走 `buildSeriesKey`):缩放 / 平移 / 数据域过渡
|
|
25
|
+
* 之后密度曲线的像素位置全变,键不变就会拿旧轮廓去命中。
|
|
26
|
+
*/
|
|
27
|
+
private ensureGeometry;
|
|
28
|
+
/** 某一组的轮廓(本地像素坐标,闭合多边形);没有密度时返回 null。 */
|
|
29
|
+
violinPolygonAt(index: number): Array<[number, number]> | null;
|
|
30
|
+
/** 像素缓存 = 轮廓的「最宽处中心」(高亮与提示框锚点)。 */
|
|
31
|
+
protected rebuildPixels(): void;
|
|
32
|
+
hitTestIndex(localX: number, localY: number): number;
|
|
33
|
+
protected doRender(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SeriesBase } from './SeriesBase';
|
|
2
|
+
import type { SeriesType } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* 小提琴图:每个数据项是**一组原始观测值**,轮廓由核密度曲线镜像而来。
|
|
5
|
+
*
|
|
6
|
+
* 几何口径:
|
|
7
|
+
* - 密度曲线在**数据空间**算(归一化里的 `computeKdeProfile`,纯函数可单测),
|
|
8
|
+
* 组件只做「数据空间 → 像素」的映射 —— 与函数绘图同一条思路:几何来自公式,不是逐点数据;
|
|
9
|
+
* - 轮廓宽度按密度**归一化**到「band 内的半宽」,所以峰值贴着最宽处、尾巴收成一条线;
|
|
10
|
+
* - 命中就是**这片轮廓的内部**(与渲染共用同一份多边形,铁律 1 + 铁律 2)。
|
|
11
|
+
*/
|
|
12
|
+
export declare class ViolinSeries extends SeriesBase {
|
|
13
|
+
seriesType: SeriesType;
|
|
14
|
+
protected supportsSampling: boolean;
|
|
15
|
+
protected clipToBox: boolean;
|
|
16
|
+
private geometryKey;
|
|
17
|
+
private pixelKey;
|
|
18
|
+
private polygons;
|
|
19
|
+
/** 轮廓的半宽(像素):`barWidth` 与箱线同口径,0~1 的小数是 band 占比。 */
|
|
20
|
+
private halfWidth;
|
|
21
|
+
/**
|
|
22
|
+
* 每条轮廓的像素几何(本地坐标)。
|
|
23
|
+
*
|
|
24
|
+
* 缓存键必须带坐标系指纹与绘图区尺寸(走 `buildSeriesKey`):缩放 / 平移 / 数据域过渡
|
|
25
|
+
* 之后密度曲线的像素位置全变,键不变就会拿旧轮廓去命中。
|
|
26
|
+
*/
|
|
27
|
+
private ensureGeometry;
|
|
28
|
+
/** 某一组的轮廓(本地像素坐标,闭合多边形);没有密度时返回 null。 */
|
|
29
|
+
violinPolygonAt(index: number): Array<[number, number]> | null;
|
|
30
|
+
/** 像素缓存 = 轮廓的「最宽处中心」(高亮与提示框锚点)。 */
|
|
31
|
+
protected rebuildPixels(): void;
|
|
32
|
+
hitTestIndex(localX: number, localY: number): number;
|
|
33
|
+
protected doRender(): void;
|
|
34
|
+
}
|
|
@@ -15,6 +15,8 @@ export type { FunnelSeriesCoord } from './FunnelSeries.mjs';
|
|
|
15
15
|
export { GaugeSeries } from './GaugeSeries.mjs';
|
|
16
16
|
export type { GaugeSeriesCoord } from './GaugeSeries.mjs';
|
|
17
17
|
export { BoxplotSeries } from './BoxplotSeries.mjs';
|
|
18
|
+
export { ViolinSeries } from './ViolinSeries.mjs';
|
|
19
|
+
export { BeeswarmSeries } from './BeeswarmSeries.mjs';
|
|
18
20
|
export { WaterfallSeries } from './WaterfallSeries.mjs';
|
|
19
21
|
export { TreemapSeries } from './TreemapSeries.mjs';
|
|
20
22
|
export type { TreemapSeriesCoord } from './TreemapSeries.mjs';
|
|
@@ -15,6 +15,8 @@ export type { FunnelSeriesCoord } from './FunnelSeries';
|
|
|
15
15
|
export { GaugeSeries } from './GaugeSeries';
|
|
16
16
|
export type { GaugeSeriesCoord } from './GaugeSeries';
|
|
17
17
|
export { BoxplotSeries } from './BoxplotSeries';
|
|
18
|
+
export { ViolinSeries } from './ViolinSeries';
|
|
19
|
+
export { BeeswarmSeries } from './BeeswarmSeries';
|
|
18
20
|
export { WaterfallSeries } from './WaterfallSeries';
|
|
19
21
|
export { TreemapSeries } from './TreemapSeries';
|
|
20
22
|
export type { TreemapSeriesCoord } from './TreemapSeries';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -48,6 +48,8 @@ export type { FunnelSeriesCoord } from './components/series/FunnelSeries.mjs';
|
|
|
48
48
|
export { GaugeSeries } from './components/series/GaugeSeries.mjs';
|
|
49
49
|
export type { GaugeSeriesCoord } from './components/series/GaugeSeries.mjs';
|
|
50
50
|
export { BoxplotSeries } from './components/series/BoxplotSeries.mjs';
|
|
51
|
+
export { ViolinSeries } from './components/series/ViolinSeries.mjs';
|
|
52
|
+
export { BeeswarmSeries } from './components/series/BeeswarmSeries.mjs';
|
|
51
53
|
export { WaterfallSeries } from './components/series/WaterfallSeries.mjs';
|
|
52
54
|
export { TreemapSeries } from './components/series/TreemapSeries.mjs';
|
|
53
55
|
export type { TreemapSeriesCoord } from './components/series/TreemapSeries.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export type { FunnelSeriesCoord } from './components/series/FunnelSeries';
|
|
|
48
48
|
export { GaugeSeries } from './components/series/GaugeSeries';
|
|
49
49
|
export type { GaugeSeriesCoord } from './components/series/GaugeSeries';
|
|
50
50
|
export { BoxplotSeries } from './components/series/BoxplotSeries';
|
|
51
|
+
export { ViolinSeries } from './components/series/ViolinSeries';
|
|
52
|
+
export { BeeswarmSeries } from './components/series/BeeswarmSeries';
|
|
51
53
|
export { WaterfallSeries } from './components/series/WaterfallSeries';
|
|
52
54
|
export { TreemapSeries } from './components/series/TreemapSeries';
|
|
53
55
|
export type { TreemapSeriesCoord } from './components/series/TreemapSeries';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption } from '../internal.mjs';
|
|
1
|
+
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption, Rect } from '../internal.mjs';
|
|
2
2
|
import type { DataPointParams } from '../types.mjs';
|
|
3
3
|
import type { SeriesBase } from '../components/series/SeriesBase.mjs';
|
|
4
4
|
export interface HitHost {
|
|
@@ -30,12 +30,29 @@ export declare class HitResolver {
|
|
|
30
30
|
constructor(host: HitHost);
|
|
31
31
|
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
32
32
|
isInsidePlot(chartX: number, chartY: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 指针落在第几个面板里(-1 = 不在任何面板内)。
|
|
35
|
+
*
|
|
36
|
+
* 面板矩阵下这是交互的总入口:悬停、框选、缩放、键盘都要先问「在哪块面板」。
|
|
37
|
+
* 没有 `matrix` 时 `layout.panels` 只有一个矩形,等价于从前的 `isInsidePlot`。
|
|
38
|
+
*/
|
|
39
|
+
panelAt(chartX: number, chartY: number): number;
|
|
40
|
+
/** 第几个面板的矩形(越界退回绘图区)。 */
|
|
41
|
+
panelRect(index: number): Rect;
|
|
33
42
|
seriesComponentOf(series: InternalSeries): SeriesBase | null;
|
|
34
43
|
seriesOfComponent(component: any): InternalSeries | null;
|
|
35
44
|
buildActiveItem(series: InternalSeries, dataIndex: number): ActiveItem | null;
|
|
36
45
|
toParams(item: ActiveItem): DataPointParams;
|
|
37
46
|
/** 图表坐标系 x 像素 → 数据列(每个系列各取 x 最近的点)。 */
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* 「同一列」的活动项:轴触发提示框 / 十字准星都按它取数。
|
|
49
|
+
*
|
|
50
|
+
* 面板矩阵下**只收指针所在面板的系列**:否则在第 6 块面板上悬停,提示框会把另外五块的
|
|
51
|
+
* 数据一起列出来(它们 x 值相同但根本不是同一张图)。
|
|
52
|
+
*/
|
|
53
|
+
pickColumn(chartX: number, chartY: number): ActiveColumn | null;
|
|
54
|
+
/** 系列所属面板(越界退回 0)。 */
|
|
55
|
+
seriesPanelOf(series: InternalSeries): number;
|
|
39
56
|
nearestIndexByX(component: SeriesBase, localX: number): number;
|
|
40
57
|
/** 按数据值找最近的点(跨图联动用)。 */
|
|
41
58
|
nearestByXValue(xValue: any): ActiveItem | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption } from '../internal';
|
|
1
|
+
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption, Rect } from '../internal';
|
|
2
2
|
import type { DataPointParams } from '../types';
|
|
3
3
|
import type { SeriesBase } from '../components/series/SeriesBase';
|
|
4
4
|
export interface HitHost {
|
|
@@ -30,12 +30,29 @@ export declare class HitResolver {
|
|
|
30
30
|
constructor(host: HitHost);
|
|
31
31
|
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
32
32
|
isInsidePlot(chartX: number, chartY: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 指针落在第几个面板里(-1 = 不在任何面板内)。
|
|
35
|
+
*
|
|
36
|
+
* 面板矩阵下这是交互的总入口:悬停、框选、缩放、键盘都要先问「在哪块面板」。
|
|
37
|
+
* 没有 `matrix` 时 `layout.panels` 只有一个矩形,等价于从前的 `isInsidePlot`。
|
|
38
|
+
*/
|
|
39
|
+
panelAt(chartX: number, chartY: number): number;
|
|
40
|
+
/** 第几个面板的矩形(越界退回绘图区)。 */
|
|
41
|
+
panelRect(index: number): Rect;
|
|
33
42
|
seriesComponentOf(series: InternalSeries): SeriesBase | null;
|
|
34
43
|
seriesOfComponent(component: any): InternalSeries | null;
|
|
35
44
|
buildActiveItem(series: InternalSeries, dataIndex: number): ActiveItem | null;
|
|
36
45
|
toParams(item: ActiveItem): DataPointParams;
|
|
37
46
|
/** 图表坐标系 x 像素 → 数据列(每个系列各取 x 最近的点)。 */
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* 「同一列」的活动项:轴触发提示框 / 十字准星都按它取数。
|
|
49
|
+
*
|
|
50
|
+
* 面板矩阵下**只收指针所在面板的系列**:否则在第 6 块面板上悬停,提示框会把另外五块的
|
|
51
|
+
* 数据一起列出来(它们 x 值相同但根本不是同一张图)。
|
|
52
|
+
*/
|
|
53
|
+
pickColumn(chartX: number, chartY: number): ActiveColumn | null;
|
|
54
|
+
/** 系列所属面板(越界退回 0)。 */
|
|
55
|
+
seriesPanelOf(series: InternalSeries): number;
|
|
39
56
|
nearestIndexByX(component: SeriesBase, localX: number): number;
|
|
40
57
|
/** 按数据值找最近的点(跨图联动用)。 */
|
|
41
58
|
nearestByXValue(xValue: any): ActiveItem | null;
|
|
@@ -3,6 +3,7 @@ import type { Scale } from './scale.mjs';
|
|
|
3
3
|
import type { SeriesRing } from './util/ring.mjs';
|
|
4
4
|
import type { SeriesChunks } from './util/chunks.mjs';
|
|
5
5
|
import type { ChartLabels } from './types.mjs';
|
|
6
|
+
import type { ResolvedMatrix } from './layout/panels.mjs';
|
|
6
7
|
/** 归一化后的数据点(数据域,不含像素)。 */
|
|
7
8
|
export interface DataPoint {
|
|
8
9
|
/** 系列内下标。 */
|
|
@@ -25,6 +26,26 @@ export interface DataPoint {
|
|
|
25
26
|
size?: number;
|
|
26
27
|
/** 箱线图的 [min, Q1, median, Q3, max]。 */
|
|
27
28
|
boxplot?: [number, number, number, number, number];
|
|
29
|
+
/** 小提琴图的密度轮廓(归一化阶段算好,组件只做像素映射)。 */
|
|
30
|
+
violin?: ViolinProfile;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 小提琴图的密度轮廓。
|
|
34
|
+
*
|
|
35
|
+
* `grid` / `density` 都在**数据空间**里(y 是观测值,密度单位 1/y);
|
|
36
|
+
* 组件负责把它映射成像素轮廓,所以归一化里不需要比例尺 —— 这也是它能单测的原因。
|
|
37
|
+
*/
|
|
38
|
+
export interface ViolinProfile {
|
|
39
|
+
/** 原始观测值(提示框报观测数、与蜂群叠画都读它)。 */
|
|
40
|
+
values: number[];
|
|
41
|
+
/** 实际使用的带宽。 */
|
|
42
|
+
bandwidth: number;
|
|
43
|
+
/** 评估网格(升序)。 */
|
|
44
|
+
grid: number[];
|
|
45
|
+
/** 与 `grid` 一一对应的密度值。 */
|
|
46
|
+
density: number[];
|
|
47
|
+
/** [min, Q1, median, Q3, max],与箱线图同一口径(提示框复用)。 */
|
|
48
|
+
summary: [number, number, number, number, number];
|
|
28
49
|
}
|
|
29
50
|
/** 极坐标布局:圆心与半径(图表坐标系)。 */
|
|
30
51
|
export interface PolarLayout {
|
|
@@ -218,6 +239,11 @@ export interface InternalSeries {
|
|
|
218
239
|
hidden: boolean;
|
|
219
240
|
/** 绑定的 y 轴下标。 */
|
|
220
241
|
axisIndex: number;
|
|
242
|
+
/**
|
|
243
|
+
* 所属面板下标(行优先)。没有 `option.matrix` 时恒为 0 ——
|
|
244
|
+
* 归一化阶段已夹到合法范围,后续按面板取几何的地方可以直接下下标。
|
|
245
|
+
*/
|
|
246
|
+
panel: number;
|
|
221
247
|
/**
|
|
222
248
|
* 归一化后的瀑布图配置(系列级优先,其次顶层 `option.waterfall`)。
|
|
223
249
|
*
|
|
@@ -367,6 +393,8 @@ export interface InternalAxis {
|
|
|
367
393
|
categoryOffset?: number;
|
|
368
394
|
}
|
|
369
395
|
export interface NormalizedOption {
|
|
396
|
+
/** 面板矩阵(小倍数):null = 单绘图区(现有行为)。 */
|
|
397
|
+
matrix: ResolvedMatrix | null;
|
|
370
398
|
/** 场景类型:直角坐标 / 极坐标(饼图)/ 雷达图 / 桑基图。 */
|
|
371
399
|
kind: 'cartesian' | 'polar' | 'radar' | 'sankey' | 'funnel' | 'gauge' | 'liquid' | 'treemap' | 'graph';
|
|
372
400
|
/**
|
|
@@ -461,6 +489,9 @@ export interface AxisLayout {
|
|
|
461
489
|
}
|
|
462
490
|
export interface ChartLayout {
|
|
463
491
|
canvas: Rect;
|
|
492
|
+
/** 面板矩阵的各面板矩形(行优先)。没有 `option.matrix` 时就是 `[plot]`。 */
|
|
493
|
+
panels: Rect[];
|
|
494
|
+
/** 绘图区;有面板矩阵时是**面板的并集**(无 matrix 时与 `panels[0]` 逐像素相同)。 */
|
|
464
495
|
plot: Rect;
|
|
465
496
|
titleRect: Rect | null;
|
|
466
497
|
legendRect: Rect | null;
|
|
@@ -532,6 +563,8 @@ export interface ActiveColumn {
|
|
|
532
563
|
xValue: any;
|
|
533
564
|
/** 图表坐标系内的 x 像素。 */
|
|
534
565
|
pixelX: number;
|
|
566
|
+
/** 这一列属于哪个面板(没有面板矩阵时恒为 0)。 */
|
|
567
|
+
panel: number;
|
|
535
568
|
items: ActiveItem[];
|
|
536
569
|
}
|
|
537
570
|
export type HoverState = {
|