@damoqiongqiu/ice-chart 0.17.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/LICENSE +21 -0
- package/README.md +530 -0
- package/dist/index.cjs +25 -0
- package/dist/index.mjs +25 -0
- package/dist/index.umd.js +25 -0
- package/dist/types/ICEChart.d.mts +330 -0
- package/dist/types/ICEChart.d.ts +330 -0
- package/dist/types/a11y.d.mts +85 -0
- package/dist/types/a11y.d.ts +85 -0
- package/dist/types/animation/motion.d.mts +11 -0
- package/dist/types/animation/motion.d.ts +11 -0
- package/dist/types/components/Axis.d.mts +60 -0
- package/dist/types/components/Axis.d.ts +60 -0
- package/dist/types/components/Brush.d.mts +19 -0
- package/dist/types/components/Brush.d.ts +19 -0
- package/dist/types/components/ChartComponent.d.mts +48 -0
- package/dist/types/components/ChartComponent.d.ts +48 -0
- package/dist/types/components/Crosshair.d.mts +40 -0
- package/dist/types/components/Crosshair.d.ts +40 -0
- package/dist/types/components/DataZoomSlider.d.mts +30 -0
- package/dist/types/components/DataZoomSlider.d.ts +30 -0
- package/dist/types/components/GridLines.d.mts +37 -0
- package/dist/types/components/GridLines.d.ts +37 -0
- package/dist/types/components/Highlight.d.mts +34 -0
- package/dist/types/components/Highlight.d.ts +34 -0
- package/dist/types/components/Legend.d.mts +26 -0
- package/dist/types/components/Legend.d.ts +26 -0
- package/dist/types/components/PlotArea.d.mts +21 -0
- package/dist/types/components/PlotArea.d.ts +21 -0
- package/dist/types/components/PolarGrid.d.mts +34 -0
- package/dist/types/components/PolarGrid.d.ts +34 -0
- package/dist/types/components/RadarGrid.d.mts +25 -0
- package/dist/types/components/RadarGrid.d.ts +25 -0
- package/dist/types/components/Title.d.mts +14 -0
- package/dist/types/components/Title.d.ts +14 -0
- package/dist/types/components/Tooltip.d.mts +48 -0
- package/dist/types/components/Tooltip.d.ts +48 -0
- package/dist/types/components/series/AreaSeries.d.mts +14 -0
- package/dist/types/components/series/AreaSeries.d.ts +14 -0
- package/dist/types/components/series/BarSeries.d.mts +39 -0
- package/dist/types/components/series/BarSeries.d.ts +39 -0
- package/dist/types/components/series/BoxplotSeries.d.mts +16 -0
- package/dist/types/components/series/BoxplotSeries.d.ts +16 -0
- package/dist/types/components/series/CandlestickSeries.d.mts +13 -0
- package/dist/types/components/series/CandlestickSeries.d.ts +13 -0
- package/dist/types/components/series/CurveSeriesBase.d.mts +58 -0
- package/dist/types/components/series/CurveSeriesBase.d.ts +58 -0
- package/dist/types/components/series/FunctionSeries.d.mts +22 -0
- package/dist/types/components/series/FunctionSeries.d.ts +22 -0
- package/dist/types/components/series/FunnelSeries.d.mts +38 -0
- package/dist/types/components/series/FunnelSeries.d.ts +38 -0
- package/dist/types/components/series/GaugeSeries.d.mts +45 -0
- package/dist/types/components/series/GaugeSeries.d.ts +45 -0
- package/dist/types/components/series/GraphSeries.d.mts +39 -0
- package/dist/types/components/series/GraphSeries.d.ts +39 -0
- package/dist/types/components/series/HeatmapSeries.d.mts +21 -0
- package/dist/types/components/series/HeatmapSeries.d.ts +21 -0
- package/dist/types/components/series/LineSeries.d.mts +31 -0
- package/dist/types/components/series/LineSeries.d.ts +31 -0
- package/dist/types/components/series/LiquidSeries.d.mts +55 -0
- package/dist/types/components/series/LiquidSeries.d.ts +55 -0
- package/dist/types/components/series/ParametricSeries.d.mts +30 -0
- package/dist/types/components/series/ParametricSeries.d.ts +30 -0
- package/dist/types/components/series/PieSeries.d.mts +44 -0
- package/dist/types/components/series/PieSeries.d.ts +44 -0
- package/dist/types/components/series/RadarSeries.d.mts +30 -0
- package/dist/types/components/series/RadarSeries.d.ts +30 -0
- package/dist/types/components/series/SankeySeries.d.mts +34 -0
- package/dist/types/components/series/SankeySeries.d.ts +34 -0
- package/dist/types/components/series/ScatterSeries.d.mts +11 -0
- package/dist/types/components/series/ScatterSeries.d.ts +11 -0
- package/dist/types/components/series/SeriesBase.d.mts +214 -0
- package/dist/types/components/series/SeriesBase.d.ts +214 -0
- package/dist/types/components/series/TreemapSeries.d.mts +48 -0
- package/dist/types/components/series/TreemapSeries.d.ts +48 -0
- package/dist/types/components/series/WaterfallSeries.d.mts +17 -0
- package/dist/types/components/series/WaterfallSeries.d.ts +17 -0
- package/dist/types/components/series/createSeries.d.mts +10 -0
- package/dist/types/components/series/createSeries.d.ts +10 -0
- package/dist/types/components/series/index.d.mts +29 -0
- package/dist/types/components/series/index.d.ts +29 -0
- package/dist/types/expr/diagnostics.d.mts +45 -0
- package/dist/types/expr/diagnostics.d.ts +45 -0
- package/dist/types/expr/expr.d.mts +44 -0
- package/dist/types/expr/expr.d.ts +44 -0
- package/dist/types/expr/sample.d.mts +34 -0
- package/dist/types/expr/sample.d.ts +34 -0
- package/dist/types/index.d.mts +80 -0
- package/dist/types/index.d.ts +80 -0
- package/dist/types/interaction/ChartLink.d.mts +16 -0
- package/dist/types/interaction/ChartLink.d.ts +16 -0
- package/dist/types/interaction/HitResolver.d.mts +44 -0
- package/dist/types/interaction/HitResolver.d.ts +44 -0
- package/dist/types/interaction/InteractionController.d.mts +147 -0
- package/dist/types/interaction/InteractionController.d.ts +147 -0
- package/dist/types/internal.d.mts +232 -0
- package/dist/types/internal.d.ts +232 -0
- package/dist/types/layout/force.d.mts +48 -0
- package/dist/types/layout/force.d.ts +48 -0
- package/dist/types/layout/layout.d.mts +9 -0
- package/dist/types/layout/layout.d.ts +9 -0
- package/dist/types/layout/sankey.d.mts +47 -0
- package/dist/types/layout/sankey.d.ts +47 -0
- package/dist/types/layout/treemap.d.mts +35 -0
- package/dist/types/layout/treemap.d.ts +35 -0
- package/dist/types/option/normalize.d.mts +68 -0
- package/dist/types/option/normalize.d.ts +68 -0
- package/dist/types/scale/BandScale.d.mts +36 -0
- package/dist/types/scale/BandScale.d.ts +36 -0
- package/dist/types/scale/LinearScale.d.mts +21 -0
- package/dist/types/scale/LinearScale.d.ts +21 -0
- package/dist/types/scale/LogScale.d.mts +24 -0
- package/dist/types/scale/LogScale.d.ts +24 -0
- package/dist/types/scale/Scale.d.mts +38 -0
- package/dist/types/scale/Scale.d.ts +38 -0
- package/dist/types/scale/TimeScale.d.mts +28 -0
- package/dist/types/scale/TimeScale.d.ts +28 -0
- package/dist/types/scale/format.d.mts +5 -0
- package/dist/types/scale/format.d.ts +5 -0
- package/dist/types/scale/index.d.mts +7 -0
- package/dist/types/scale/index.d.ts +7 -0
- package/dist/types/theme/chartTheme.d.mts +54 -0
- package/dist/types/theme/chartTheme.d.ts +54 -0
- package/dist/types/types.d.mts +689 -0
- package/dist/types/types.d.ts +689 -0
- package/dist/types/util/emitter.d.mts +11 -0
- package/dist/types/util/emitter.d.ts +11 -0
- package/dist/types/util/math.d.mts +14 -0
- package/dist/types/util/math.d.ts +14 -0
- package/dist/types/util/text.d.mts +10 -0
- package/dist/types/util/text.d.ts +10 -0
- package/package.json +100 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 曲线采样:均匀打底 + 按曲率自适应细分。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不能只均匀采样:`tan(x)` 在极点附近、`exp(-x^2)` 在峰顶附近,
|
|
5
|
+
* 均匀采样的折线要么「削平峰顶」要么「漏掉极点」。自适应细分只在折线与真实曲线
|
|
6
|
+
* 偏差大的地方加点,点数可控(有 maxSamples 上限,不会因为奇异点爆掉)。
|
|
7
|
+
*
|
|
8
|
+
* 非有限值(NaN / ±Inf / 过大)一律写成 `[x, NaN]` 作为**断点**,
|
|
9
|
+
* 渲染时按断点分段 —— 这样 `tan(x)`、`1/x` 会画出真正的渐近线缺口,而不是连一条竖线。
|
|
10
|
+
*/
|
|
11
|
+
export interface SampleOptions {
|
|
12
|
+
/** 基础均匀采样点数(至少 2),默认 240。 */
|
|
13
|
+
base?: number;
|
|
14
|
+
/** 是否做自适应细分,默认 true。 */
|
|
15
|
+
adaptive?: boolean;
|
|
16
|
+
/** 相对 y 跨度的偏差阈值:越小越精细,默认 0.0025。 */
|
|
17
|
+
tolerance?: number;
|
|
18
|
+
/** 采样点总数上限,默认 6000(奇异点附近会疯狂细分,必须有闸)。 */
|
|
19
|
+
maxSamples?: number;
|
|
20
|
+
/** 递归深度上限,默认 7。 */
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
}
|
|
23
|
+
export type CurvePoint = [number, number];
|
|
24
|
+
/**
|
|
25
|
+
* 稳健取值范围:用四分位距(IQR)丢掉离群点。
|
|
26
|
+
*
|
|
27
|
+
* 为什么不用 min/max:`1/x`、`tan(x)` 的尖峰能把 y 轴拉到 ±2500,
|
|
28
|
+
* 整条曲线会被压成一条直线。用 IQR 之外的数值剪掉之后,画面才像 MATLAB。
|
|
29
|
+
*/
|
|
30
|
+
export declare function robustRange(values: number[], k?: number): [number, number];
|
|
31
|
+
/** 采样 y = f(x)。返回按 x 升序的点列,断点用 y = NaN 表示。 */
|
|
32
|
+
export declare function sampleFunctionCurve(fn: (x: number) => number, x0: number, x1: number, options?: SampleOptions): CurvePoint[];
|
|
33
|
+
/** 采样参数曲线 (x(t), y(t)):偏差按平面距离算(曲线可能拐回来,不能只看 y)。 */
|
|
34
|
+
export declare function sampleParametricCurve(fx: (t: number) => number, fy: (t: number) => number, t0: number, t1: number, options?: SampleOptions): CurvePoint[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ice-chart —— 构建在 ice-render 之上的交互式图表库。
|
|
3
|
+
*
|
|
4
|
+
* 与「把数据画成图」的图表库不同,ice-chart 把 ice-render 的事件系统、命中测试、
|
|
5
|
+
* 嵌套坐标系与脏矩形局部重绘当作一等能力:悬停、点击下钻、框选、缩放平移、
|
|
6
|
+
* 图例联动、跨图联动、键盘导航都是内建能力。
|
|
7
|
+
*/
|
|
8
|
+
export { ICEChart, createChart, computeBarSlots, isChartSnapshot, mergeOptionPatch, SNAPSHOT_VERSION, setMotionPreference, getMotionPreference, shouldAnimate, } from './ICEChart.mjs';
|
|
9
|
+
export type { ICEChartOptions, ApplyOptionOptions, ChartSnapshot, SnapshotRestoreOptions, MotionPreference, } from './ICEChart.mjs';
|
|
10
|
+
export type { ChartOption, ChartEventName, ChartEventHandler, ChartEventPayloads, ChartTheme, ChartLinkOption, AxisOption, SeriesOption, SeriesType, ScaleType, LegendOption, TooltipOption, TooltipParams, CrosshairOption, GridOption, DataZoomOption, InteractionOption, AnimationOption, AnimationStageOption, DataPointParams, BrushRange, ZoomRange, LegendToggleParams, DataItem, SweepOption, LiquidOption, PolarGridOption, } from './types.mjs';
|
|
11
|
+
export { LIGHT_CHART_THEME, DARK_CHART_THEME, BOOTSTRAP_CHART_THEME, BOOTSTRAP_DARK_CHART_THEME, BOOTSTRAP_TOKENS, resolveChartTheme, } from './theme/chartTheme.mjs';
|
|
12
|
+
export { createScale, formatTick, formatNumberTick, LinearScale, BandScale, TimeScale, LogScale } from './scale.mjs';
|
|
13
|
+
export type { Scale, CreateScaleOptions } from './scale.mjs';
|
|
14
|
+
export { normalizeOption, toSerializableOption, normalizeAnimation, DEFAULT_ANIMATION_STAGES } from './option/normalize.mjs';
|
|
15
|
+
export type { NormalizeContext } from './option/normalize.mjs';
|
|
16
|
+
export { computeLayout } from './layout/layout.mjs';
|
|
17
|
+
export type { DataPoint, InternalSeries, InternalAxis, NormalizedOption, ChartLayout, Rect, LegendItemLayout } from './internal.mjs';
|
|
18
|
+
export { ChartComponent } from './components/ChartComponent.mjs';
|
|
19
|
+
export { PlotArea } from './components/PlotArea.mjs';
|
|
20
|
+
export { GridLines } from './components/GridLines.mjs';
|
|
21
|
+
export { Axis } from './components/Axis.mjs';
|
|
22
|
+
export { Legend, roundRect } from './components/Legend.mjs';
|
|
23
|
+
export { Title } from './components/Title.mjs';
|
|
24
|
+
export { Tooltip } from './components/Tooltip.mjs';
|
|
25
|
+
export { Crosshair } from './components/Crosshair.mjs';
|
|
26
|
+
export { Highlight } from './components/Highlight.mjs';
|
|
27
|
+
export { Brush } from './components/Brush.mjs';
|
|
28
|
+
export { SeriesBase } from './components/series/SeriesBase.mjs';
|
|
29
|
+
export type { SeriesCoord, BarSlot } from './components/series/SeriesBase.mjs';
|
|
30
|
+
export { LineSeries } from './components/series/LineSeries.mjs';
|
|
31
|
+
export { AreaSeries } from './components/series/AreaSeries.mjs';
|
|
32
|
+
export { BarSeries } from './components/series/BarSeries.mjs';
|
|
33
|
+
export { ScatterSeries } from './components/series/ScatterSeries.mjs';
|
|
34
|
+
export { PieSeries } from './components/series/PieSeries.mjs';
|
|
35
|
+
export type { PolarSeriesCoord } from './components/series/PieSeries.mjs';
|
|
36
|
+
export { RadarSeries } from './components/series/RadarSeries.mjs';
|
|
37
|
+
export type { RadarSeriesCoord } from './components/series/RadarSeries.mjs';
|
|
38
|
+
export { CandlestickSeries } from './components/series/CandlestickSeries.mjs';
|
|
39
|
+
export { HeatmapSeries, mixColors } from './components/series/HeatmapSeries.mjs';
|
|
40
|
+
export { SankeySeries } from './components/series/SankeySeries.mjs';
|
|
41
|
+
export type { SankeySeriesCoord } from './components/series/SankeySeries.mjs';
|
|
42
|
+
export { FunnelSeries } from './components/series/FunnelSeries.mjs';
|
|
43
|
+
export type { FunnelSeriesCoord } from './components/series/FunnelSeries.mjs';
|
|
44
|
+
export { GaugeSeries } from './components/series/GaugeSeries.mjs';
|
|
45
|
+
export type { GaugeSeriesCoord } from './components/series/GaugeSeries.mjs';
|
|
46
|
+
export { BoxplotSeries } from './components/series/BoxplotSeries.mjs';
|
|
47
|
+
export { WaterfallSeries } from './components/series/WaterfallSeries.mjs';
|
|
48
|
+
export { TreemapSeries } from './components/series/TreemapSeries.mjs';
|
|
49
|
+
export type { TreemapSeriesCoord } from './components/series/TreemapSeries.mjs';
|
|
50
|
+
export { layoutTreemap } from './layout/treemap.mjs';
|
|
51
|
+
export type { TreemapNodeLayout, TreemapInputNode } from './layout/treemap.mjs';
|
|
52
|
+
export { GraphSeries } from './components/series/GraphSeries.mjs';
|
|
53
|
+
export type { GraphSeriesCoord } from './components/series/GraphSeries.mjs';
|
|
54
|
+
export { CurveSeriesBase } from './components/series/CurveSeriesBase.mjs';
|
|
55
|
+
export { FunctionSeries } from './components/series/FunctionSeries.mjs';
|
|
56
|
+
export { ParametricSeries } from './components/series/ParametricSeries.mjs';
|
|
57
|
+
export { LiquidSeries } from './components/series/LiquidSeries.mjs';
|
|
58
|
+
export type { LiquidSeriesCoord } from './components/series/LiquidSeries.mjs';
|
|
59
|
+
export { compileExpression, compileSampler, evaluateExpression, ExpressionError } from './expr/expr.mjs';
|
|
60
|
+
export type { CompiledExpression, CompiledSampler, ExpressionErrorCode } from './expr/expr.mjs';
|
|
61
|
+
export { diagnoseExpression, errorsOf, warningsOf } from './expr/diagnostics.mjs';
|
|
62
|
+
export type { ExpressionDiagnostic, ExpressionDiagnosticCode, DiagnoseExpressionOptions } from './expr/diagnostics.mjs';
|
|
63
|
+
export { sampleFunctionCurve, sampleParametricCurve, robustRange } from './expr/sample.mjs';
|
|
64
|
+
export type { CurvePoint, SampleOptions } from './expr/sample.mjs';
|
|
65
|
+
export { forceLayout, sampleGraphLink } from './layout/force.mjs';
|
|
66
|
+
export type { ForceNodeLayout, ForceLinkLayout, ForceLayoutResult } from './layout/force.mjs';
|
|
67
|
+
export { computeBoxplotSummary } from './option/normalize.mjs';
|
|
68
|
+
export { layoutSankey, sampleLinkPath } from './layout/sankey.mjs';
|
|
69
|
+
export type { SankeyNodeLayout, SankeyLinkLayout, SankeyLayoutResult } from './layout/sankey.mjs';
|
|
70
|
+
export { RadarGrid } from './components/RadarGrid.mjs';
|
|
71
|
+
export type { RadarGridCoord } from './components/RadarGrid.mjs';
|
|
72
|
+
export { createSeriesComponent } from './components/series/createSeries.mjs';
|
|
73
|
+
export { InteractionController } from './interaction/InteractionController.mjs';
|
|
74
|
+
export type { InteractionHost } from './interaction/InteractionController.mjs';
|
|
75
|
+
export { HitResolver } from './interaction/HitResolver.mjs';
|
|
76
|
+
export { linkCharts } from './interaction/ChartLink.mjs';
|
|
77
|
+
export type { ChartLinkHandle } from './interaction/ChartLink.mjs';
|
|
78
|
+
export { Emitter } from './util/emitter.mjs';
|
|
79
|
+
export { A11yMirror, buildDataTable, buildDataNodes, chartTitle, VISUALLY_HIDDEN_STYLE, SERIES_ROLE_HINT } from './a11y.mjs';
|
|
80
|
+
export type { DataTable, A11yDataNode, A11yTreeOptions, A11yChartLike } from './a11y.mjs';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ice-chart —— 构建在 ice-render 之上的交互式图表库。
|
|
3
|
+
*
|
|
4
|
+
* 与「把数据画成图」的图表库不同,ice-chart 把 ice-render 的事件系统、命中测试、
|
|
5
|
+
* 嵌套坐标系与脏矩形局部重绘当作一等能力:悬停、点击下钻、框选、缩放平移、
|
|
6
|
+
* 图例联动、跨图联动、键盘导航都是内建能力。
|
|
7
|
+
*/
|
|
8
|
+
export { ICEChart, createChart, computeBarSlots, isChartSnapshot, mergeOptionPatch, SNAPSHOT_VERSION, setMotionPreference, getMotionPreference, shouldAnimate, } from './ICEChart';
|
|
9
|
+
export type { ICEChartOptions, ApplyOptionOptions, ChartSnapshot, SnapshotRestoreOptions, MotionPreference, } from './ICEChart';
|
|
10
|
+
export type { ChartOption, ChartEventName, ChartEventHandler, ChartEventPayloads, ChartTheme, ChartLinkOption, AxisOption, SeriesOption, SeriesType, ScaleType, LegendOption, TooltipOption, TooltipParams, CrosshairOption, GridOption, DataZoomOption, InteractionOption, AnimationOption, AnimationStageOption, DataPointParams, BrushRange, ZoomRange, LegendToggleParams, DataItem, SweepOption, LiquidOption, PolarGridOption, } from './types';
|
|
11
|
+
export { LIGHT_CHART_THEME, DARK_CHART_THEME, BOOTSTRAP_CHART_THEME, BOOTSTRAP_DARK_CHART_THEME, BOOTSTRAP_TOKENS, resolveChartTheme, } from './theme/chartTheme';
|
|
12
|
+
export { createScale, formatTick, formatNumberTick, LinearScale, BandScale, TimeScale, LogScale } from './scale';
|
|
13
|
+
export type { Scale, CreateScaleOptions } from './scale';
|
|
14
|
+
export { normalizeOption, toSerializableOption, normalizeAnimation, DEFAULT_ANIMATION_STAGES } from './option/normalize';
|
|
15
|
+
export type { NormalizeContext } from './option/normalize';
|
|
16
|
+
export { computeLayout } from './layout/layout';
|
|
17
|
+
export type { DataPoint, InternalSeries, InternalAxis, NormalizedOption, ChartLayout, Rect, LegendItemLayout } from './internal';
|
|
18
|
+
export { ChartComponent } from './components/ChartComponent';
|
|
19
|
+
export { PlotArea } from './components/PlotArea';
|
|
20
|
+
export { GridLines } from './components/GridLines';
|
|
21
|
+
export { Axis } from './components/Axis';
|
|
22
|
+
export { Legend, roundRect } from './components/Legend';
|
|
23
|
+
export { Title } from './components/Title';
|
|
24
|
+
export { Tooltip } from './components/Tooltip';
|
|
25
|
+
export { Crosshair } from './components/Crosshair';
|
|
26
|
+
export { Highlight } from './components/Highlight';
|
|
27
|
+
export { Brush } from './components/Brush';
|
|
28
|
+
export { SeriesBase } from './components/series/SeriesBase';
|
|
29
|
+
export type { SeriesCoord, BarSlot } from './components/series/SeriesBase';
|
|
30
|
+
export { LineSeries } from './components/series/LineSeries';
|
|
31
|
+
export { AreaSeries } from './components/series/AreaSeries';
|
|
32
|
+
export { BarSeries } from './components/series/BarSeries';
|
|
33
|
+
export { ScatterSeries } from './components/series/ScatterSeries';
|
|
34
|
+
export { PieSeries } from './components/series/PieSeries';
|
|
35
|
+
export type { PolarSeriesCoord } from './components/series/PieSeries';
|
|
36
|
+
export { RadarSeries } from './components/series/RadarSeries';
|
|
37
|
+
export type { RadarSeriesCoord } from './components/series/RadarSeries';
|
|
38
|
+
export { CandlestickSeries } from './components/series/CandlestickSeries';
|
|
39
|
+
export { HeatmapSeries, mixColors } from './components/series/HeatmapSeries';
|
|
40
|
+
export { SankeySeries } from './components/series/SankeySeries';
|
|
41
|
+
export type { SankeySeriesCoord } from './components/series/SankeySeries';
|
|
42
|
+
export { FunnelSeries } from './components/series/FunnelSeries';
|
|
43
|
+
export type { FunnelSeriesCoord } from './components/series/FunnelSeries';
|
|
44
|
+
export { GaugeSeries } from './components/series/GaugeSeries';
|
|
45
|
+
export type { GaugeSeriesCoord } from './components/series/GaugeSeries';
|
|
46
|
+
export { BoxplotSeries } from './components/series/BoxplotSeries';
|
|
47
|
+
export { WaterfallSeries } from './components/series/WaterfallSeries';
|
|
48
|
+
export { TreemapSeries } from './components/series/TreemapSeries';
|
|
49
|
+
export type { TreemapSeriesCoord } from './components/series/TreemapSeries';
|
|
50
|
+
export { layoutTreemap } from './layout/treemap';
|
|
51
|
+
export type { TreemapNodeLayout, TreemapInputNode } from './layout/treemap';
|
|
52
|
+
export { GraphSeries } from './components/series/GraphSeries';
|
|
53
|
+
export type { GraphSeriesCoord } from './components/series/GraphSeries';
|
|
54
|
+
export { CurveSeriesBase } from './components/series/CurveSeriesBase';
|
|
55
|
+
export { FunctionSeries } from './components/series/FunctionSeries';
|
|
56
|
+
export { ParametricSeries } from './components/series/ParametricSeries';
|
|
57
|
+
export { LiquidSeries } from './components/series/LiquidSeries';
|
|
58
|
+
export type { LiquidSeriesCoord } from './components/series/LiquidSeries';
|
|
59
|
+
export { compileExpression, compileSampler, evaluateExpression, ExpressionError } from './expr/expr';
|
|
60
|
+
export type { CompiledExpression, CompiledSampler, ExpressionErrorCode } from './expr/expr';
|
|
61
|
+
export { diagnoseExpression, errorsOf, warningsOf } from './expr/diagnostics';
|
|
62
|
+
export type { ExpressionDiagnostic, ExpressionDiagnosticCode, DiagnoseExpressionOptions } from './expr/diagnostics';
|
|
63
|
+
export { sampleFunctionCurve, sampleParametricCurve, robustRange } from './expr/sample';
|
|
64
|
+
export type { CurvePoint, SampleOptions } from './expr/sample';
|
|
65
|
+
export { forceLayout, sampleGraphLink } from './layout/force';
|
|
66
|
+
export type { ForceNodeLayout, ForceLinkLayout, ForceLayoutResult } from './layout/force';
|
|
67
|
+
export { computeBoxplotSummary } from './option/normalize';
|
|
68
|
+
export { layoutSankey, sampleLinkPath } from './layout/sankey';
|
|
69
|
+
export type { SankeyNodeLayout, SankeyLinkLayout, SankeyLayoutResult } from './layout/sankey';
|
|
70
|
+
export { RadarGrid } from './components/RadarGrid';
|
|
71
|
+
export type { RadarGridCoord } from './components/RadarGrid';
|
|
72
|
+
export { createSeriesComponent } from './components/series/createSeries';
|
|
73
|
+
export { InteractionController } from './interaction/InteractionController';
|
|
74
|
+
export type { InteractionHost } from './interaction/InteractionController';
|
|
75
|
+
export { HitResolver } from './interaction/HitResolver';
|
|
76
|
+
export { linkCharts } from './interaction/ChartLink';
|
|
77
|
+
export type { ChartLinkHandle } from './interaction/ChartLink';
|
|
78
|
+
export { Emitter } from './util/emitter';
|
|
79
|
+
export { A11yMirror, buildDataTable, buildDataNodes, chartTitle, VISUALLY_HIDDEN_STYLE, SERIES_ROLE_HINT } from './a11y';
|
|
80
|
+
export type { DataTable, A11yDataNode, A11yTreeOptions, A11yChartLike } from './a11y';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChartLinkOption } from '../types.mjs';
|
|
2
|
+
import type { ICEChart } from '../ICEChart.mjs';
|
|
3
|
+
export interface ChartLinkHandle {
|
|
4
|
+
charts: ICEChart[];
|
|
5
|
+
unlink(): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 多图联动:一组图表共享「悬停列 / 缩放窗口 / 刷选范围」。
|
|
9
|
+
*
|
|
10
|
+
* 实现刻意只用**公开的语义事件**(item:hover / zoom:change / pan:change / brush:end),
|
|
11
|
+
* 因此:
|
|
12
|
+
* - 任何抛出这些事件的图表都能加入联动,不依赖内部实现细节;
|
|
13
|
+
* - 联动是应用层可组合的能力,不需要全局单例;
|
|
14
|
+
* - 按 x 数据值(而不是像素)联动,不同尺寸 / 不同数据范围的图表也能对齐。
|
|
15
|
+
*/
|
|
16
|
+
export declare function linkCharts(charts: ICEChart[], option?: ChartLinkOption): ChartLinkHandle;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChartLinkOption } from '../types';
|
|
2
|
+
import type { ICEChart } from '../ICEChart';
|
|
3
|
+
export interface ChartLinkHandle {
|
|
4
|
+
charts: ICEChart[];
|
|
5
|
+
unlink(): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 多图联动:一组图表共享「悬停列 / 缩放窗口 / 刷选范围」。
|
|
9
|
+
*
|
|
10
|
+
* 实现刻意只用**公开的语义事件**(item:hover / zoom:change / pan:change / brush:end),
|
|
11
|
+
* 因此:
|
|
12
|
+
* - 任何抛出这些事件的图表都能加入联动,不依赖内部实现细节;
|
|
13
|
+
* - 联动是应用层可组合的能力,不需要全局单例;
|
|
14
|
+
* - 按 x 数据值(而不是像素)联动,不同尺寸 / 不同数据范围的图表也能对齐。
|
|
15
|
+
*/
|
|
16
|
+
export declare function linkCharts(charts: ICEChart[], option?: ChartLinkOption): ChartLinkHandle;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption } from '../internal.mjs';
|
|
2
|
+
import type { DataPointParams } from '../types.mjs';
|
|
3
|
+
import type { SeriesBase } from '../components/series/SeriesBase.mjs';
|
|
4
|
+
export interface HitHost {
|
|
5
|
+
ice: any;
|
|
6
|
+
norm: NormalizedOption;
|
|
7
|
+
layout: ChartLayout;
|
|
8
|
+
plotArea: any;
|
|
9
|
+
legend: any;
|
|
10
|
+
seriesComponents: SeriesBase[];
|
|
11
|
+
}
|
|
12
|
+
export interface TargetInfo {
|
|
13
|
+
kind: 'none' | 'plot' | 'series' | 'legend' | 'other';
|
|
14
|
+
component: any;
|
|
15
|
+
index: number;
|
|
16
|
+
/** 组件本地坐标。 */
|
|
17
|
+
local: [number, number];
|
|
18
|
+
/** 图表坐标系(画布左上角为原点)坐标。 */
|
|
19
|
+
chart: [number, number];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 命中解析:把「屏幕像素」翻译成「哪个组件的哪个数据项」。
|
|
23
|
+
*
|
|
24
|
+
* 关键点是**复用引擎的命中测试**(`ice.hitTest`)而不是自己遍历数据:
|
|
25
|
+
* 遮挡关系、zIndex、display:false、interactive:false 等语义全部由引擎统一保证,
|
|
26
|
+
* ice-chart 只负责把组件本地坐标进一步翻译成数据下标。
|
|
27
|
+
*/
|
|
28
|
+
export declare class HitResolver {
|
|
29
|
+
private host;
|
|
30
|
+
constructor(host: HitHost);
|
|
31
|
+
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
32
|
+
isInsidePlot(chartX: number, chartY: number): boolean;
|
|
33
|
+
seriesComponentOf(series: InternalSeries): SeriesBase | null;
|
|
34
|
+
seriesOfComponent(component: any): InternalSeries | null;
|
|
35
|
+
buildActiveItem(series: InternalSeries, dataIndex: number): ActiveItem | null;
|
|
36
|
+
toParams(item: ActiveItem): DataPointParams;
|
|
37
|
+
/** 图表坐标系 x 像素 → 数据列(每个系列各取 x 最近的点)。 */
|
|
38
|
+
pickColumn(chartX: number): ActiveColumn | null;
|
|
39
|
+
nearestIndexByX(component: SeriesBase, localX: number): number;
|
|
40
|
+
/** 按数据值找最近的点(跨图联动用)。 */
|
|
41
|
+
nearestByXValue(xValue: any): ActiveItem | null;
|
|
42
|
+
}
|
|
43
|
+
/** 两个 x 数据值的距离;不可比时返回 null。 */
|
|
44
|
+
export declare function valueDistance(a: any, b: any): number | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ActiveColumn, ActiveItem, ChartLayout, InternalSeries, NormalizedOption } from '../internal';
|
|
2
|
+
import type { DataPointParams } from '../types';
|
|
3
|
+
import type { SeriesBase } from '../components/series/SeriesBase';
|
|
4
|
+
export interface HitHost {
|
|
5
|
+
ice: any;
|
|
6
|
+
norm: NormalizedOption;
|
|
7
|
+
layout: ChartLayout;
|
|
8
|
+
plotArea: any;
|
|
9
|
+
legend: any;
|
|
10
|
+
seriesComponents: SeriesBase[];
|
|
11
|
+
}
|
|
12
|
+
export interface TargetInfo {
|
|
13
|
+
kind: 'none' | 'plot' | 'series' | 'legend' | 'other';
|
|
14
|
+
component: any;
|
|
15
|
+
index: number;
|
|
16
|
+
/** 组件本地坐标。 */
|
|
17
|
+
local: [number, number];
|
|
18
|
+
/** 图表坐标系(画布左上角为原点)坐标。 */
|
|
19
|
+
chart: [number, number];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 命中解析:把「屏幕像素」翻译成「哪个组件的哪个数据项」。
|
|
23
|
+
*
|
|
24
|
+
* 关键点是**复用引擎的命中测试**(`ice.hitTest`)而不是自己遍历数据:
|
|
25
|
+
* 遮挡关系、zIndex、display:false、interactive:false 等语义全部由引擎统一保证,
|
|
26
|
+
* ice-chart 只负责把组件本地坐标进一步翻译成数据下标。
|
|
27
|
+
*/
|
|
28
|
+
export declare class HitResolver {
|
|
29
|
+
private host;
|
|
30
|
+
constructor(host: HitHost);
|
|
31
|
+
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
32
|
+
isInsidePlot(chartX: number, chartY: number): boolean;
|
|
33
|
+
seriesComponentOf(series: InternalSeries): SeriesBase | null;
|
|
34
|
+
seriesOfComponent(component: any): InternalSeries | null;
|
|
35
|
+
buildActiveItem(series: InternalSeries, dataIndex: number): ActiveItem | null;
|
|
36
|
+
toParams(item: ActiveItem): DataPointParams;
|
|
37
|
+
/** 图表坐标系 x 像素 → 数据列(每个系列各取 x 最近的点)。 */
|
|
38
|
+
pickColumn(chartX: number): ActiveColumn | null;
|
|
39
|
+
nearestIndexByX(component: SeriesBase, localX: number): number;
|
|
40
|
+
/** 按数据值找最近的点(跨图联动用)。 */
|
|
41
|
+
nearestByXValue(xValue: any): ActiveItem | null;
|
|
42
|
+
}
|
|
43
|
+
/** 两个 x 数据值的距离;不可比时返回 null。 */
|
|
44
|
+
export declare function valueDistance(a: any, b: any): number | null;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { ActiveColumn, ActiveItem } from '../internal.mjs';
|
|
2
|
+
import type { DataPointParams } from '../types.mjs';
|
|
3
|
+
import type { Crosshair } from '../components/Crosshair.mjs';
|
|
4
|
+
import type { Highlight } from '../components/Highlight.mjs';
|
|
5
|
+
import type { Brush } from '../components/Brush.mjs';
|
|
6
|
+
import type { DataZoomSlider } from '../components/DataZoomSlider.mjs';
|
|
7
|
+
import type { Legend } from '../components/Legend.mjs';
|
|
8
|
+
import type { PlotArea } from '../components/PlotArea.mjs';
|
|
9
|
+
import type { Tooltip } from '../components/Tooltip.mjs';
|
|
10
|
+
import { HitResolver, valueDistance, type HitHost, type TargetInfo } from './HitResolver.mjs';
|
|
11
|
+
/** 交互层需要的图表宿主能力,由 ICEChart 实现。 */
|
|
12
|
+
export interface InteractionHost extends HitHost {
|
|
13
|
+
tooltip: Tooltip | null;
|
|
14
|
+
crosshair: Crosshair | null;
|
|
15
|
+
highlight: Highlight | null;
|
|
16
|
+
brush: Brush | null;
|
|
17
|
+
legend: Legend | null;
|
|
18
|
+
plotArea: PlotArea;
|
|
19
|
+
emit(event: string, payload?: any): void;
|
|
20
|
+
setDomain(axis: 'x' | 'y', domain: any[], source?: string): void;
|
|
21
|
+
toggleSeries(seriesId: string, forceSelected?: boolean): void;
|
|
22
|
+
/** 切换饼图扇区显隐(极坐标图例)。 */
|
|
23
|
+
toggleSlice(seriesId: string, dataIndex: number, forceSelected?: boolean): void;
|
|
24
|
+
/** dataZoom 滑块(未启用时为 null)。 */
|
|
25
|
+
dataZoomSlider: DataZoomSlider | null;
|
|
26
|
+
/** 由滑块的 0~1 比例窗口反推数据域。 */
|
|
27
|
+
setDomainFromFractions(start: number, end: number, source?: string): void;
|
|
28
|
+
formatAxisValue(axis: 'x' | 'y', value: any): string;
|
|
29
|
+
/** 未经缩放的完整数据域(缩放约束用)。 */
|
|
30
|
+
fullDomain(axis: 'x' | 'y'): any[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 交互控制器:ice-chart 所有指针 / 键盘行为**唯一**的入口。
|
|
34
|
+
*
|
|
35
|
+
* 三条设计约束:
|
|
36
|
+
* 1. 悬停命中不复用引擎移动事件的 component 缓存(移动事件为了性能不做命中检测),
|
|
37
|
+
* 而是显式调用 `ice.hitTest()` —— 保证「画出来的样子」与「点得到的位置」严格一致;
|
|
38
|
+
* 2. 数据项命中交给引擎:`ice.hitTest()` 返回命中的组件,控制器只把本地坐标翻译成数据下标;
|
|
39
|
+
* 3. 对外只抛语义事件(item:hover / select:change / brush:end / zoom:change ...),
|
|
40
|
+
* 业务层不需要理解像素、比例尺与坐标系。
|
|
41
|
+
*
|
|
42
|
+
* 所有公开的 handleXxx 方法都接受**画布 CSS 像素**坐标,因此可以在不合成 DOM 事件的情况下直接单测。
|
|
43
|
+
*/
|
|
44
|
+
export declare class InteractionController {
|
|
45
|
+
host: InteractionHost;
|
|
46
|
+
hover: {
|
|
47
|
+
kind: 'item';
|
|
48
|
+
item: ActiveItem;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'axis';
|
|
51
|
+
column: ActiveColumn;
|
|
52
|
+
} | null;
|
|
53
|
+
selection: Array<{
|
|
54
|
+
seriesId: string;
|
|
55
|
+
dataIndex: number;
|
|
56
|
+
}>;
|
|
57
|
+
resolver: HitResolver;
|
|
58
|
+
private drag;
|
|
59
|
+
private bound;
|
|
60
|
+
private lastDimmed;
|
|
61
|
+
private keyboardIndex;
|
|
62
|
+
constructor(host: InteractionHost);
|
|
63
|
+
bind(): this;
|
|
64
|
+
unbind(): void;
|
|
65
|
+
private pointOf;
|
|
66
|
+
/** 指针是否落在本图 canvas 的内容盒内(CSS 像素语义)。 */
|
|
67
|
+
isOverCanvas(screenX: number, screenY: number): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* 阻止默认行为。
|
|
70
|
+
*
|
|
71
|
+
* 只对**原始 DOM 事件**调用:ice-render 的 ICEEvent 只是接口模拟(它的 preventDefault
|
|
72
|
+
* 会抛异常),而某些路径下事件对象上的 preventDefault 是未绑定的原生方法,
|
|
73
|
+
* 直接调用会抛 "Illegal invocation"。同样要容错 —— 被动监听器里调用会被浏览器拒绝。
|
|
74
|
+
*/
|
|
75
|
+
private preventDefault;
|
|
76
|
+
private onBusMove;
|
|
77
|
+
private onBusDown;
|
|
78
|
+
private onBusUp;
|
|
79
|
+
private onBusClick;
|
|
80
|
+
private onBusDoubleClick;
|
|
81
|
+
private onBusWheel;
|
|
82
|
+
private onBusKeyDown;
|
|
83
|
+
/**
|
|
84
|
+
* 数据域变化(缩放 / 平移 / 滑块 / 数据更新 / 图例切换)后重新定位悬停。
|
|
85
|
+
*
|
|
86
|
+
* 为什么必须做:悬停状态里存的是**像素**(十字准星位置、高亮环、提示框锚点),
|
|
87
|
+
* 而缩放/平移后同一份数据的像素已经变了。不重新定位就会出现
|
|
88
|
+
* 「准星停在原地、和曲线脱开」这种一眼可见的错位。
|
|
89
|
+
*/
|
|
90
|
+
refreshHover(): void;
|
|
91
|
+
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
92
|
+
handlePointerMove(screenX: number, screenY: number, evt?: any): void;
|
|
93
|
+
updateHover(screenX: number, screenY: number): void;
|
|
94
|
+
private resetLegendHover;
|
|
95
|
+
setHover(next: {
|
|
96
|
+
kind: 'item';
|
|
97
|
+
item: ActiveItem;
|
|
98
|
+
} | {
|
|
99
|
+
kind: 'axis';
|
|
100
|
+
column: ActiveColumn;
|
|
101
|
+
} | null): void;
|
|
102
|
+
private setHoverState;
|
|
103
|
+
private applyHoverVisuals;
|
|
104
|
+
private buildTooltipContent;
|
|
105
|
+
private clearHoverVisuals;
|
|
106
|
+
/** 只清理数据层(高亮环 / 准星 / 提示框),不动图例悬停。 */
|
|
107
|
+
private clearDataVisuals;
|
|
108
|
+
/** 把「当前悬停的数据项」下发给系列:图元自己会做放大/外移等反馈动画。 */
|
|
109
|
+
private syncSeriesHover;
|
|
110
|
+
/** 生成高亮标记:数据点用圆环,柱形用矩形描边。 */
|
|
111
|
+
private markFor;
|
|
112
|
+
/**
|
|
113
|
+
* 未命中高亮时压低其他系列的不透明度。
|
|
114
|
+
* 只在「悬停系列发生变化」时写 state —— 每次 mousemove 都写会让所有系列每帧变脏,
|
|
115
|
+
* 脏矩形局部重绘的优势就没了。
|
|
116
|
+
*/
|
|
117
|
+
private dimOthers;
|
|
118
|
+
handlePointerDown(screenX: number, screenY: number, evt?: any): boolean;
|
|
119
|
+
handlePointerUp(screenX: number, screenY: number, _evt?: any): void;
|
|
120
|
+
private updateDrag;
|
|
121
|
+
private shiftDomain;
|
|
122
|
+
handleClick(screenX: number, screenY: number, _evt?: any): void;
|
|
123
|
+
handleDoubleClick(screenX: number, screenY: number, _evt?: any): void;
|
|
124
|
+
toggleSelection(seriesId: string, dataIndex: number, mode: 'single' | 'multiple', toggle: boolean): void;
|
|
125
|
+
clearSelection(): void;
|
|
126
|
+
private refreshSelectionVisuals;
|
|
127
|
+
getSelectedParams(): DataPointParams[];
|
|
128
|
+
get brushRect(): import("../internal.mjs").Rect | null;
|
|
129
|
+
private brushRange;
|
|
130
|
+
/** 像素 → 数据值;类目轴取命中带(或最近类目),数值轴取精确反算。 */
|
|
131
|
+
private valueAtPixel;
|
|
132
|
+
private orderValues;
|
|
133
|
+
private applyRange;
|
|
134
|
+
handleWheel(screenX: number, screenY: number, deltaY: number, evt?: any): boolean;
|
|
135
|
+
private zoomDomain;
|
|
136
|
+
private currentRange;
|
|
137
|
+
handleKeyDown(key: string, evt?: any): boolean;
|
|
138
|
+
/** 外部(联动)驱动:在指定 x 数据值上显示悬停。 */
|
|
139
|
+
showHoverAtValue(xValue: any): void;
|
|
140
|
+
clearHover(): void;
|
|
141
|
+
/** 沿指定方向找到下一个「落在绘图区内」的数据下标;找不到返回 -1。 */
|
|
142
|
+
/** 关系图组件 → 对应的 InternalSeries。 */
|
|
143
|
+
private seriesOfGraphComponent;
|
|
144
|
+
private stepVisibleIndex;
|
|
145
|
+
destroy(): void;
|
|
146
|
+
}
|
|
147
|
+
export { valueDistance };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { ActiveColumn, ActiveItem } from '../internal';
|
|
2
|
+
import type { DataPointParams } from '../types';
|
|
3
|
+
import type { Crosshair } from '../components/Crosshair';
|
|
4
|
+
import type { Highlight } from '../components/Highlight';
|
|
5
|
+
import type { Brush } from '../components/Brush';
|
|
6
|
+
import type { DataZoomSlider } from '../components/DataZoomSlider';
|
|
7
|
+
import type { Legend } from '../components/Legend';
|
|
8
|
+
import type { PlotArea } from '../components/PlotArea';
|
|
9
|
+
import type { Tooltip } from '../components/Tooltip';
|
|
10
|
+
import { HitResolver, valueDistance, type HitHost, type TargetInfo } from './HitResolver';
|
|
11
|
+
/** 交互层需要的图表宿主能力,由 ICEChart 实现。 */
|
|
12
|
+
export interface InteractionHost extends HitHost {
|
|
13
|
+
tooltip: Tooltip | null;
|
|
14
|
+
crosshair: Crosshair | null;
|
|
15
|
+
highlight: Highlight | null;
|
|
16
|
+
brush: Brush | null;
|
|
17
|
+
legend: Legend | null;
|
|
18
|
+
plotArea: PlotArea;
|
|
19
|
+
emit(event: string, payload?: any): void;
|
|
20
|
+
setDomain(axis: 'x' | 'y', domain: any[], source?: string): void;
|
|
21
|
+
toggleSeries(seriesId: string, forceSelected?: boolean): void;
|
|
22
|
+
/** 切换饼图扇区显隐(极坐标图例)。 */
|
|
23
|
+
toggleSlice(seriesId: string, dataIndex: number, forceSelected?: boolean): void;
|
|
24
|
+
/** dataZoom 滑块(未启用时为 null)。 */
|
|
25
|
+
dataZoomSlider: DataZoomSlider | null;
|
|
26
|
+
/** 由滑块的 0~1 比例窗口反推数据域。 */
|
|
27
|
+
setDomainFromFractions(start: number, end: number, source?: string): void;
|
|
28
|
+
formatAxisValue(axis: 'x' | 'y', value: any): string;
|
|
29
|
+
/** 未经缩放的完整数据域(缩放约束用)。 */
|
|
30
|
+
fullDomain(axis: 'x' | 'y'): any[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 交互控制器:ice-chart 所有指针 / 键盘行为**唯一**的入口。
|
|
34
|
+
*
|
|
35
|
+
* 三条设计约束:
|
|
36
|
+
* 1. 悬停命中不复用引擎移动事件的 component 缓存(移动事件为了性能不做命中检测),
|
|
37
|
+
* 而是显式调用 `ice.hitTest()` —— 保证「画出来的样子」与「点得到的位置」严格一致;
|
|
38
|
+
* 2. 数据项命中交给引擎:`ice.hitTest()` 返回命中的组件,控制器只把本地坐标翻译成数据下标;
|
|
39
|
+
* 3. 对外只抛语义事件(item:hover / select:change / brush:end / zoom:change ...),
|
|
40
|
+
* 业务层不需要理解像素、比例尺与坐标系。
|
|
41
|
+
*
|
|
42
|
+
* 所有公开的 handleXxx 方法都接受**画布 CSS 像素**坐标,因此可以在不合成 DOM 事件的情况下直接单测。
|
|
43
|
+
*/
|
|
44
|
+
export declare class InteractionController {
|
|
45
|
+
host: InteractionHost;
|
|
46
|
+
hover: {
|
|
47
|
+
kind: 'item';
|
|
48
|
+
item: ActiveItem;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'axis';
|
|
51
|
+
column: ActiveColumn;
|
|
52
|
+
} | null;
|
|
53
|
+
selection: Array<{
|
|
54
|
+
seriesId: string;
|
|
55
|
+
dataIndex: number;
|
|
56
|
+
}>;
|
|
57
|
+
resolver: HitResolver;
|
|
58
|
+
private drag;
|
|
59
|
+
private bound;
|
|
60
|
+
private lastDimmed;
|
|
61
|
+
private keyboardIndex;
|
|
62
|
+
constructor(host: InteractionHost);
|
|
63
|
+
bind(): this;
|
|
64
|
+
unbind(): void;
|
|
65
|
+
private pointOf;
|
|
66
|
+
/** 指针是否落在本图 canvas 的内容盒内(CSS 像素语义)。 */
|
|
67
|
+
isOverCanvas(screenX: number, screenY: number): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* 阻止默认行为。
|
|
70
|
+
*
|
|
71
|
+
* 只对**原始 DOM 事件**调用:ice-render 的 ICEEvent 只是接口模拟(它的 preventDefault
|
|
72
|
+
* 会抛异常),而某些路径下事件对象上的 preventDefault 是未绑定的原生方法,
|
|
73
|
+
* 直接调用会抛 "Illegal invocation"。同样要容错 —— 被动监听器里调用会被浏览器拒绝。
|
|
74
|
+
*/
|
|
75
|
+
private preventDefault;
|
|
76
|
+
private onBusMove;
|
|
77
|
+
private onBusDown;
|
|
78
|
+
private onBusUp;
|
|
79
|
+
private onBusClick;
|
|
80
|
+
private onBusDoubleClick;
|
|
81
|
+
private onBusWheel;
|
|
82
|
+
private onBusKeyDown;
|
|
83
|
+
/**
|
|
84
|
+
* 数据域变化(缩放 / 平移 / 滑块 / 数据更新 / 图例切换)后重新定位悬停。
|
|
85
|
+
*
|
|
86
|
+
* 为什么必须做:悬停状态里存的是**像素**(十字准星位置、高亮环、提示框锚点),
|
|
87
|
+
* 而缩放/平移后同一份数据的像素已经变了。不重新定位就会出现
|
|
88
|
+
* 「准星停在原地、和曲线脱开」这种一眼可见的错位。
|
|
89
|
+
*/
|
|
90
|
+
refreshHover(): void;
|
|
91
|
+
resolveTarget(screenX: number, screenY: number): TargetInfo;
|
|
92
|
+
handlePointerMove(screenX: number, screenY: number, evt?: any): void;
|
|
93
|
+
updateHover(screenX: number, screenY: number): void;
|
|
94
|
+
private resetLegendHover;
|
|
95
|
+
setHover(next: {
|
|
96
|
+
kind: 'item';
|
|
97
|
+
item: ActiveItem;
|
|
98
|
+
} | {
|
|
99
|
+
kind: 'axis';
|
|
100
|
+
column: ActiveColumn;
|
|
101
|
+
} | null): void;
|
|
102
|
+
private setHoverState;
|
|
103
|
+
private applyHoverVisuals;
|
|
104
|
+
private buildTooltipContent;
|
|
105
|
+
private clearHoverVisuals;
|
|
106
|
+
/** 只清理数据层(高亮环 / 准星 / 提示框),不动图例悬停。 */
|
|
107
|
+
private clearDataVisuals;
|
|
108
|
+
/** 把「当前悬停的数据项」下发给系列:图元自己会做放大/外移等反馈动画。 */
|
|
109
|
+
private syncSeriesHover;
|
|
110
|
+
/** 生成高亮标记:数据点用圆环,柱形用矩形描边。 */
|
|
111
|
+
private markFor;
|
|
112
|
+
/**
|
|
113
|
+
* 未命中高亮时压低其他系列的不透明度。
|
|
114
|
+
* 只在「悬停系列发生变化」时写 state —— 每次 mousemove 都写会让所有系列每帧变脏,
|
|
115
|
+
* 脏矩形局部重绘的优势就没了。
|
|
116
|
+
*/
|
|
117
|
+
private dimOthers;
|
|
118
|
+
handlePointerDown(screenX: number, screenY: number, evt?: any): boolean;
|
|
119
|
+
handlePointerUp(screenX: number, screenY: number, _evt?: any): void;
|
|
120
|
+
private updateDrag;
|
|
121
|
+
private shiftDomain;
|
|
122
|
+
handleClick(screenX: number, screenY: number, _evt?: any): void;
|
|
123
|
+
handleDoubleClick(screenX: number, screenY: number, _evt?: any): void;
|
|
124
|
+
toggleSelection(seriesId: string, dataIndex: number, mode: 'single' | 'multiple', toggle: boolean): void;
|
|
125
|
+
clearSelection(): void;
|
|
126
|
+
private refreshSelectionVisuals;
|
|
127
|
+
getSelectedParams(): DataPointParams[];
|
|
128
|
+
get brushRect(): import("../internal").Rect | null;
|
|
129
|
+
private brushRange;
|
|
130
|
+
/** 像素 → 数据值;类目轴取命中带(或最近类目),数值轴取精确反算。 */
|
|
131
|
+
private valueAtPixel;
|
|
132
|
+
private orderValues;
|
|
133
|
+
private applyRange;
|
|
134
|
+
handleWheel(screenX: number, screenY: number, deltaY: number, evt?: any): boolean;
|
|
135
|
+
private zoomDomain;
|
|
136
|
+
private currentRange;
|
|
137
|
+
handleKeyDown(key: string, evt?: any): boolean;
|
|
138
|
+
/** 外部(联动)驱动:在指定 x 数据值上显示悬停。 */
|
|
139
|
+
showHoverAtValue(xValue: any): void;
|
|
140
|
+
clearHover(): void;
|
|
141
|
+
/** 沿指定方向找到下一个「落在绘图区内」的数据下标;找不到返回 -1。 */
|
|
142
|
+
/** 关系图组件 → 对应的 InternalSeries。 */
|
|
143
|
+
private seriesOfGraphComponent;
|
|
144
|
+
private stepVisibleIndex;
|
|
145
|
+
destroy(): void;
|
|
146
|
+
}
|
|
147
|
+
export { valueDistance };
|