@cloudscape-design/chart-components 1.0.158 → 1.0.160

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 (49) hide show
  1. package/core/chart-api/chart-extra-context.d.ts +4 -0
  2. package/core/chart-api/chart-extra-context.js +14 -1
  3. package/core/chart-api/chart-extra-context.js.map +1 -1
  4. package/core/chart-api/chart-extra-highlight.d.ts +1 -0
  5. package/core/chart-api/chart-extra-highlight.js +8 -4
  6. package/core/chart-api/chart-extra-highlight.js.map +1 -1
  7. package/core/chart-api/chart-extra-navigation.d.ts +2 -0
  8. package/core/chart-api/chart-extra-navigation.js +18 -5
  9. package/core/chart-api/chart-extra-navigation.js.map +1 -1
  10. package/core/chart-api/chart-extra-zoom.d.ts +20 -0
  11. package/core/chart-api/chart-extra-zoom.js +109 -0
  12. package/core/chart-api/chart-extra-zoom.js.map +1 -0
  13. package/core/chart-api/index.d.ts +5 -0
  14. package/core/chart-api/index.js +21 -0
  15. package/core/chart-api/index.js.map +1 -1
  16. package/core/chart-container.d.ts +2 -1
  17. package/core/chart-container.js +2 -2
  18. package/core/chart-container.js.map +1 -1
  19. package/core/chart-core.d.ts +2 -1
  20. package/core/chart-core.js +41 -34
  21. package/core/chart-core.js.map +1 -1
  22. package/core/components/core-zoom.d.ts +9 -0
  23. package/core/components/core-zoom.js +20 -0
  24. package/core/components/core-zoom.js.map +1 -0
  25. package/core/i18n-utils.d.ts +4 -0
  26. package/core/i18n-utils.js +6 -0
  27. package/core/i18n-utils.js.map +1 -1
  28. package/core/internal-interfaces.d.ts +19 -0
  29. package/core/internal-interfaces.js +4 -0
  30. package/core/internal-interfaces.js.map +1 -0
  31. package/core/styles.css.js +22 -21
  32. package/core/styles.scoped.css +27 -21
  33. package/core/styles.selectors.js +22 -21
  34. package/core/test-classes/styles.css.js +33 -30
  35. package/core/test-classes/styles.scoped.css +33 -30
  36. package/core/test-classes/styles.selectors.js +33 -30
  37. package/internal/chart-styles.d.ts +11 -0
  38. package/internal/chart-styles.js +12 -1
  39. package/internal/chart-styles.js.map +1 -1
  40. package/internal/environment.js +1 -1
  41. package/internal/environment.json +1 -1
  42. package/internal/generated/styles/tokens.d.ts +1 -1
  43. package/internal/generated/styles/tokens.js +1 -1
  44. package/internal/generated/theming/index.cjs +5 -3
  45. package/internal/generated/theming/index.d.cts +9 -0
  46. package/internal/generated/theming/index.d.ts +9 -0
  47. package/internal/generated/theming/index.js +5 -3
  48. package/internal/manifest.json +1 -1
  49. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { NonCancelableEventHandler } from "../../internal/events";
3
3
  import { SafeChart, SafeSeries } from "../../internal/utils/highcharts";
4
4
  import { ChartLabels } from "../i18n-utils";
5
5
  import { CoreChartProps, Rect } from "../interfaces";
6
+ import { ZoomChangeDetail, ZoomRange } from "../internal-interfaces";
6
7
  export interface ChartExtraContext {
7
8
  settings: ChartExtraContext.Settings;
8
9
  handlers: ChartExtraContext.Handlers;
@@ -20,14 +21,17 @@ export declare namespace ChartExtraContext {
20
21
  keyboardNavigationEnabled: boolean;
21
22
  labels: ChartLabels;
22
23
  getItemOptions?: CoreChartProps.GetItemOptions;
24
+ zoomEnabled: boolean;
23
25
  }
24
26
  interface Handlers {
25
27
  onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;
26
28
  onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;
27
29
  onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;
30
+ onZoomRangeChange?: NonCancelableEventHandler<ZoomChangeDetail>;
28
31
  }
29
32
  interface State {
30
33
  visibleItems?: readonly string[];
34
+ zoomRange?: null | ZoomRange;
31
35
  }
32
36
  interface DerivedState {
33
37
  allX: number[];
@@ -13,6 +13,7 @@ export function createChartContext() {
13
13
  tooltipEnabled: false,
14
14
  keyboardNavigationEnabled: false,
15
15
  labels: {},
16
+ zoomEnabled: false,
16
17
  },
17
18
  handlers: {},
18
19
  state: {},
@@ -48,12 +49,13 @@ function computeDerivedState(chart) {
48
49
  for (const s of getChartSeries(chart)) {
49
50
  const seriesPoints = new Array();
50
51
  if (s.visible) {
52
+ const isWithinXExtremes = getXExtremesFilter(s);
51
53
  for (const d of getSeriesData(s)) {
52
54
  // Points with y=null represent the absence of value, there is no need to include them and those
53
55
  // should have no impact on computed rects or navigation.
54
56
  // Although "d" can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints
55
57
  // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)
56
- if (d.visible && d.y !== null) {
58
+ if (d.visible && d.y !== null && isWithinXExtremes(d.x)) {
57
59
  seriesPoints.push(d);
58
60
  allXSet.add(d.x);
59
61
  addPoint(d);
@@ -91,6 +93,17 @@ function computeDerivedState(chart) {
91
93
  })),
92
94
  };
93
95
  }
96
+ // Highcharts only crops series points to the x extremes once a series exceeds its cropThreshold, so smaller
97
+ // series keep points that are off screen. Navigation and the tooltip must not reach those points.
98
+ function getXExtremesFilter(series) {
99
+ var _a;
100
+ const extremes = (_a = series.xAxis) === null || _a === void 0 ? void 0 : _a.getExtremes();
101
+ if (!extremes) {
102
+ return () => true;
103
+ }
104
+ const { min, max } = extremes;
105
+ return (x) => (typeof min !== "number" || x >= min) && (typeof max !== "number" || x <= max);
106
+ }
94
107
  // The points are sorted to ensure consistent navigation, including inverted chart orientation.
95
108
  // The order of series in grouped column charts is kept, while stacked series are sorted by their
96
109
  // respective positions in the plot.
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-context.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAyB,MAAM,iCAAiC,CAAC;AAGvG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA6CzD,kFAAkF;AAClF,gGAAgG;AAChG,MAAM,UAAU,kBA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/F,iGAAiG;AACjG,oCAAoC;AACpC,SAAS,UAAU,CAAC,KAAyB;;IAC3C,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,KAAK,0CAAE,QAAQ,CAAA,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAClB,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { NonCancelableEventHandler } from \"../../internal/events\";\nimport { getChartSeries, getSeriesData, SafeChart, SafeSeries } from \"../../internal/utils/highcharts\";\nimport { ChartLabels } from \"../i18n-utils\";\nimport { CoreChartProps, Rect } from \"../interfaces\";\nimport { getGroupRect, isSeriesStacked } from \"../utils\";\n\n// Chart API context is used for dependency injection for chart utilities.\n// It is initialized on chart render, and includes the chart instance, consumer\n// settings and state, and derived state, which is computed from the chart instance\n// on each render, and reused across utilities to avoid duplicate work.\n\nexport interface ChartExtraContext {\n settings: ChartExtraContext.Settings;\n handlers: ChartExtraContext.Handlers;\n state: ChartExtraContext.State;\n derived: ChartExtraContext.DerivedState;\n chartOrNull: null | SafeChart;\n chart: () => SafeChart;\n}\n\nexport namespace ChartExtraContext {\n export interface Settings {\n chartId: string;\n noDataEnabled: boolean;\n legendEnabled: boolean;\n tooltipEnabled: boolean;\n keyboardNavigationEnabled: boolean;\n labels: ChartLabels;\n getItemOptions?: CoreChartProps.GetItemOptions;\n }\n\n export interface Handlers {\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n }\n\n export interface State {\n visibleItems?: readonly string[];\n }\n\n export interface DerivedState {\n allX: number[];\n getPointsByX: (x: number) => Highcharts.Point[];\n getSeriesPoints: (series: SafeSeries) => Highcharts.Point[];\n groupRects: { group: Highcharts.Point[]; rect: Rect }[];\n }\n}\n\n// The context is created when the chart component is rendered for the first time.\n// On every subsequent render the settings and state are updated directly in the context object.\nexport function createChartContext(): ChartExtraContext {\n return {\n settings: {\n chartId: \"\",\n noDataEnabled: false,\n legendEnabled: false,\n tooltipEnabled: false,\n keyboardNavigationEnabled: false,\n labels: {},\n },\n handlers: {},\n state: {},\n chart: () => {\n // Before the first chart render there is no chart instance, which is required for most of the utilities.\n // Instead of doing null checks in each utility, an attempt to access the chart instance before it is ready\n // will cause an exception, indicating an logical error in the code.\n throw new Error(\"Invariant violation: using chart API before initialization.\");\n },\n chartOrNull: null,\n derived: { allX: [], getPointsByX: () => [], getSeriesPoints: () => [], groupRects: [] },\n };\n}\n\n// The update method is called on every chart render, before any other initialization code.\n// This ensures the context state is up to date and can be used for subsequent computations.\nexport function updateChartContext(context: ChartExtraContext, chart: SafeChart) {\n context.chart = () => chart;\n context.chartOrNull = chart;\n context.derived = computeDerivedState(chart);\n}\n\nfunction computeDerivedState(chart: SafeChart): ChartExtraContext.DerivedState {\n const allXSet = new Set<number>();\n const allPointsInSeries = new WeakMap<SafeSeries, Highcharts.Point[]>();\n const pointsByX = new Map<number, Highcharts.Point[]>();\n const getXPoints = (x: number) => pointsByX.get(x) ?? [];\n const addPoint = (point: Highcharts.Point) => {\n const xPoints = getXPoints(point.x);\n xPoints.push(point);\n pointsByX.set(point.x, xPoints);\n };\n const compareX = (a: number, b: number) => a - b;\n\n for (const s of getChartSeries(chart)) {\n const seriesPoints = new Array<Highcharts.Point>();\n if (s.visible) {\n for (const d of getSeriesData(s)) {\n // Points with y=null represent the absence of value, there is no need to include them and those\n // should have no impact on computed rects or navigation.\n\n // Although \"d\" can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints\n // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)\n if (d.visible && d.y !== null) {\n seriesPoints.push(d);\n allXSet.add(d.x);\n addPoint(d);\n }\n }\n }\n allPointsInSeries.set(s, seriesPoints);\n }\n for (const [, points] of pointsByX) {\n sortPoints(points);\n }\n const allX = Array.from(allXSet).sort(compareX);\n\n const seriesPointsMap = new WeakMap<SafeSeries, Highcharts.Point[]>();\n for (const s of getChartSeries(chart)) {\n const allSeriesPoints = (allPointsInSeries.get(s) ?? []).sort(({ x: x1 }, { x: x2 }) => compareX(x1, x2));\n const usedXSet = new Set<number>();\n const navigableSeriesPoints = new Array<Highcharts.Point>();\n for (const point of allSeriesPoints) {\n if (!usedXSet.has(point.x)) {\n navigableSeriesPoints.push(point);\n usedXSet.add(point.x); // We ignore points that share X coordinate.\n }\n }\n seriesPointsMap.set(s, navigableSeriesPoints);\n }\n return {\n allX,\n getPointsByX: (x) => pointsByX.get(x) ?? [],\n getSeriesPoints: (s) => seriesPointsMap.get(s) ?? [],\n // Group rects are computed for every available x coordinate, each including at least one point with matching x value.\n // They enclose all matching points of the group and are used to match hover position and place the tooltip or focus outline.\n groupRects: allX.map((x) => ({\n group: getXPoints(x),\n rect: getGroupRect(getXPoints(x)),\n })),\n };\n}\n\n// The points are sorted to ensure consistent navigation, including inverted chart orientation.\n// The order of series in grouped column charts is kept, while stacked series are sorted by their\n// respective positions in the plot.\nfunction sortPoints(group: Highcharts.Point[]) {\n const reversed = !!group[0]?.series.yAxis?.reversed;\n group.sort((a, b) => {\n const ay = a.plotY === undefined || (a.series.type === \"column\" && !isSeriesStacked(a.series)) ? 0 : a.plotY;\n const by = b.plotY === undefined || (b.series.type === \"column\" && !isSeriesStacked(b.series)) ? 0 : b.plotY;\n return !reversed ? ay - by : by - ay;\n });\n}\n"]}
1
+ {"version":3,"file":"chart-extra-context.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAyB,MAAM,iCAAiC,CAAC;AAIvG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAgDzD,kFAAkF;AAClF,gGAAgG;AAChG,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,QAAQ,EAAE;YACR,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;YACrB,yBAAyB,EAAE,KAAK;YAChC,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,KAAK;SACnB;QACD,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,GAAG,EAAE;YACV,yGAAyG;YACzG,2GAA2G;YAC3G,oEAAoE;YACpE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,G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OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;AAC/F,CAAC;AAED,+FAA+F;AAC/F,iGAAiG;AACjG,oCAAoC;AACpC,SAAS,UAAU,CAAC,KAAyB;;IAC3C,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC,KAAK,0CAAE,QAAQ,CAAA,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAClB,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { NonCancelableEventHandler } from \"../../internal/events\";\nimport { getChartSeries, getSeriesData, SafeChart, SafeSeries } from \"../../internal/utils/highcharts\";\nimport { ChartLabels } from \"../i18n-utils\";\nimport { CoreChartProps, Rect } from \"../interfaces\";\nimport { ZoomChangeDetail, ZoomRange } from \"../internal-interfaces\";\nimport { getGroupRect, isSeriesStacked } from \"../utils\";\n\n// Chart API context is used for dependency injection for chart utilities.\n// It is initialized on chart render, and includes the chart instance, consumer\n// settings and state, and derived state, which is computed from the chart instance\n// on each render, and reused across utilities to avoid duplicate work.\n\nexport interface ChartExtraContext {\n settings: ChartExtraContext.Settings;\n handlers: ChartExtraContext.Handlers;\n state: ChartExtraContext.State;\n derived: ChartExtraContext.DerivedState;\n chartOrNull: null | SafeChart;\n chart: () => SafeChart;\n}\n\nexport namespace ChartExtraContext {\n export interface Settings {\n chartId: string;\n noDataEnabled: boolean;\n legendEnabled: boolean;\n tooltipEnabled: boolean;\n keyboardNavigationEnabled: boolean;\n labels: ChartLabels;\n getItemOptions?: CoreChartProps.GetItemOptions;\n zoomEnabled: boolean;\n }\n\n export interface Handlers {\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n onZoomRangeChange?: NonCancelableEventHandler<ZoomChangeDetail>;\n }\n\n export interface State {\n visibleItems?: readonly string[];\n zoomRange?: null | ZoomRange;\n }\n\n export interface DerivedState {\n allX: number[];\n getPointsByX: (x: number) => Highcharts.Point[];\n getSeriesPoints: (series: SafeSeries) => Highcharts.Point[];\n groupRects: { group: Highcharts.Point[]; rect: Rect }[];\n }\n}\n\n// The context is created when the chart component is rendered for the first time.\n// On every subsequent render the settings and state are updated directly in the context object.\nexport function createChartContext(): ChartExtraContext {\n return {\n settings: {\n chartId: \"\",\n noDataEnabled: false,\n legendEnabled: false,\n tooltipEnabled: false,\n keyboardNavigationEnabled: false,\n labels: {},\n zoomEnabled: false,\n },\n handlers: {},\n state: {},\n chart: () => {\n // Before the first chart render there is no chart instance, which is required for most of the utilities.\n // Instead of doing null checks in each utility, an attempt to access the chart instance before it is ready\n // will cause an exception, indicating an logical error in the code.\n throw new Error(\"Invariant violation: using chart API before initialization.\");\n },\n chartOrNull: null,\n derived: { allX: [], getPointsByX: () => [], getSeriesPoints: () => [], groupRects: [] },\n };\n}\n\n// The update method is called on every chart render, before any other initialization code.\n// This ensures the context state is up to date and can be used for subsequent computations.\nexport function updateChartContext(context: ChartExtraContext, chart: SafeChart) {\n context.chart = () => chart;\n context.chartOrNull = chart;\n context.derived = computeDerivedState(chart);\n}\n\nfunction computeDerivedState(chart: SafeChart): ChartExtraContext.DerivedState {\n const allXSet = new Set<number>();\n const allPointsInSeries = new WeakMap<SafeSeries, Highcharts.Point[]>();\n const pointsByX = new Map<number, Highcharts.Point[]>();\n const getXPoints = (x: number) => pointsByX.get(x) ?? [];\n const addPoint = (point: Highcharts.Point) => {\n const xPoints = getXPoints(point.x);\n xPoints.push(point);\n pointsByX.set(point.x, xPoints);\n };\n const compareX = (a: number, b: number) => a - b;\n\n for (const s of getChartSeries(chart)) {\n const seriesPoints = new Array<Highcharts.Point>();\n if (s.visible) {\n const isWithinXExtremes = getXExtremesFilter(s);\n for (const d of getSeriesData(s)) {\n // Points with y=null represent the absence of value, there is no need to include them and those\n // should have no impact on computed rects or navigation.\n\n // Although \"d\" can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints\n // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)\n if (d.visible && d.y !== null && isWithinXExtremes(d.x)) {\n seriesPoints.push(d);\n allXSet.add(d.x);\n addPoint(d);\n }\n }\n }\n allPointsInSeries.set(s, seriesPoints);\n }\n for (const [, points] of pointsByX) {\n sortPoints(points);\n }\n const allX = Array.from(allXSet).sort(compareX);\n\n const seriesPointsMap = new WeakMap<SafeSeries, Highcharts.Point[]>();\n for (const s of getChartSeries(chart)) {\n const allSeriesPoints = (allPointsInSeries.get(s) ?? []).sort(({ x: x1 }, { x: x2 }) => compareX(x1, x2));\n const usedXSet = new Set<number>();\n const navigableSeriesPoints = new Array<Highcharts.Point>();\n for (const point of allSeriesPoints) {\n if (!usedXSet.has(point.x)) {\n navigableSeriesPoints.push(point);\n usedXSet.add(point.x); // We ignore points that share X coordinate.\n }\n }\n seriesPointsMap.set(s, navigableSeriesPoints);\n }\n return {\n allX,\n getPointsByX: (x) => pointsByX.get(x) ?? [],\n getSeriesPoints: (s) => seriesPointsMap.get(s) ?? [],\n // Group rects are computed for every available x coordinate, each including at least one point with matching x value.\n // They enclose all matching points of the group and are used to match hover position and place the tooltip or focus outline.\n groupRects: allX.map((x) => ({\n group: getXPoints(x),\n rect: getGroupRect(getXPoints(x)),\n })),\n };\n}\n\n// Highcharts only crops series points to the x extremes once a series exceeds its cropThreshold, so smaller\n// series keep points that are off screen. Navigation and the tooltip must not reach those points.\nfunction getXExtremesFilter(series: SafeSeries): (x: number) => boolean {\n const extremes = series.xAxis?.getExtremes();\n if (!extremes) {\n return () => true;\n }\n const { min, max } = extremes;\n return (x) => (typeof min !== \"number\" || x >= min) && (typeof max !== \"number\" || x <= max);\n}\n\n// The points are sorted to ensure consistent navigation, including inverted chart orientation.\n// The order of series in grouped column charts is kept, while stacked series are sorted by their\n// respective positions in the plot.\nfunction sortPoints(group: Highcharts.Point[]) {\n const reversed = !!group[0]?.series.yAxis?.reversed;\n group.sort((a, b) => {\n const ay = a.plotY === undefined || (a.series.type === \"column\" && !isSeriesStacked(a.series)) ? 0 : a.plotY;\n const by = b.plotY === undefined || (b.series.type === \"column\" && !isSeriesStacked(b.series)) ? 0 : b.plotY;\n return !reversed ? ay - by : by - ay;\n });\n}\n"]}
@@ -5,6 +5,7 @@ export declare class ChartExtraHighlight {
5
5
  constructor(context: ChartExtraContext);
6
6
  private seriesState;
7
7
  private pointState;
8
+ private columnStatesSynced;
8
9
  onChartRender(): void;
9
10
  highlightChartItems: (itemIds: readonly string[]) => void;
10
11
  highlightChartGroup: (points: readonly Highcharts.Point[]) => void;
@@ -13,6 +13,7 @@ export class ChartExtraHighlight {
13
13
  // when triggered a state update from the consumer-provided tooltip footer action.
14
14
  this.seriesState = new Map();
15
15
  this.pointState = new Map();
16
+ this.columnStatesSynced = false;
16
17
  // The method highlights specified series or points (by id). It is used when hovering over the legend items.
17
18
  this.highlightChartItems = (itemIds) => {
18
19
  const itemIdsSet = new Set(itemIds);
@@ -53,10 +54,11 @@ export class ChartExtraHighlight {
53
54
  // See: https://github.com/highcharts/highcharts/issues/23076.
54
55
  if (s.type === "column") {
55
56
  for (const d of getSeriesData(s)) {
56
- this.setPointState(d, includedPoints.has(d) ? "" : "inactive");
57
+ this.setPointState(d, includedPoints.has(d) ? "" : "inactive", !this.columnStatesSynced);
57
58
  }
58
59
  }
59
60
  }
61
+ this.columnStatesSynced = true;
60
62
  setPlotLinesState(this.context.chart(), (lineId) => includedSeriesIds.has(lineId));
61
63
  };
62
64
  // This method is similar to the above, but it takes a single point. This is used for point highlighting
@@ -77,10 +79,11 @@ export class ChartExtraHighlight {
77
79
  // For column series we ensure only one group/stack that matches selected X is highlighted.
78
80
  else if (s.type === "column") {
79
81
  for (const d of getSeriesData(s)) {
80
- this.setPointState(d, d === point ? "hover" : "inactive");
82
+ this.setPointState(d, d === point ? "hover" : "inactive", !this.columnStatesSynced);
81
83
  }
82
84
  }
83
85
  }
86
+ this.columnStatesSynced = true;
84
87
  // Highlight threshold series plot lines.
85
88
  setPlotLinesState(this.context.chart(), (lineId) => lineId === getSeriesId(masterSeries));
86
89
  };
@@ -135,6 +138,7 @@ export class ChartExtraHighlight {
135
138
  this.context = context;
136
139
  }
137
140
  onChartRender() {
141
+ this.columnStatesSynced = false;
138
142
  this.overrideStateSetters();
139
143
  this.restoreHighlightState();
140
144
  }
@@ -146,9 +150,9 @@ export class ChartExtraHighlight {
146
150
  series.setState[SET_STATE_LOCK] = true;
147
151
  }
148
152
  // Makes the specified point active or dimmed.
149
- setPointState(point, state) {
153
+ setPointState(point, state, move = true) {
150
154
  point.setState[SET_STATE_LOCK] = false;
151
- point.setState(state, true);
155
+ point.setState(state, move);
152
156
  this.updateStoredPointState(point, state);
153
157
  point.setState[SET_STATE_LOCK] = true;
154
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-highlight.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-highlight.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,GAGd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGnD,MAAM,cAAc,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAKtD,6FAA6F;AAC7F,8DAA8D;AAC9D,MAAM,OAAO,mBAAmB;IAE9B,YAAY,OAA0B;QAItC,sGAAsG;QACtG,oGAAoG;QACpG,kFAAkF;QAC1E,gBAAW,GAAG,IAAI,GAAG,EAA4C,CAAC;QAClE,eAAU,GAAG,IAAI,GAAG,EAAwD,CAAC;QAOrF,4GAA4G;QACrG,wBAAmB,GAAG,CAAC,OAA0B,EAAE,EAAE;YAC1D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,KAAK,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;gBACrD,oGAAoG;gBACpG,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;oBACrB,KAAK,MAAM,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;wBACjC,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;4BAClC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;wBACjC,CAAC;oBACH,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,WAAW,CAA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AAE,QAAqC;IAChF,gBAAgB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,WACvC,OAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA,EAAA,CACtF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB,EAAE,EAA6D;;IACvG,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,sEAAsE;QACtE,IAAI,mBAAmB,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAA+B,EAAE,EAAE;gBACjE,wFAAwF;gBACxF,oFAAoF;gBACpF,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;oBACpB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport {\n getChartSeries,\n getLinkedSeries,\n getMasterSeries,\n getSeriesData,\n SafeChart,\n SafeSeries,\n} from \"../../internal/utils/highcharts\";\nimport { getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst SET_STATE_LOCK = Symbol(\"awsui-set-state-lock\");\n\ntype SeriesSetStateWithLock = SafeSeries[\"setState\"] & { [SET_STATE_LOCK]: boolean };\ntype PointSetStateWithLock = Highcharts.Point[\"setState\"] & { [SET_STATE_LOCK]: boolean };\n\n// Chart helper that mutes Highcharts default highlighting behavior and offers custom methods\n// for customized control over series and points highlighting.\nexport class ChartExtraHighlight {\n private context: ChartExtraContext;\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n // We keep track of the previously highlighted series and points to recover highlight state if needed.\n // The recover is necessary if the chart was re-rendered while the highlighting is set. For example,\n // when triggered a state update from the consumer-provided tooltip footer action.\n private seriesState = new Map<string, \"\" | Highcharts.SeriesStateValue>();\n private pointState = new Map<string, Map<string, \"\" | Highcharts.PointStateValue>>();\n\n public onChartRender() {\n this.overrideStateSetters();\n this.restoreHighlightState();\n }\n\n // The method highlights specified series or points (by id). It is used when hovering over the legend items.\n public highlightChartItems = (itemIds: readonly string[]) => {\n const itemIdsSet = new Set(itemIds);\n for (const s of getChartSeries(this.context.chart())) {\n // In pie charts it is the points, not series, that are shown in the legend, and can be highlighted.\n if (s.type === \"pie\") {\n for (const p of getSeriesData(s)) {\n if (itemIdsSet.has(getPointId(p))) {\n this.setPointState(p, \"hover\");\n }\n }\n } else {\n const seriesActive = itemIdsSet.has(getSeriesId(s));\n const masterSeriesActive = s.linkedParent ? itemIdsSet.has(getSeriesId(s.linkedParent)) : false;\n this.setSeriesState(s, seriesActive || masterSeriesActive ? \"\" : \"inactive\");\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => itemIdsSet.has(lineId));\n };\n\n // This method is similar to the above, but it takes a group of points. The cartesian chart points\n // do not have IDs, so we match points and series by their references instead. This is used to control\n // highlight state when chart elements are hovered or focused.\n public highlightChartGroup = (points: readonly Highcharts.Point[]) => {\n const includedPoints = new Set<Highcharts.Point>();\n const includedSeries = new Set<SafeSeries>();\n const includedSeriesIds = new Set<string>();\n points.forEach((point) => {\n includedPoints.add(point);\n getLinkedSeries(point).forEach((s) => {\n includedSeries.add(s);\n includedSeriesIds.add(getSeriesId(s));\n });\n });\n for (const s of getChartSeries(this.context.chart())) {\n this.setSeriesState(s, includedSeries.has(s) ? \"\" : \"inactive\");\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n // See: https://github.com/highcharts/highcharts/issues/23076.\n if (s.type === \"column\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, includedPoints.has(d) ? \"\" : \"inactive\");\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => includedSeriesIds.has(lineId));\n };\n\n // This method is similar to the above, but it takes a single point. This is used for point highlighting\n // in cartesian charts, and for pie chart segments.\n public highlightChartPoint = (point: Highcharts.Point) => {\n const masterSeries = getMasterSeries(point);\n const linkedSeries = new Set(getLinkedSeries(point));\n for (const s of getChartSeries(this.context.chart())) {\n // For pie charts it is important that the hover actions comes last, as otherwise the segment's highlight \"halo\"\n // is removed whenever any segment is made inactive.\n this.setSeriesState(s, linkedSeries.has(s) ? \"hover\" : \"inactive\");\n if (s.type === \"pie\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, \"inactive\");\n }\n this.setPointState(point, \"hover\");\n }\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n else if (s.type === \"column\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, d === point ? \"hover\" : \"inactive\");\n }\n }\n }\n // Highlight threshold series plot lines.\n setPlotLinesState(this.context.chart(), (lineId) => lineId === getSeriesId(masterSeries));\n };\n\n // Removes dimmed state from all series and points.\n public clearChartItemsHighlight = () => {\n for (const s of getChartSeries(this.context.chart())) {\n this.setSeriesState(s, \"\");\n for (const p of getSeriesData(s)) {\n this.setPointState(p, \"\");\n }\n }\n setPlotLinesState(this.context.chart(), () => true);\n };\n\n // Makes the specified series active or dimmed.\n private setSeriesState(series: SafeSeries, state: \"\" | Highcharts.SeriesStateValue) {\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = false;\n series.setState(state, false);\n this.updateStoredSeriesState(series, state);\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Makes the specified point active or dimmed.\n private setPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = false;\n point.setState(state, true);\n this.updateStoredPointState(point, state);\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Restores series and points highlight state after chart's re-render.\n private restoreHighlightState() {\n const inactiveSeriesIds = new Set<string>();\n for (const s of getChartSeries(this.context.chart())) {\n const prevState = this.seriesState.get(getSeriesId(s));\n if (prevState) {\n this.setSeriesState(s, prevState);\n }\n if (prevState === \"inactive\") {\n inactiveSeriesIds.add(getSeriesId(s));\n }\n for (const p of getSeriesData(s)) {\n const prevState = this.pointState.get(getSeriesId(s))?.get(this.getPointKey(p));\n if (prevState) {\n this.setPointState(p, prevState);\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => !inactiveSeriesIds.has(lineId));\n }\n\n private updateStoredSeriesState(series: SafeSeries, state: \"\" | Highcharts.SeriesStateValue) {\n this.seriesState.set(getSeriesId(series), state);\n }\n\n private updateStoredPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n const pointStateInSeries = this.pointState.get(getSeriesId(point.series)) ?? new Map();\n pointStateInSeries.set(this.getPointKey(point), state);\n this.pointState.set(getSeriesId(point.series), pointStateInSeries);\n }\n\n // The points normally don't have ID's or names. In that case, the points are identified by\n // the combination of x and y values. This is only used to restore the highlight state after re-render.\n private getPointKey = (point: Highcharts.Point) => {\n return point.options.id ?? `${point.x}:${point.y ?? \"null\"}`;\n };\n\n // We replace `setState` method on Highcharts series and points with a custom implementation, that\n // prevents Highcharts from altering it. Instead, every state change is explicitly done by the helper.\n private overrideStateSetters = () => {\n for (const s of getChartSeries(this.context.chart())) {\n // We ensure the replacement is done only once by assigning a custom property to the function.\n // If the property is present - it means the method was already replaced.\n if ((s.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = s.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: SafeSeries[\"setState\"] = (...args) => {\n if ((overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(s, ...args);\n }\n };\n (overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n s.setState = overridden;\n }\n for (const d of getSeriesData(s)) {\n if ((d.setState as PointSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = d.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Point[\"setState\"] = (...args) => {\n if ((overridden as PointSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(d, ...args);\n }\n };\n (overridden as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n d.setState = overridden;\n }\n }\n }\n };\n}\n\n// The cartesian chart thresholds are represented with invisible series and visible plot lines.\n// When the corresponding series are highlighted, we need to make the not matching plot lines dimmed.\nfunction setPlotLinesState(chart: SafeChart, isActive: (lineId: string) => boolean) {\n iteratePlotLines(chart, (lineId, line) =>\n line.svgElem?.attr({ opacity: !isActive(lineId) ? Styles.dimmedPlotLineOpacity : 1 }),\n );\n}\n\nfunction iteratePlotLines(chart: SafeChart, cb: (lineId: string, line: Highcharts.PlotLineOrBand) => void) {\n chart.axes?.forEach((axis) => {\n // The Highcharts `Axis.plotLinesAndBands` API is not covered with TS.\n if (\"plotLinesAndBands\" in axis && Array.isArray(axis.plotLinesAndBands)) {\n axis.plotLinesAndBands.forEach((line: Highcharts.PlotLineOrBand) => {\n // We explicitly do not touch plot lines that have no ID, assuming those are decorative.\n // Only plot lines that define ID can be dimmed when certain series get highlighted.\n if (line.options.id) {\n cb(line.options.id, line);\n }\n });\n }\n });\n}\n"]}
1
+ {"version":3,"file":"chart-extra-highlight.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-highlight.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,cAAc,EAC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AiB,CAAC,KAAgB,EAAE,QAAqC;IAChF,gBAAgB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,WACvC,OAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA,EAAA,CACtF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB,EAAE,EAA6D;;IACvG,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,sEAAsE;QACtE,IAAI,mBAAmB,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAA+B,EAAE,EAAE;gBACjE,wFAAwF;gBACxF,oFAAoF;gBACpF,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;oBACpB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport {\n getChartSeries,\n getLinkedSeries,\n getMasterSeries,\n getSeriesData,\n SafeChart,\n SafeSeries,\n} from \"../../internal/utils/highcharts\";\nimport { getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst SET_STATE_LOCK = Symbol(\"awsui-set-state-lock\");\n\ntype SeriesSetStateWithLock = SafeSeries[\"setState\"] & { [SET_STATE_LOCK]: boolean };\ntype PointSetStateWithLock = Highcharts.Point[\"setState\"] & { [SET_STATE_LOCK]: boolean };\n\n// Chart helper that mutes Highcharts default highlighting behavior and offers custom methods\n// for customized control over series and points highlighting.\nexport class ChartExtraHighlight {\n private context: ChartExtraContext;\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n // We keep track of the previously highlighted series and points to recover highlight state if needed.\n // The recover is necessary if the chart was re-rendered while the highlighting is set. For example,\n // when triggered a state update from the consumer-provided tooltip footer action.\n private seriesState = new Map<string, \"\" | Highcharts.SeriesStateValue>();\n private pointState = new Map<string, Map<string, \"\" | Highcharts.PointStateValue>>();\n private columnStatesSynced = false;\n\n public onChartRender() {\n this.columnStatesSynced = false;\n this.overrideStateSetters();\n this.restoreHighlightState();\n }\n\n // The method highlights specified series or points (by id). It is used when hovering over the legend items.\n public highlightChartItems = (itemIds: readonly string[]) => {\n const itemIdsSet = new Set(itemIds);\n for (const s of getChartSeries(this.context.chart())) {\n // In pie charts it is the points, not series, that are shown in the legend, and can be highlighted.\n if (s.type === \"pie\") {\n for (const p of getSeriesData(s)) {\n if (itemIdsSet.has(getPointId(p))) {\n this.setPointState(p, \"hover\");\n }\n }\n } else {\n const seriesActive = itemIdsSet.has(getSeriesId(s));\n const masterSeriesActive = s.linkedParent ? itemIdsSet.has(getSeriesId(s.linkedParent)) : false;\n this.setSeriesState(s, seriesActive || masterSeriesActive ? \"\" : \"inactive\");\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => itemIdsSet.has(lineId));\n };\n\n // This method is similar to the above, but it takes a group of points. The cartesian chart points\n // do not have IDs, so we match points and series by their references instead. This is used to control\n // highlight state when chart elements are hovered or focused.\n public highlightChartGroup = (points: readonly Highcharts.Point[]) => {\n const includedPoints = new Set<Highcharts.Point>();\n const includedSeries = new Set<SafeSeries>();\n const includedSeriesIds = new Set<string>();\n points.forEach((point) => {\n includedPoints.add(point);\n getLinkedSeries(point).forEach((s) => {\n includedSeries.add(s);\n includedSeriesIds.add(getSeriesId(s));\n });\n });\n for (const s of getChartSeries(this.context.chart())) {\n this.setSeriesState(s, includedSeries.has(s) ? \"\" : \"inactive\");\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n // See: https://github.com/highcharts/highcharts/issues/23076.\n if (s.type === \"column\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, includedPoints.has(d) ? \"\" : \"inactive\", !this.columnStatesSynced);\n }\n }\n }\n this.columnStatesSynced = true;\n setPlotLinesState(this.context.chart(), (lineId) => includedSeriesIds.has(lineId));\n };\n\n // This method is similar to the above, but it takes a single point. This is used for point highlighting\n // in cartesian charts, and for pie chart segments.\n public highlightChartPoint = (point: Highcharts.Point) => {\n const masterSeries = getMasterSeries(point);\n const linkedSeries = new Set(getLinkedSeries(point));\n for (const s of getChartSeries(this.context.chart())) {\n // For pie charts it is important that the hover actions comes last, as otherwise the segment's highlight \"halo\"\n // is removed whenever any segment is made inactive.\n this.setSeriesState(s, linkedSeries.has(s) ? \"hover\" : \"inactive\");\n if (s.type === \"pie\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, \"inactive\");\n }\n this.setPointState(point, \"hover\");\n }\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n else if (s.type === \"column\") {\n for (const d of getSeriesData(s)) {\n this.setPointState(d, d === point ? \"hover\" : \"inactive\", !this.columnStatesSynced);\n }\n }\n }\n this.columnStatesSynced = true;\n // Highlight threshold series plot lines.\n setPlotLinesState(this.context.chart(), (lineId) => lineId === getSeriesId(masterSeries));\n };\n\n // Removes dimmed state from all series and points.\n public clearChartItemsHighlight = () => {\n for (const s of getChartSeries(this.context.chart())) {\n this.setSeriesState(s, \"\");\n for (const p of getSeriesData(s)) {\n this.setPointState(p, \"\");\n }\n }\n setPlotLinesState(this.context.chart(), () => true);\n };\n\n // Makes the specified series active or dimmed.\n private setSeriesState(series: SafeSeries, state: \"\" | Highcharts.SeriesStateValue) {\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = false;\n series.setState(state, false);\n this.updateStoredSeriesState(series, state);\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Makes the specified point active or dimmed.\n private setPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue, move = true) {\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = false;\n point.setState(state, move);\n this.updateStoredPointState(point, state);\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Restores series and points highlight state after chart's re-render.\n private restoreHighlightState() {\n const inactiveSeriesIds = new Set<string>();\n for (const s of getChartSeries(this.context.chart())) {\n const prevState = this.seriesState.get(getSeriesId(s));\n if (prevState) {\n this.setSeriesState(s, prevState);\n }\n if (prevState === \"inactive\") {\n inactiveSeriesIds.add(getSeriesId(s));\n }\n for (const p of getSeriesData(s)) {\n const prevState = this.pointState.get(getSeriesId(s))?.get(this.getPointKey(p));\n if (prevState) {\n this.setPointState(p, prevState);\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => !inactiveSeriesIds.has(lineId));\n }\n\n private updateStoredSeriesState(series: SafeSeries, state: \"\" | Highcharts.SeriesStateValue) {\n this.seriesState.set(getSeriesId(series), state);\n }\n\n private updateStoredPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n const pointStateInSeries = this.pointState.get(getSeriesId(point.series)) ?? new Map();\n pointStateInSeries.set(this.getPointKey(point), state);\n this.pointState.set(getSeriesId(point.series), pointStateInSeries);\n }\n\n // The points normally don't have ID's or names. In that case, the points are identified by\n // the combination of x and y values. This is only used to restore the highlight state after re-render.\n private getPointKey = (point: Highcharts.Point) => {\n return point.options.id ?? `${point.x}:${point.y ?? \"null\"}`;\n };\n\n // We replace `setState` method on Highcharts series and points with a custom implementation, that\n // prevents Highcharts from altering it. Instead, every state change is explicitly done by the helper.\n private overrideStateSetters = () => {\n for (const s of getChartSeries(this.context.chart())) {\n // We ensure the replacement is done only once by assigning a custom property to the function.\n // If the property is present - it means the method was already replaced.\n if ((s.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = s.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: SafeSeries[\"setState\"] = (...args) => {\n if ((overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(s, ...args);\n }\n };\n (overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n s.setState = overridden;\n }\n for (const d of getSeriesData(s)) {\n if ((d.setState as PointSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = d.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Point[\"setState\"] = (...args) => {\n if ((overridden as PointSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(d, ...args);\n }\n };\n (overridden as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n d.setState = overridden;\n }\n }\n }\n };\n}\n\n// The cartesian chart thresholds are represented with invisible series and visible plot lines.\n// When the corresponding series are highlighted, we need to make the not matching plot lines dimmed.\nfunction setPlotLinesState(chart: SafeChart, isActive: (lineId: string) => boolean) {\n iteratePlotLines(chart, (lineId, line) =>\n line.svgElem?.attr({ opacity: !isActive(lineId) ? Styles.dimmedPlotLineOpacity : 1 }),\n );\n}\n\nfunction iteratePlotLines(chart: SafeChart, cb: (lineId: string, line: Highcharts.PlotLineOrBand) => void) {\n chart.axes?.forEach((axis) => {\n // The Highcharts `Axis.plotLinesAndBands` API is not covered with TS.\n if (\"plotLinesAndBands\" in axis && Array.isArray(axis.plotLinesAndBands)) {\n axis.plotLinesAndBands.forEach((line: Highcharts.PlotLineOrBand) => {\n // We explicitly do not touch plot lines that have no ID, assuming those are decorative.\n // Only plot lines that define ID can be dimmed when certain series get highlighted.\n if (line.options.id) {\n cb(line.options.id, line);\n }\n });\n }\n });\n}\n"]}
@@ -33,6 +33,7 @@ export declare class ChartExtraNavigation {
33
33
  onChartDestroy(): void;
34
34
  setApplication: (element: null | HTMLElement) => void;
35
35
  focusApplication(point: null | Highcharts.Point, group: readonly Highcharts.Point[]): void;
36
+ focusChartApplication(): void;
36
37
  announceChart(ariaLabel: string): void;
37
38
  announceElement(ariaLabel: string, pinned: boolean): void;
38
39
  private announce;
@@ -68,6 +69,7 @@ export declare class ChartExtraNavigation {
68
69
  private get allX();
69
70
  private getSeriesPoints;
70
71
  private getPointsByX;
72
+ private isNavigable;
71
73
  private findMatchingGroup;
72
74
  private findFirstGroup;
73
75
  private findLastGroup;
@@ -152,6 +152,9 @@ export class ChartExtraNavigation {
152
152
  this.getPointsByX = (x) => {
153
153
  return this.context.derived.getPointsByX(x);
154
154
  };
155
+ this.isNavigable = (point) => {
156
+ return this.getPointsByX(point.x).includes(point);
157
+ };
155
158
  this.findMatchingGroup = (point) => {
156
159
  return this.getPointsByX(point.x);
157
160
  };
@@ -235,6 +238,15 @@ export class ChartExtraNavigation {
235
238
  (_a = this.applicationElement) === null || _a === void 0 ? void 0 : _a.focus();
236
239
  }
237
240
  }
241
+ // Casting focus to the application element with the chart itself as the focus target. This is used when the
242
+ // element that held focus is removed from the chart, for instance the zoom reset button.
243
+ focusChartApplication() {
244
+ var _a;
245
+ if (this.context.settings.keyboardNavigationEnabled) {
246
+ this.focusedState = { type: "chart" };
247
+ (_a = this.applicationElement) === null || _a === void 0 ? void 0 : _a.focus();
248
+ }
249
+ }
238
250
  announceChart(ariaLabel) {
239
251
  this.announce({ role: "application", "aria-label": ariaLabel });
240
252
  }
@@ -384,9 +396,9 @@ export class ChartExtraNavigation {
384
396
  focusGroup(group) {
385
397
  var _a;
386
398
  // When the chart is re-focused, the group that was focused before might no longer be valid if its
387
- // points are no longer visible or were destroyed by Highcharts. In that case we focus the chart as
388
- // a fallback.
389
- const visiblePoints = group.filter(isPointVisible);
399
+ // points are no longer visible, are outside the x-axis extremes, or were destroyed by Highcharts. In that
400
+ // case we focus the chart as a fallback.
401
+ const visiblePoints = group.filter((point) => isPointVisible(point) && this.isNavigable(point));
390
402
  if (visiblePoints.length === 0) {
391
403
  this.focusChart();
392
404
  }
@@ -404,8 +416,9 @@ export class ChartExtraNavigation {
404
416
  }
405
417
  focusPoint(point, group) {
406
418
  // When the chart is re-focused, the point that was focused before might no longer be valid it became
407
- // hidden or was destroyed by Highcharts. In that case we focus the point's parent group as a fallback.
408
- if (!point || !isPointVisible(point)) {
419
+ // hidden, moved outside the x-axis extremes, or was destroyed by Highcharts. In that case we focus the
420
+ // point's parent group as a fallback.
421
+ if (!point || !isPointVisible(point) || !this.isNavigable(point)) {
409
422
  this.focusGroup(group);
410
423
  }
411
424
  // When focusing a point we draw the focus outline around its corresponding rect, but with different offsets,
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-navigation.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,SAAS,IAAI,gBAAgB,EAC7B,OAAO,GACR,MAAM,+CAA+C,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAc,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGpE,0FAA0F;AAC1F,qEAAqE;AACrE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AA6BlC,uFAAuF;AACvF,kGAAkG;AAClG,+FAA+F;AAC/F,0GAA0G;AAC1G,4GAA4G;AAC5G,MAAM,OAAO,oBAAoB;IAY/B,YAAY,OAA0B,EAAE,QAAsC;QAR9E,0GAA0G;QAC1G,iHAAiH;QACjH,gHAAgH;QAChH,4BAA4B;QACpB,uBAAkB,GAAuB,IAAI,CAAC;QAC9C,iBAAY,GAAwB,IAAI,CAAC;QACzC,gBAAW,GAAG,KA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BACb,CAAC,EAAE,CAAC,GAAG,MAAM;gBACb,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC;gBACzB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC;gBAC3B,GAAG,MAAM,CAAC,sBAAsB;aACjC,CAAC,CAAC;QACL,CAAC,CAAC;QAxCA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAsBM,IAAI;QACT,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;CAYF;AAED,yFAAyF;AACzF,sEAAsE;AACtE,SAAS,2BAA2B,CAAC,KAAuB;IAC1D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB,EAAE,UAAkB,EAAE,KAAa;IACvE,OAAO,WAAW,CAAC,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB,EAAE,UAAkB,EAAE,KAAa;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport {\n circleIndex,\n getIsRtl,\n handleKey as toolkitHandleKey,\n KeyCode,\n} from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { isPointVisible, SafeSeries } from \"../../internal/utils/highcharts\";\nimport { SVGRendererPool } from \"../../internal/utils/renderer-utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, isXThreshold } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\n// In charts with many data points one can navigate faster by using Page Down/Up keys that\n// navigate PAGE_SIZE_PERCENTAGE of the points forwards or backwards.\nconst PAGE_SIZE_PERCENTAGE = 0.05;\n\nexport interface ChartExtraNavigationHandlers {\n onFocusChart(): void;\n onFocusPoint(point: Highcharts.Point, group: readonly Highcharts.Point[]): void;\n onFocusGroup(group: readonly Highcharts.Point[]): void;\n onBlur(): void;\n onActivatePoint(point: Highcharts.Point, group: readonly Highcharts.Point[]): void;\n onActivateGroup(group: readonly Highcharts.Point[]): void;\n // Returns true if a tooltip was dismissed, false otherwise.\n // Used by ESC handlers to decide whether to also navigate.\n onDismissHoverTooltip(): boolean;\n}\n\nexport type FocusedState = FocusedStateChart | FocusedStateGroup | FocusedStatePoint;\n\ninterface FocusedStateChart {\n type: \"chart\";\n}\ninterface FocusedStateGroup {\n type: \"group\";\n group: readonly Highcharts.Point[];\n}\ninterface FocusedStatePoint {\n type: \"point\";\n point: Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Navigation controller handles focus behavior and keyboard navigation for all charts.\n// When the chart is first focused, the focus lands on the chart plot. Once navigation is engaged,\n// the focus can land either on the group of points matched by X value, or on a specific point.\n// The focused X value and point are stored so that navigating back to the chart will focus the previously\n// focused point. If the stored point no longer belongs to the chart the focus falls back to the chart plot.\nexport class ChartExtraNavigation {\n private context: ChartExtraContext;\n private handlers: ChartExtraNavigationHandlers;\n private focusOutline: FocusOutline;\n // The application element is a dom element with role=\"application\", rendered right before the chart plot.\n // When the application element is in focus, the keyboard navigation is possible. Upon using navigation commands,\n // we bring the visible focus state to the chart elements, such as points and groups of points. The last visible\n // focus state is persisted.\n private applicationElement: null | HTMLElement = null;\n private focusedState: null | FocusedState = null;\n private ignoreFocus = false;\n\n constructor(context: ChartExtraContext, handlers: ChartExtraNavigationHandlers) {\n this.context = context;\n this.handlers = handlers;\n this.focusOutline = new FocusOutline(context);\n }\n\n public onChartDestroy() {\n this.focusOutline.destroy();\n }\n\n // This function is used as React ref on the application element, positioned right before the chart plot in the DOM.\n // Once the element reference is obtained, we assign the required event listeners directly to the element.\n // That is done for simplicity to avoid passing React event handlers down to the element.\n public setApplication = (element: null | HTMLElement) => {\n if (this.applicationElement) {\n this.applicationElement.removeEventListener(\"focus\", this.onFocus);\n this.applicationElement.removeEventListener(\"blur\", this.onBlur);\n this.applicationElement.removeEventListener(\"keydown\", this.onKeyDown);\n }\n\n if (this.context.settings.keyboardNavigationEnabled || !element) {\n this.applicationElement = element;\n }\n\n if (this.applicationElement) {\n this.applicationElement.addEventListener(\"focus\", this.onFocus);\n this.applicationElement.addEventListener(\"blur\", this.onBlur);\n this.applicationElement.addEventListener(\"keydown\", this.onKeyDown);\n }\n };\n\n // Casting focus to the application element brings the visible focus state to the chart or last focused\n // chart point or group of points. This is used to restore focus after the tooltip is dismissed.\n public focusApplication(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n if (this.context.settings.keyboardNavigationEnabled) {\n this.focusedState = point ? { type: \"point\", point, group } : { type: \"group\", group };\n this.applicationElement?.focus();\n }\n }\n\n public announceChart(ariaLabel: string) {\n this.announce({ role: \"application\", \"aria-label\": ariaLabel });\n }\n\n public announceElement(ariaLabel: string, pinned: boolean) {\n this.announce({ role: \"button\", \"aria-label\": ariaLabel, \"aria-haspopup\": true, \"aria-expanded\": pinned });\n }\n\n // Every time the chart focus is obtained or a navigation action is performed, this needs to be announced\n // to screen-readers. The announcement is made by updating the application element with the attributes of\n // the visually focused element (chart, point, or group), and re-focusing it.\n private announce(elementAttributes: React.ButtonHTMLAttributes<unknown>) {\n if (this.applicationElement) {\n // Remove prev attributes.\n for (const attributeName of this.applicationElement.getAttributeNames()) {\n if (attributeName === \"role\" || attributeName.slice(0, 4) === \"aria\") {\n this.applicationElement.removeAttribute(attributeName);\n }\n }\n // Copy new attributes.\n for (const [attributeName, attributeValue] of Object.entries(elementAttributes)) {\n this.applicationElement.setAttribute(attributeName, `${attributeValue}`);\n }\n // Temporarily disable focus/blur event handlers to not respond to the next programmatically\n // cast focus event, which has the only purpose of making the application element announced to\n // the assistive software.\n this.ignoreFocus = true;\n // Re-attach and re-focus application element to trigger a screen-reader announcement.\n const container = this.applicationElement.parentElement!;\n container.removeChild(this.applicationElement);\n container.appendChild(this.applicationElement);\n this.applicationElement.focus({ preventScroll: true });\n // Remove focus lock. The blur and focus events should have already occurred at this point.\n setTimeout(() => (this.ignoreFocus = false), 0);\n }\n }\n\n // Upon obtaining focus, we show the visible focus state and announce the previously focused element\n // (chart, point, or group). If the previously focused point or group is no longer available, the focus\n // is shown for their respective parent.\n private onFocus = () => {\n if (!this.ignoreFocus) {\n if (!this.focusedState || this.focusedState.type === \"chart\") {\n this.focusChart();\n } else if (this.focusedState.type === \"group\") {\n this.focusGroup(this.focusedState.group);\n } else {\n this.focusPoint(this.focusedState.point, this.focusedState.group);\n }\n }\n };\n\n private onBlur = () => {\n if (!this.ignoreFocus) {\n this.focusOutline.hide();\n this.handlers.onBlur();\n }\n };\n\n private onKeyDown = (event: KeyboardEvent) => {\n // The `handleKey` helper we use does not prevent the default keys behavior, so we do it here for\n // all used keyboard commands. We also stop propagation to prevent the global escape handler in\n // chart-core.tsx from interfering with navigation - when keyboard navigation is active, this\n // handler is the authoritative one for all navigation keys.\n if (\n [\n KeyCode.up,\n KeyCode.down,\n KeyCode.left,\n KeyCode.right,\n KeyCode.enter,\n KeyCode.escape,\n KeyCode.pageUp,\n KeyCode.pageDown,\n KeyCode.home,\n KeyCode.end,\n ].includes(event.keyCode)\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n // We execute different actions depending on the current focus target (chart, group, or point).\n // It is expected, that the focused element is still available in the chart.\n if (this.focusedState && this.focusedState.type === \"group\") {\n this.onKeyDownGroup(event, this.focusedState.group);\n } else if (this.focusedState && this.focusedState.type === \"point\") {\n this.onKeyDownPoint(event, this.focusedState.point, this.focusedState.group);\n } else {\n this.onKeyDownChart(event);\n }\n };\n\n private onKeyDownChart = (event: KeyboardEvent) => {\n handleKey(event, {\n onActivate: () => this.moveToFirstGroup(),\n onEscape: () => this.handlers.onDismissHoverTooltip(),\n onInlineStart: () => this.moveToLastGroup(),\n onInlineEnd: () => this.moveToFirstGroup(),\n onBlockStart: () => this.moveToLastGroup(),\n onBlockEnd: () => this.moveToFirstGroup(),\n onHome: () => this.moveToFirstGroup(),\n onEnd: () => this.moveToLastGroup(),\n });\n };\n\n private onKeyDownGroup = (event: KeyboardEvent, group: readonly Highcharts.Point[]) => {\n const i = !!this.context.chart().inverted;\n handleKey(event, {\n onActivate: () => this.activateGroup(group),\n onEscape: () => {\n if (!this.handlers.onDismissHoverTooltip()) {\n this.moveToChart();\n }\n },\n onInlineStart: () => (i ? this.moveToFirstInGroup(group) : this.moveToPrevGroup(group)),\n onInlineEnd: () => (i ? this.moveToLastInGroup(group) : this.moveToNextGroup(group)),\n onBlockStart: () => (i ? this.moveToPrevGroup(group) : this.moveToLastInGroup(group)),\n onBlockEnd: () => (i ? this.moveToNextGroup(group) : this.moveToFirstInGroup(group)),\n onPageDown: () => this.moveToNextPageGroup(group),\n onPageUp: () => this.moveToPrevPageGroup(group),\n onHome: () => this.moveToFirstGroup(),\n onEnd: () => this.moveToLastGroup(),\n });\n };\n\n private onKeyDownPoint = (event: KeyboardEvent, point: Highcharts.Point, group: readonly Highcharts.Point[]) => {\n const i = !!this.context.chart().inverted;\n handleKey(event, {\n onActivate: () => this.activatePoint(point, group),\n onEscape: () => {\n if (!this.handlers.onDismissHoverTooltip()) {\n this.moveToParentGroup(point);\n }\n },\n onInlineEnd: () => (i ? this.moveToPrevInGroup(point) : this.moveToNextInSeries(point)),\n onInlineStart: () => (i ? this.moveToNextInGroup(point) : this.moveToPrevInSeries(point)),\n onBlockEnd: () => (i ? this.moveToNextInSeries(point) : this.moveToNextInGroup(point)),\n onBlockStart: () => (i ? this.moveToPrevInSeries(point) : this.moveToPrevInGroup(point)),\n onPageDown: () => this.moveToNextPageInSeries(point),\n onPageUp: () => this.moveToPrevPageInSeries(point),\n onHome: () => this.moveToFirstInSeries(point),\n onEnd: () => this.moveToLastInSeries(point),\n });\n };\n\n private moveToFirstGroup() {\n this.focusGroup(this.findFirstGroup());\n }\n\n private moveToLastGroup() {\n this.focusGroup(this.findLastGroup());\n }\n\n private moveToNextGroup(group: readonly Highcharts.Point[]) {\n const nextGroup = group[0] ? this.findNextGroup(group[0]) : [];\n this.focusGroup(nextGroup);\n }\n\n private moveToPrevGroup(group: readonly Highcharts.Point[]) {\n const prevGroup = group[0] ? this.findPrevGroup(group[0]) : [];\n this.focusGroup(prevGroup);\n }\n\n private moveToParentGroup(point: Highcharts.Point) {\n const group = this.findMatchingGroup(point);\n if (group.length > 0 && group[0].series.type !== \"pie\") {\n this.focusGroup(group);\n } else {\n this.focusChart();\n }\n }\n\n private moveToChart() {\n this.focusChart();\n }\n\n private moveToFirstInGroup(group: readonly Highcharts.Point[]) {\n const points = group.filter((p) => !isXThreshold(p.series));\n this.focusPoint(points[0], group);\n }\n\n private moveToLastInGroup(group: readonly Highcharts.Point[]) {\n const points = group.filter((p) => !isXThreshold(p.series));\n this.focusPoint(points[points.length - 1], group);\n }\n\n private moveToPrevInGroup(point: Highcharts.Point) {\n const points = this.findMatchingGroup(point).filter((p) => !isXThreshold(p.series));\n const pointIndex = points.indexOf(point);\n this.focusPoint(points[circleIndex(pointIndex - 1, [0, points.length - 1])], points);\n }\n\n private moveToNextInGroup(point: Highcharts.Point) {\n const points = this.findMatchingGroup(point).filter((p) => !isXThreshold(p.series));\n const pointIndex = points.indexOf(point);\n this.focusPoint(points[circleIndex(pointIndex + 1, [0, points.length - 1])], points);\n }\n\n private moveToFirstInSeries(point: Highcharts.Point) {\n const firstPoint = this.findFirstPointInSeries(point);\n if (firstPoint) {\n this.focusPoint(firstPoint, this.findMatchingGroup(firstPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToLastInSeries(point: Highcharts.Point) {\n const lastPoint = this.findLastPointInSeries(point);\n if (lastPoint) {\n this.focusPoint(lastPoint, this.findMatchingGroup(lastPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToNextInSeries(point: Highcharts.Point) {\n const nextPoint = this.findNextPointInSeries(point);\n if (nextPoint) {\n this.focusPoint(nextPoint, this.findMatchingGroup(nextPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToPrevInSeries(point: Highcharts.Point) {\n const prevPoint = this.findPrevPointInSeries(point);\n if (prevPoint) {\n this.focusPoint(prevPoint, this.findMatchingGroup(prevPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToNextPageGroup(group: readonly Highcharts.Point[]) {\n const nextPageGroup = group[0] ? this.findNextPageGroup(group[0]) : [];\n this.focusGroup(nextPageGroup);\n }\n\n private moveToPrevPageGroup(group: readonly Highcharts.Point[]) {\n const prevPageGroup = group[0] ? this.findPrevPageGroup(group[0]) : [];\n this.focusGroup(prevPageGroup);\n }\n\n private moveToNextPageInSeries(point: Highcharts.Point) {\n const nextPagePoint = this.findNextPagePointInSeries(point);\n if (nextPagePoint) {\n this.focusPoint(nextPagePoint, this.findMatchingGroup(nextPagePoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToPrevPageInSeries(point: Highcharts.Point) {\n const prevPagePoint = this.findPrevPagePointInSeries(point);\n if (prevPagePoint) {\n this.focusPoint(prevPagePoint, this.findMatchingGroup(prevPagePoint));\n } else {\n this.focusChart();\n }\n }\n\n private activateGroup(group: readonly Highcharts.Point[]) {\n this.handlers.onActivateGroup(group);\n }\n\n private activatePoint(point: Highcharts.Point, group: readonly Highcharts.Point[]) {\n this.handlers.onActivatePoint(point, group);\n }\n\n private focusChart = () => {\n this.focusedState = { type: \"chart\" };\n this.focusOutline.chart();\n this.handlers.onFocusChart();\n };\n\n private focusGroup(group: readonly Highcharts.Point[]) {\n // When the chart is re-focused, the group that was focused before might no longer be valid if its\n // points are no longer visible or were destroyed by Highcharts. In that case we focus the chart as\n // a fallback.\n const visiblePoints = group.filter(isPointVisible);\n if (visiblePoints.length === 0) {\n this.focusChart();\n }\n // In pie charts we only focus points, so moving focus to points and groups is equivalent.\n else if (visiblePoints[0].series.type === \"pie\") {\n this.focusPoint(visiblePoints[0] ?? null, group);\n }\n // When focusing a group we draw the focus outline around the corresponding group rect, including\n // all points of that group.\n else {\n this.focusedState = { type: \"group\", group: visiblePoints };\n this.focusOutline.group(getGroupRect(visiblePoints));\n this.handlers.onFocusGroup(visiblePoints);\n }\n }\n\n private focusPoint(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n // When the chart is re-focused, the point that was focused before might no longer be valid it became\n // hidden or was destroyed by Highcharts. In that case we focus the point's parent group as a fallback.\n if (!point || !isPointVisible(point)) {\n this.focusGroup(group);\n }\n // When focusing a point we draw the focus outline around its corresponding rect, but with different offsets,\n // depending on the point's series type.\n else {\n this.focusedState = { type: \"point\", point, group };\n this.focusOutline.point(getPointRect(point), point);\n this.handlers.onFocusPoint(point, group);\n }\n }\n\n private get allX(): number[] {\n return this.context.derived.allX;\n }\n\n // Returns all series data points to navigate by. When a series is linked with other series - the method returns\n // all points from the linked series.\n private getSeriesPoints(series: SafeSeries): Highcharts.Point[] {\n return this.context.derived.getSeriesPoints(series);\n }\n\n private getPointsByX = (x: number): Highcharts.Point[] => {\n return this.context.derived.getPointsByX(x);\n };\n\n private findMatchingGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n return this.getPointsByX(point.x);\n };\n\n private findFirstGroup = (): Highcharts.Point[] => {\n return this.getPointsByX(this.allX[0]);\n };\n\n private findLastGroup = (): Highcharts.Point[] => {\n return this.getPointsByX(this.allX[this.allX.length - 1]);\n };\n\n private findNextGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextIndex(this.allX, this.allX.indexOf(point.x), 1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findPrevGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextIndex(this.allX, this.allX.indexOf(point.x), -1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findNextPageGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextPageIndex(this.allX, this.allX.indexOf(point.x), 1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findPrevPageGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextPageIndex(this.allX, this.allX.indexOf(point.x), -1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findFirstPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n return seriesPoints[0] ?? null;\n };\n\n private findLastPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n return seriesPoints[seriesPoints.length - 1] ?? null;\n };\n\n private findNextPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? 1 : -1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findPrevPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? -1 : 1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findNextPagePointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? 1 : -1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextPageIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findPrevPagePointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? -1 : 1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextPageIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n}\n\nfunction handleKey(\n event: KeyboardEvent,\n handlers: {\n onActivate?: () => void;\n onBlockEnd?: () => void;\n onBlockStart?: () => void;\n onDefault?: () => void;\n onEnd?: () => void;\n onEscape?: () => void;\n onHome?: () => void;\n onInlineEnd?: () => void;\n onInlineStart?: () => void;\n onPageDown?: () => void;\n onPageUp?: () => void;\n },\n) {\n if (!event.currentTarget) {\n return;\n }\n if (!(event.currentTarget instanceof HTMLElement) && !(event.currentTarget instanceof SVGElement)) {\n return;\n }\n toolkitHandleKey({ keyCode: event.keyCode, currentTarget: event.currentTarget }, handlers);\n}\n\n// A helper class to draw the focus outline around given chart elements.\nclass FocusOutline {\n private context: ChartExtraContext;\n private elementsPool = new SVGRendererPool();\n\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n public chart = () => {\n const [x, y, width, height] = [\n this.context.chart().plotLeft,\n this.context.chart().plotTop,\n this.context.chart().plotWidth,\n this.context.chart().plotHeight,\n ];\n this.rect({ x, y, width, height }, Styles.focusOutlineOffsets.chart);\n };\n\n public group = (rect: Rect) => {\n this.rect(rect, Styles.focusOutlineOffsets.group);\n };\n\n public point = (rect: Rect, point: Highcharts.Point) => {\n const offsetByType = Styles.focusOutlineOffsets.pointByType[point.series.type];\n const offset = offsetByType ?? Styles.focusOutlineOffsets.point;\n this.rect(rect, offset);\n };\n\n public hide() {\n this.elementsPool.hideAll();\n }\n\n public destroy() {\n this.elementsPool.destroyAll();\n }\n\n private rect = ({ x, y, width, height }: Rect, offset: number) => {\n this.elementsPool.hideAll();\n this.elementsPool.rect(this.context.chart().renderer, {\n x: x - offset,\n y: y - offset,\n width: width + offset * 2,\n height: height + offset * 2,\n ...Styles.navigationFocusOutline,\n });\n };\n}\n\n// We do not invert the direction of pie segments when RTL, but swap the left/right keys.\n// To offset for that, the prev/next points direction is swapped, too.\nfunction shouldInvertPointsDirection(point: Highcharts.Point) {\n const isRTL = getIsRtl(point.series.chart.container.parentElement);\n return point.series.type === \"pie\" && isRTL;\n}\n\nfunction getNextIndex(array: unknown[], pointIndex: number, delta: -1 | 1): number {\n return circleIndex(pointIndex + delta, [0, array.length - 1]);\n}\n\nfunction getNextPageIndex(array: unknown[], pointIndex: number, delta: -1 | 1): number {\n return Math.min(array.length - 1, Math.max(0, pointIndex + delta * Math.round(array.length * PAGE_SIZE_PERCENTAGE)));\n}\n"]}
1
+ {"version":3,"file":"chart-extra-navigation.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,SAAS,IAAI,gBAAgB,EAC7B,OAAO,GACR,MAAM,+CAA+C,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAc,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGpE,0FAA0F;AAC1F,qEAAqE;AACrE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AA6BlC,uFAAuF;AACvF,kGAAkG;AAClG,+FAA+F;AAC/F,0GAA0G;AAC1G,4GAA4G;AAC5G,MAAM,OAAO,oBAAoB;IAY/B,YAAY,OAA0B,EAAE,QAAsC;QA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AC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB,EAAE,UAAkB,EAAE,KAAa;IACvE,OAAO,WAAW,CAAC,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB,EAAE,UAAkB,EAAE,KAAa;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport {\n circleIndex,\n getIsRtl,\n handleKey as toolkitHandleKey,\n KeyCode,\n} from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { isPointVisible, SafeSeries } from \"../../internal/utils/highcharts\";\nimport { SVGRendererPool } from \"../../internal/utils/renderer-utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, isXThreshold } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\n// In charts with many data points one can navigate faster by using Page Down/Up keys that\n// navigate PAGE_SIZE_PERCENTAGE of the points forwards or backwards.\nconst PAGE_SIZE_PERCENTAGE = 0.05;\n\nexport interface ChartExtraNavigationHandlers {\n onFocusChart(): void;\n onFocusPoint(point: Highcharts.Point, group: readonly Highcharts.Point[]): void;\n onFocusGroup(group: readonly Highcharts.Point[]): void;\n onBlur(): void;\n onActivatePoint(point: Highcharts.Point, group: readonly Highcharts.Point[]): void;\n onActivateGroup(group: readonly Highcharts.Point[]): void;\n // Returns true if a tooltip was dismissed, false otherwise.\n // Used by ESC handlers to decide whether to also navigate.\n onDismissHoverTooltip(): boolean;\n}\n\nexport type FocusedState = FocusedStateChart | FocusedStateGroup | FocusedStatePoint;\n\ninterface FocusedStateChart {\n type: \"chart\";\n}\ninterface FocusedStateGroup {\n type: \"group\";\n group: readonly Highcharts.Point[];\n}\ninterface FocusedStatePoint {\n type: \"point\";\n point: Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Navigation controller handles focus behavior and keyboard navigation for all charts.\n// When the chart is first focused, the focus lands on the chart plot. Once navigation is engaged,\n// the focus can land either on the group of points matched by X value, or on a specific point.\n// The focused X value and point are stored so that navigating back to the chart will focus the previously\n// focused point. If the stored point no longer belongs to the chart the focus falls back to the chart plot.\nexport class ChartExtraNavigation {\n private context: ChartExtraContext;\n private handlers: ChartExtraNavigationHandlers;\n private focusOutline: FocusOutline;\n // The application element is a dom element with role=\"application\", rendered right before the chart plot.\n // When the application element is in focus, the keyboard navigation is possible. Upon using navigation commands,\n // we bring the visible focus state to the chart elements, such as points and groups of points. The last visible\n // focus state is persisted.\n private applicationElement: null | HTMLElement = null;\n private focusedState: null | FocusedState = null;\n private ignoreFocus = false;\n\n constructor(context: ChartExtraContext, handlers: ChartExtraNavigationHandlers) {\n this.context = context;\n this.handlers = handlers;\n this.focusOutline = new FocusOutline(context);\n }\n\n public onChartDestroy() {\n this.focusOutline.destroy();\n }\n\n // This function is used as React ref on the application element, positioned right before the chart plot in the DOM.\n // Once the element reference is obtained, we assign the required event listeners directly to the element.\n // That is done for simplicity to avoid passing React event handlers down to the element.\n public setApplication = (element: null | HTMLElement) => {\n if (this.applicationElement) {\n this.applicationElement.removeEventListener(\"focus\", this.onFocus);\n this.applicationElement.removeEventListener(\"blur\", this.onBlur);\n this.applicationElement.removeEventListener(\"keydown\", this.onKeyDown);\n }\n\n if (this.context.settings.keyboardNavigationEnabled || !element) {\n this.applicationElement = element;\n }\n\n if (this.applicationElement) {\n this.applicationElement.addEventListener(\"focus\", this.onFocus);\n this.applicationElement.addEventListener(\"blur\", this.onBlur);\n this.applicationElement.addEventListener(\"keydown\", this.onKeyDown);\n }\n };\n\n // Casting focus to the application element brings the visible focus state to the chart or last focused\n // chart point or group of points. This is used to restore focus after the tooltip is dismissed.\n public focusApplication(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n if (this.context.settings.keyboardNavigationEnabled) {\n this.focusedState = point ? { type: \"point\", point, group } : { type: \"group\", group };\n this.applicationElement?.focus();\n }\n }\n\n // Casting focus to the application element with the chart itself as the focus target. This is used when the\n // element that held focus is removed from the chart, for instance the zoom reset button.\n public focusChartApplication() {\n if (this.context.settings.keyboardNavigationEnabled) {\n this.focusedState = { type: \"chart\" };\n this.applicationElement?.focus();\n }\n }\n\n public announceChart(ariaLabel: string) {\n this.announce({ role: \"application\", \"aria-label\": ariaLabel });\n }\n\n public announceElement(ariaLabel: string, pinned: boolean) {\n this.announce({ role: \"button\", \"aria-label\": ariaLabel, \"aria-haspopup\": true, \"aria-expanded\": pinned });\n }\n\n // Every time the chart focus is obtained or a navigation action is performed, this needs to be announced\n // to screen-readers. The announcement is made by updating the application element with the attributes of\n // the visually focused element (chart, point, or group), and re-focusing it.\n private announce(elementAttributes: React.ButtonHTMLAttributes<unknown>) {\n if (this.applicationElement) {\n // Remove prev attributes.\n for (const attributeName of this.applicationElement.getAttributeNames()) {\n if (attributeName === \"role\" || attributeName.slice(0, 4) === \"aria\") {\n this.applicationElement.removeAttribute(attributeName);\n }\n }\n // Copy new attributes.\n for (const [attributeName, attributeValue] of Object.entries(elementAttributes)) {\n this.applicationElement.setAttribute(attributeName, `${attributeValue}`);\n }\n // Temporarily disable focus/blur event handlers to not respond to the next programmatically\n // cast focus event, which has the only purpose of making the application element announced to\n // the assistive software.\n this.ignoreFocus = true;\n // Re-attach and re-focus application element to trigger a screen-reader announcement.\n const container = this.applicationElement.parentElement!;\n container.removeChild(this.applicationElement);\n container.appendChild(this.applicationElement);\n this.applicationElement.focus({ preventScroll: true });\n // Remove focus lock. The blur and focus events should have already occurred at this point.\n setTimeout(() => (this.ignoreFocus = false), 0);\n }\n }\n\n // Upon obtaining focus, we show the visible focus state and announce the previously focused element\n // (chart, point, or group). If the previously focused point or group is no longer available, the focus\n // is shown for their respective parent.\n private onFocus = () => {\n if (!this.ignoreFocus) {\n if (!this.focusedState || this.focusedState.type === \"chart\") {\n this.focusChart();\n } else if (this.focusedState.type === \"group\") {\n this.focusGroup(this.focusedState.group);\n } else {\n this.focusPoint(this.focusedState.point, this.focusedState.group);\n }\n }\n };\n\n private onBlur = () => {\n if (!this.ignoreFocus) {\n this.focusOutline.hide();\n this.handlers.onBlur();\n }\n };\n\n private onKeyDown = (event: KeyboardEvent) => {\n // The `handleKey` helper we use does not prevent the default keys behavior, so we do it here for\n // all used keyboard commands. We also stop propagation to prevent the global escape handler in\n // chart-core.tsx from interfering with navigation - when keyboard navigation is active, this\n // handler is the authoritative one for all navigation keys.\n if (\n [\n KeyCode.up,\n KeyCode.down,\n KeyCode.left,\n KeyCode.right,\n KeyCode.enter,\n KeyCode.escape,\n KeyCode.pageUp,\n KeyCode.pageDown,\n KeyCode.home,\n KeyCode.end,\n ].includes(event.keyCode)\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n // We execute different actions depending on the current focus target (chart, group, or point).\n // It is expected, that the focused element is still available in the chart.\n if (this.focusedState && this.focusedState.type === \"group\") {\n this.onKeyDownGroup(event, this.focusedState.group);\n } else if (this.focusedState && this.focusedState.type === \"point\") {\n this.onKeyDownPoint(event, this.focusedState.point, this.focusedState.group);\n } else {\n this.onKeyDownChart(event);\n }\n };\n\n private onKeyDownChart = (event: KeyboardEvent) => {\n handleKey(event, {\n onActivate: () => this.moveToFirstGroup(),\n onEscape: () => this.handlers.onDismissHoverTooltip(),\n onInlineStart: () => this.moveToLastGroup(),\n onInlineEnd: () => this.moveToFirstGroup(),\n onBlockStart: () => this.moveToLastGroup(),\n onBlockEnd: () => this.moveToFirstGroup(),\n onHome: () => this.moveToFirstGroup(),\n onEnd: () => this.moveToLastGroup(),\n });\n };\n\n private onKeyDownGroup = (event: KeyboardEvent, group: readonly Highcharts.Point[]) => {\n const i = !!this.context.chart().inverted;\n handleKey(event, {\n onActivate: () => this.activateGroup(group),\n onEscape: () => {\n if (!this.handlers.onDismissHoverTooltip()) {\n this.moveToChart();\n }\n },\n onInlineStart: () => (i ? this.moveToFirstInGroup(group) : this.moveToPrevGroup(group)),\n onInlineEnd: () => (i ? this.moveToLastInGroup(group) : this.moveToNextGroup(group)),\n onBlockStart: () => (i ? this.moveToPrevGroup(group) : this.moveToLastInGroup(group)),\n onBlockEnd: () => (i ? this.moveToNextGroup(group) : this.moveToFirstInGroup(group)),\n onPageDown: () => this.moveToNextPageGroup(group),\n onPageUp: () => this.moveToPrevPageGroup(group),\n onHome: () => this.moveToFirstGroup(),\n onEnd: () => this.moveToLastGroup(),\n });\n };\n\n private onKeyDownPoint = (event: KeyboardEvent, point: Highcharts.Point, group: readonly Highcharts.Point[]) => {\n const i = !!this.context.chart().inverted;\n handleKey(event, {\n onActivate: () => this.activatePoint(point, group),\n onEscape: () => {\n if (!this.handlers.onDismissHoverTooltip()) {\n this.moveToParentGroup(point);\n }\n },\n onInlineEnd: () => (i ? this.moveToPrevInGroup(point) : this.moveToNextInSeries(point)),\n onInlineStart: () => (i ? this.moveToNextInGroup(point) : this.moveToPrevInSeries(point)),\n onBlockEnd: () => (i ? this.moveToNextInSeries(point) : this.moveToNextInGroup(point)),\n onBlockStart: () => (i ? this.moveToPrevInSeries(point) : this.moveToPrevInGroup(point)),\n onPageDown: () => this.moveToNextPageInSeries(point),\n onPageUp: () => this.moveToPrevPageInSeries(point),\n onHome: () => this.moveToFirstInSeries(point),\n onEnd: () => this.moveToLastInSeries(point),\n });\n };\n\n private moveToFirstGroup() {\n this.focusGroup(this.findFirstGroup());\n }\n\n private moveToLastGroup() {\n this.focusGroup(this.findLastGroup());\n }\n\n private moveToNextGroup(group: readonly Highcharts.Point[]) {\n const nextGroup = group[0] ? this.findNextGroup(group[0]) : [];\n this.focusGroup(nextGroup);\n }\n\n private moveToPrevGroup(group: readonly Highcharts.Point[]) {\n const prevGroup = group[0] ? this.findPrevGroup(group[0]) : [];\n this.focusGroup(prevGroup);\n }\n\n private moveToParentGroup(point: Highcharts.Point) {\n const group = this.findMatchingGroup(point);\n if (group.length > 0 && group[0].series.type !== \"pie\") {\n this.focusGroup(group);\n } else {\n this.focusChart();\n }\n }\n\n private moveToChart() {\n this.focusChart();\n }\n\n private moveToFirstInGroup(group: readonly Highcharts.Point[]) {\n const points = group.filter((p) => !isXThreshold(p.series));\n this.focusPoint(points[0], group);\n }\n\n private moveToLastInGroup(group: readonly Highcharts.Point[]) {\n const points = group.filter((p) => !isXThreshold(p.series));\n this.focusPoint(points[points.length - 1], group);\n }\n\n private moveToPrevInGroup(point: Highcharts.Point) {\n const points = this.findMatchingGroup(point).filter((p) => !isXThreshold(p.series));\n const pointIndex = points.indexOf(point);\n this.focusPoint(points[circleIndex(pointIndex - 1, [0, points.length - 1])], points);\n }\n\n private moveToNextInGroup(point: Highcharts.Point) {\n const points = this.findMatchingGroup(point).filter((p) => !isXThreshold(p.series));\n const pointIndex = points.indexOf(point);\n this.focusPoint(points[circleIndex(pointIndex + 1, [0, points.length - 1])], points);\n }\n\n private moveToFirstInSeries(point: Highcharts.Point) {\n const firstPoint = this.findFirstPointInSeries(point);\n if (firstPoint) {\n this.focusPoint(firstPoint, this.findMatchingGroup(firstPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToLastInSeries(point: Highcharts.Point) {\n const lastPoint = this.findLastPointInSeries(point);\n if (lastPoint) {\n this.focusPoint(lastPoint, this.findMatchingGroup(lastPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToNextInSeries(point: Highcharts.Point) {\n const nextPoint = this.findNextPointInSeries(point);\n if (nextPoint) {\n this.focusPoint(nextPoint, this.findMatchingGroup(nextPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToPrevInSeries(point: Highcharts.Point) {\n const prevPoint = this.findPrevPointInSeries(point);\n if (prevPoint) {\n this.focusPoint(prevPoint, this.findMatchingGroup(prevPoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToNextPageGroup(group: readonly Highcharts.Point[]) {\n const nextPageGroup = group[0] ? this.findNextPageGroup(group[0]) : [];\n this.focusGroup(nextPageGroup);\n }\n\n private moveToPrevPageGroup(group: readonly Highcharts.Point[]) {\n const prevPageGroup = group[0] ? this.findPrevPageGroup(group[0]) : [];\n this.focusGroup(prevPageGroup);\n }\n\n private moveToNextPageInSeries(point: Highcharts.Point) {\n const nextPagePoint = this.findNextPagePointInSeries(point);\n if (nextPagePoint) {\n this.focusPoint(nextPagePoint, this.findMatchingGroup(nextPagePoint));\n } else {\n this.focusChart();\n }\n }\n\n private moveToPrevPageInSeries(point: Highcharts.Point) {\n const prevPagePoint = this.findPrevPagePointInSeries(point);\n if (prevPagePoint) {\n this.focusPoint(prevPagePoint, this.findMatchingGroup(prevPagePoint));\n } else {\n this.focusChart();\n }\n }\n\n private activateGroup(group: readonly Highcharts.Point[]) {\n this.handlers.onActivateGroup(group);\n }\n\n private activatePoint(point: Highcharts.Point, group: readonly Highcharts.Point[]) {\n this.handlers.onActivatePoint(point, group);\n }\n\n private focusChart = () => {\n this.focusedState = { type: \"chart\" };\n this.focusOutline.chart();\n this.handlers.onFocusChart();\n };\n\n private focusGroup(group: readonly Highcharts.Point[]) {\n // When the chart is re-focused, the group that was focused before might no longer be valid if its\n // points are no longer visible, are outside the x-axis extremes, or were destroyed by Highcharts. In that\n // case we focus the chart as a fallback.\n const visiblePoints = group.filter((point) => isPointVisible(point) && this.isNavigable(point));\n if (visiblePoints.length === 0) {\n this.focusChart();\n }\n // In pie charts we only focus points, so moving focus to points and groups is equivalent.\n else if (visiblePoints[0].series.type === \"pie\") {\n this.focusPoint(visiblePoints[0] ?? null, group);\n }\n // When focusing a group we draw the focus outline around the corresponding group rect, including\n // all points of that group.\n else {\n this.focusedState = { type: \"group\", group: visiblePoints };\n this.focusOutline.group(getGroupRect(visiblePoints));\n this.handlers.onFocusGroup(visiblePoints);\n }\n }\n\n private focusPoint(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n // When the chart is re-focused, the point that was focused before might no longer be valid it became\n // hidden, moved outside the x-axis extremes, or was destroyed by Highcharts. In that case we focus the\n // point's parent group as a fallback.\n if (!point || !isPointVisible(point) || !this.isNavigable(point)) {\n this.focusGroup(group);\n }\n // When focusing a point we draw the focus outline around its corresponding rect, but with different offsets,\n // depending on the point's series type.\n else {\n this.focusedState = { type: \"point\", point, group };\n this.focusOutline.point(getPointRect(point), point);\n this.handlers.onFocusPoint(point, group);\n }\n }\n\n private get allX(): number[] {\n return this.context.derived.allX;\n }\n\n // Returns all series data points to navigate by. When a series is linked with other series - the method returns\n // all points from the linked series.\n private getSeriesPoints(series: SafeSeries): Highcharts.Point[] {\n return this.context.derived.getSeriesPoints(series);\n }\n\n private getPointsByX = (x: number): Highcharts.Point[] => {\n return this.context.derived.getPointsByX(x);\n };\n\n private isNavigable = (point: Highcharts.Point): boolean => {\n return this.getPointsByX(point.x).includes(point);\n };\n\n private findMatchingGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n return this.getPointsByX(point.x);\n };\n\n private findFirstGroup = (): Highcharts.Point[] => {\n return this.getPointsByX(this.allX[0]);\n };\n\n private findLastGroup = (): Highcharts.Point[] => {\n return this.getPointsByX(this.allX[this.allX.length - 1]);\n };\n\n private findNextGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextIndex(this.allX, this.allX.indexOf(point.x), 1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findPrevGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextIndex(this.allX, this.allX.indexOf(point.x), -1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findNextPageGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextPageIndex(this.allX, this.allX.indexOf(point.x), 1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findPrevPageGroup = (point: Highcharts.Point): Highcharts.Point[] => {\n const nextIndex = getNextPageIndex(this.allX, this.allX.indexOf(point.x), -1);\n return this.getPointsByX(this.allX[nextIndex]);\n };\n\n private findFirstPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n return seriesPoints[0] ?? null;\n };\n\n private findLastPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n return seriesPoints[seriesPoints.length - 1] ?? null;\n };\n\n private findNextPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? 1 : -1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findPrevPointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? -1 : 1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findNextPagePointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? 1 : -1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextPageIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n\n private findPrevPagePointInSeries = (point: Highcharts.Point): null | Highcharts.Point => {\n const seriesPoints = this.getSeriesPoints(point.series);\n const delta = !shouldInvertPointsDirection(point) ? -1 : 1;\n const pointIndex = seriesPoints.indexOf(point);\n const nextIndex = getNextPageIndex(seriesPoints, pointIndex, delta);\n return seriesPoints[nextIndex] ?? null;\n };\n}\n\nfunction handleKey(\n event: KeyboardEvent,\n handlers: {\n onActivate?: () => void;\n onBlockEnd?: () => void;\n onBlockStart?: () => void;\n onDefault?: () => void;\n onEnd?: () => void;\n onEscape?: () => void;\n onHome?: () => void;\n onInlineEnd?: () => void;\n onInlineStart?: () => void;\n onPageDown?: () => void;\n onPageUp?: () => void;\n },\n) {\n if (!event.currentTarget) {\n return;\n }\n if (!(event.currentTarget instanceof HTMLElement) && !(event.currentTarget instanceof SVGElement)) {\n return;\n }\n toolkitHandleKey({ keyCode: event.keyCode, currentTarget: event.currentTarget }, handlers);\n}\n\n// A helper class to draw the focus outline around given chart elements.\nclass FocusOutline {\n private context: ChartExtraContext;\n private elementsPool = new SVGRendererPool();\n\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n public chart = () => {\n const [x, y, width, height] = [\n this.context.chart().plotLeft,\n this.context.chart().plotTop,\n this.context.chart().plotWidth,\n this.context.chart().plotHeight,\n ];\n this.rect({ x, y, width, height }, Styles.focusOutlineOffsets.chart);\n };\n\n public group = (rect: Rect) => {\n this.rect(rect, Styles.focusOutlineOffsets.group);\n };\n\n public point = (rect: Rect, point: Highcharts.Point) => {\n const offsetByType = Styles.focusOutlineOffsets.pointByType[point.series.type];\n const offset = offsetByType ?? Styles.focusOutlineOffsets.point;\n this.rect(rect, offset);\n };\n\n public hide() {\n this.elementsPool.hideAll();\n }\n\n public destroy() {\n this.elementsPool.destroyAll();\n }\n\n private rect = ({ x, y, width, height }: Rect, offset: number) => {\n this.elementsPool.hideAll();\n this.elementsPool.rect(this.context.chart().renderer, {\n x: x - offset,\n y: y - offset,\n width: width + offset * 2,\n height: height + offset * 2,\n ...Styles.navigationFocusOutline,\n });\n };\n}\n\n// We do not invert the direction of pie segments when RTL, but swap the left/right keys.\n// To offset for that, the prev/next points direction is swapped, too.\nfunction shouldInvertPointsDirection(point: Highcharts.Point) {\n const isRTL = getIsRtl(point.series.chart.container.parentElement);\n return point.series.type === \"pie\" && isRTL;\n}\n\nfunction getNextIndex(array: unknown[], pointIndex: number, delta: -1 | 1): number {\n return circleIndex(pointIndex + delta, [0, array.length - 1]);\n}\n\nfunction getNextPageIndex(array: unknown[], pointIndex: number, delta: -1 | 1): number {\n return Math.min(array.length - 1, Math.max(0, pointIndex + delta * Math.round(array.length * PAGE_SIZE_PERCENTAGE)));\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import AsyncStore from "../../internal/utils/async-store";
2
+ import { ChartExtraContext } from "./chart-extra-context";
3
+ export interface ReactiveZoomState {
4
+ zoomed: boolean;
5
+ announcement: string;
6
+ }
7
+ export declare class ChartExtraZoom extends AsyncStore<ReactiveZoomState> {
8
+ private context;
9
+ private rangeBand;
10
+ private rangeBorders;
11
+ constructor(context: ChartExtraContext);
12
+ onChartRender: () => void;
13
+ onChartDestroy: () => void;
14
+ onZoomPropsChange: () => void;
15
+ resetZoom: () => void;
16
+ private getExtremes;
17
+ private reconcile;
18
+ private applyExtremes;
19
+ private drawRange;
20
+ }