@cloudscape-design/chart-components 1.0.67 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cartesian-chart/chart-series-cartesian.js +16 -7
- package/cartesian-chart/chart-series-cartesian.js.map +1 -1
- package/cartesian-chart/index.js +50 -21
- package/cartesian-chart/index.js.map +1 -1
- package/cartesian-chart/utils.d.ts +4 -0
- package/cartesian-chart/utils.js +20 -0
- package/cartesian-chart/utils.js.map +1 -0
- package/core/chart-api/chart-extra-context.d.ts +1 -1
- package/core/chart-api/chart-extra-context.js +30 -4
- package/core/chart-api/chart-extra-context.js.map +1 -1
- package/core/chart-api/chart-extra-highlight.js +20 -17
- package/core/chart-api/chart-extra-highlight.js.map +1 -1
- package/core/chart-api/chart-extra-legend.js +4 -3
- package/core/chart-api/chart-extra-legend.js.map +1 -1
- package/core/chart-api/chart-extra-navigation.d.ts +1 -1
- package/core/chart-api/chart-extra-navigation.js +25 -19
- package/core/chart-api/chart-extra-navigation.js.map +1 -1
- package/core/chart-api/chart-extra-tooltip.js +5 -2
- package/core/chart-api/chart-extra-tooltip.js.map +1 -1
- package/core/components/core-tooltip.js +4 -1
- package/core/components/core-tooltip.js.map +1 -1
- package/core/interfaces.d.ts +16 -6
- package/core/interfaces.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/chart-series.d.ts +9 -1
- package/internal/utils/chart-series.js +16 -0
- package/internal/utils/chart-series.js.map +1 -1
- package/internal/utils/series-data.js +2 -1
- package/internal/utils/series-data.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-extra-tooltip.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-tooltip.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAA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License-Identifier: Apache-2.0\n\nimport clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\n\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { renderMarker } from \"../../internal/components/series-marker/render-marker\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { SVGRendererPool, SVGRendererSingle } from \"../../internal/utils/renderer-utils\";\nimport { DebouncedCall, isEqualArrays } from \"../../internal/utils/utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, getSeriesId, isXThreshold, safeRect } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nimport testClasses from \"../test-classes/styles.css.js\";\n\nconst TOOLTIP_LAST_DISMISS_DELAY = 250;\n\n// The reactive state is used to propagate updates to the chart tooltip React component. The tooltip\n// content is to be derived from the target point and group.\nexport interface ReactiveTooltipState {\n visible: boolean;\n pinned: boolean;\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Chart helper that implements tooltip placement logic and cursors.\nexport class ChartExtraTooltip extends AsyncStore<ReactiveTooltipState> {\n private context: ChartExtraContext;\n\n // The tooltip lock is used to prevent tooltip position changes shortly after it was dismissed, to\n // deny its immediate re-appearance in the spot under where the dismiss button was.\n public tooltipLock = false;\n private tooltipLockCall = new DebouncedCall();\n private setTooltipLock = () => {\n if (this.get().pinned) {\n this.tooltipLock = true;\n this.tooltipLockCall.call(() => (this.tooltipLock = false), TOOLTIP_LAST_DISMISS_DELAY);\n }\n };\n\n // The cursor is a vertical or horizontal (in inverted charts) line and hollow or filled markers,\n // shown in cartesian charts on top of the matched group or point.\n private cursor = new HighlightCursorCartesian();\n // The track elements are invisible rectangles, compted for the given target point or group.\n // The target track is used for the \"target\" tooltip placement. The group track is used for\n // the \"middle\" and \"outside\" tooltip placement.\n private targetTrack = new SVGRendererSingle();\n private groupTrack = new SVGRendererSingle();\n\n // Cached coordinates to update cursor's position on re-render.\n private lastPoint: null | Highcharts.Point = null;\n private lastGroup: null | readonly Highcharts.Point[] = null;\n\n constructor(context: ChartExtraContext) {\n super({ visible: false, pinned: false, point: null, group: [] });\n this.context = context;\n }\n\n // The targetElement.element can get invalidated by Highcharts, so we cannot use\n // trackRef.current = targetElement.element as it might get invalidated unexpectedly.\n // The getTrack function ensures the latest element reference is given on each request.\n public getTargetTrack = () => (this.targetTrack.element?.element ?? null) as null | SVGElement;\n public getGroupTrack = () => {\n return (this.groupTrack.element?.element ?? null) as null | SVGElement;\n };\n\n public onChartRender() {\n if (this.lastGroup && this.get().visible) {\n this.updateTooltipCursor({ point: this.lastPoint, group: this.lastGroup });\n }\n }\n\n public onChartDestroy() {\n this.cursor.destroy();\n this.targetTrack.destroy();\n this.groupTrack.destroy();\n }\n\n public showTooltipOnPoint(point: Highcharts.Point, matchingGroup: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point, group: matchingGroup });\n this.set(() => ({ visible: true, pinned: false, point, group: matchingGroup }));\n }\n }\n\n public showTooltipOnGroup(group: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point: null, group });\n this.setGroupIfDifferent(group);\n }\n }\n\n public hideTooltip() {\n this.cursor.hide();\n this.targetTrack.hide();\n this.groupTrack.hide();\n this.setTooltipLock();\n this.set((prev) => ({ ...prev, visible: false, pinned: false }));\n }\n\n public pinTooltip() {\n if (this.context.settings.tooltipEnabled) {\n this.set((prev) => ({ ...prev, visible: true, pinned: true }));\n }\n }\n\n // Avoid re-rendering the tooltip on every cursor position change when hovering over the graph.\n // Just re-render when the groups are different.\n private setGroupIfDifferent(group: readonly Highcharts.Point[]) {\n function isGroupEqual(a: Highcharts.Point, b: Highcharts.Point) {\n return a?.x === b?.x && a?.y === b?.y && getSeriesId(a?.series) === getSeriesId(b?.series);\n }\n this.set((prev) => {\n return prev.point === null && isEqualArrays(prev.group, group, isGroupEqual)\n ? prev\n : { visible: true, pinned: false, point: null, group };\n });\n }\n\n private updateTooltipCursor = (props: { point: null | Highcharts.Point; group: readonly Highcharts.Point[] }) => {\n this.lastPoint = props.point;\n this.lastGroup = props.group;\n\n const chartType =\n this.context.chart().series.find((s) => s.type === \"pie\" || s.type === \"solidgauge\")?.type ?? \"cartesian\";\n if (chartType === \"pie\") {\n return this.updateTooltipCursorPie(props.group[0]);\n } else if (chartType === \"solidgauge\") {\n return this.updateTooltipCursorGauge(props.group[0]);\n } else {\n return this.updateTooltipCursorCartesian(props);\n }\n };\n\n private updateTooltipCursorCartesian = ({\n point,\n group,\n }: {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }) => {\n const pointRect = point ? getPointRect(point) : getGroupRect(group.slice(0, 1));\n const groupRect = getGroupRect(group);\n // The cursor is not shown when column series are present (a UX decision).\n const hasColumnSeries = this.context.chart().series.some((s) => s.type === \"column\");\n this.cursor.create(groupRect, point, group, !hasColumnSeries);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n this.groupTrack.rect(this.context.chart().renderer, { ...groupRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorPie = (point: Highcharts.Point) => {\n // We only create target track for pie chart as pie chart does not support groups.\n // It is also expected that only \"target\" tooltip position is used for pie charts.\n const pointRect = getPieChartTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorGauge = (point: Highcharts.Point) => {\n // Solid gauge charts are similar to pie charts in that they have a circular shape\n // and don't support grouping. We use a similar approach to pie charts.\n const pointRect = getSolidGaugeTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private get commonTrackAttrs() {\n return { fill: \"transparent\", zIndex: -1, \"pointer-events\": \"none\", direction: this.direction };\n }\n\n // We compute the direction from the chart container and then explicitly set it to the track\n // elements, as otherwise the direction check done for track elements always results to \"ltr\".\n private get direction() {\n const isRtl = getIsRtl(this.context.chart().container.parentElement);\n return isRtl ? \"rtl\" : \"ltr\";\n }\n}\n\n// A helper class to draw the cursor elements (include cursor line and matched points markers).\nclass HighlightCursorCartesian {\n private lineElement = new SVGRendererSingle();\n private markerElementsPool = new SVGRendererPool();\n\n public create(target: Rect, point: null | Highcharts.Point, group: readonly Highcharts.Point[], showLine: boolean) {\n this.hide();\n if (!group[0]?.series) {\n return;\n }\n\n const chart = group[0]?.series.chart;\n if (!chart) {\n return;\n }\n if (showLine) {\n // The cursor line is rendered orthogonally to the x axis (when the chart is inverted, the line is rendered horizontally).\n // The line is 1px thick, and is rendered through the center of the target's rect.\n const lineAttrs = chart.inverted\n ? {\n x: chart.plotLeft,\n y: chart.plotTop + target.y - target.height - 1,\n width: chart.plotWidth,\n height: 1,\n }\n : {\n x: target.x + target.width / 2,\n y: chart.plotTop,\n width: 1,\n height: chart.plotHeight,\n };\n this.lineElement.rect(chart.renderer, { ...Styles.cursorLine, ...lineAttrs });\n }\n for (const p of group.filter(this.isPointEligibleForMarker)) {\n if (p.plotX !== undefined && p.plotY !== undefined) {\n const selected = p === point;\n const className = clsx(testClasses[\"highlight-marker\"], selected && testClasses[\"highlight-marker-selected\"]);\n renderMarker({ chart, pool: this.markerElementsPool, point: p, selected, className });\n }\n }\n }\n\n public hide() {\n this.lineElement.hide();\n this.markerElementsPool.hideAll();\n }\n\n public destroy() {\n this.lineElement.destroy();\n this.markerElementsPool.destroyAll();\n }\n\n private isPointEligibleForMarker = (point: Highcharts.Point) => {\n return !isXThreshold(point.series) && point.series.type !== \"column\" && point.series.type !== \"errorbar\";\n };\n}\n\nfunction getPieChartTargetPlacement(point: Highcharts.Point): Rect {\n // The pie series segments do not provide plotX, plotY to compute the tooltip placement.\n // Instead, there is a `tooltipPos` tuple, which is not covered by TS.\n // See: https://github.com/highcharts/highcharts/issues/23118.\n if (\"tooltipPos\" in point && Array.isArray(point.tooltipPos)) {\n return safeRect({ x: point.tooltipPos[0], y: point.tooltipPos[1], width: 0, height: 0 });\n }\n // We use the alternative, middle, tooltip placement as a fallback, in case the undocumented \"tooltipPos\"\n // is no longer available in the point.\n return getPieMiddlePlacement(point);\n}\n\nfunction getPieMiddlePlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n const [relativeX, relativeY, relativeDiameter] = point.series.center;\n const plotLeft = chart.plotLeft;\n const plotTop = chart.plotTop;\n const centerX = plotLeft + (typeof relativeX === \"number\" ? relativeX : (relativeX / 100) * chart.plotWidth);\n const centerY = plotTop + (typeof relativeY === \"number\" ? relativeY : (relativeY / 100) * chart.plotHeight);\n const radius =\n (typeof relativeDiameter === \"number\" ? relativeDiameter : (relativeDiameter / 100) * chart.plotWidth) / 2;\n return { x: centerX, y: centerY - radius, width: 1, height: 2 * radius };\n}\n\nfunction getSolidGaugeTargetPlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n return safeRect({\n x: chart.plotLeft + chart.plotWidth / 2,\n y: chart.plotTop + chart.plotHeight / 2,\n width: 0,\n height: 0,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-extra-tooltip.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-tooltip.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,YA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CAAC;IAC7G,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7G,MAAM,MAAM,GACV,CAAC,OAAO,gBAAgB,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7G,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAuB;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IACjC,OAAO,QAAQ,CAAC;QACd,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC;QACvC,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC;QACvC,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\n\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { renderMarker } from \"../../internal/components/series-marker/render-marker\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { SVGRendererPool, SVGRendererSingle } from \"../../internal/utils/renderer-utils\";\nimport { DebouncedCall, isEqualArrays } from \"../../internal/utils/utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, getSeriesId, isPointVisible, isXThreshold, safeRect } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nimport testClasses from \"../test-classes/styles.css.js\";\n\nconst TOOLTIP_LAST_DISMISS_DELAY = 250;\n\n// The reactive state is used to propagate updates to the chart tooltip React component. The tooltip\n// content is to be derived from the target point and group.\nexport interface ReactiveTooltipState {\n visible: boolean;\n pinned: boolean;\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Chart helper that implements tooltip placement logic and cursors.\nexport class ChartExtraTooltip extends AsyncStore<ReactiveTooltipState> {\n private context: ChartExtraContext;\n\n // The tooltip lock is used to prevent tooltip position changes shortly after it was dismissed, to\n // deny its immediate re-appearance in the spot under where the dismiss button was.\n public tooltipLock = false;\n private tooltipLockCall = new DebouncedCall();\n private setTooltipLock = () => {\n if (this.get().pinned) {\n this.tooltipLock = true;\n this.tooltipLockCall.call(() => (this.tooltipLock = false), TOOLTIP_LAST_DISMISS_DELAY);\n }\n };\n\n // The cursor is a vertical or horizontal (in inverted charts) line and hollow or filled markers,\n // shown in cartesian charts on top of the matched group or point.\n private cursor = new HighlightCursorCartesian();\n // The track elements are invisible rectangles, compted for the given target point or group.\n // The target track is used for the \"target\" tooltip placement. The group track is used for\n // the \"middle\" and \"outside\" tooltip placement.\n private targetTrack = new SVGRendererSingle();\n private groupTrack = new SVGRendererSingle();\n\n // Cached coordinates to update cursor's position on re-render.\n private lastPoint: null | Highcharts.Point = null;\n private lastGroup: null | readonly Highcharts.Point[] = null;\n\n constructor(context: ChartExtraContext) {\n super({ visible: false, pinned: false, point: null, group: [] });\n this.context = context;\n }\n\n // The targetElement.element can get invalidated by Highcharts, so we cannot use\n // trackRef.current = targetElement.element as it might get invalidated unexpectedly.\n // The getTrack function ensures the latest element reference is given on each request.\n public getTargetTrack = () => (this.targetTrack.element?.element ?? null) as null | SVGElement;\n public getGroupTrack = () => {\n return (this.groupTrack.element?.element ?? null) as null | SVGElement;\n };\n\n public onChartRender() {\n if (this.lastGroup && this.get().visible) {\n this.updateTooltipCursor({ point: this.lastPoint, group: this.lastGroup });\n }\n }\n\n public onChartDestroy() {\n this.cursor.destroy();\n this.targetTrack.destroy();\n this.groupTrack.destroy();\n }\n\n public showTooltipOnPoint(point: Highcharts.Point, matchingGroup: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point, group: matchingGroup });\n this.set(() => ({ visible: true, pinned: false, point, group: matchingGroup }));\n }\n }\n\n public showTooltipOnGroup(group: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point: null, group });\n this.setGroupIfDifferent(group);\n }\n }\n\n public hideTooltip() {\n this.cursor.hide();\n this.targetTrack.hide();\n this.groupTrack.hide();\n this.setTooltipLock();\n this.set((prev) => ({ ...prev, visible: false, pinned: false }));\n }\n\n public pinTooltip() {\n if (this.context.settings.tooltipEnabled) {\n this.set((prev) => ({ ...prev, visible: true, pinned: true }));\n }\n }\n\n // Avoid re-rendering the tooltip on every cursor position change when hovering over the graph.\n // Just re-render when the groups are different.\n private setGroupIfDifferent(group: readonly Highcharts.Point[]) {\n function isGroupEqual(a: Highcharts.Point, b: Highcharts.Point) {\n return a?.x === b?.x && a?.y === b?.y && getSeriesId(a?.series) === getSeriesId(b?.series);\n }\n this.set((prev) => {\n return prev.point === null && isEqualArrays(prev.group, group, isGroupEqual)\n ? prev\n : { visible: true, pinned: false, point: null, group };\n });\n }\n\n private updateTooltipCursor = (props: { point: null | Highcharts.Point; group: readonly Highcharts.Point[] }) => {\n this.lastPoint = props.point;\n this.lastGroup = props.group;\n\n const chartType =\n this.context.chart().series.find((s) => s.type === \"pie\" || s.type === \"solidgauge\")?.type ?? \"cartesian\";\n if (chartType === \"pie\") {\n return this.updateTooltipCursorPie(props.group[0]);\n } else if (chartType === \"solidgauge\") {\n return this.updateTooltipCursorGauge(props.group[0]);\n } else {\n return this.updateTooltipCursorCartesian(props);\n }\n };\n\n private updateTooltipCursorCartesian = ({\n point,\n group,\n }: {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }) => {\n const pointRect = point ? getPointRect(point) : getGroupRect(group.slice(0, 1));\n const groupRect = getGroupRect(group);\n // The cursor is not shown when column series are present (a UX decision).\n const hasColumnSeries = this.context.chart().series.some((s) => s.type === \"column\");\n this.cursor.create(groupRect, point, group, !hasColumnSeries);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n this.groupTrack.rect(this.context.chart().renderer, { ...groupRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorPie = (point: Highcharts.Point) => {\n // We only create target track for pie chart as pie chart does not support groups.\n // It is also expected that only \"target\" tooltip position is used for pie charts.\n const pointRect = getPieChartTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorGauge = (point: Highcharts.Point) => {\n // Solid gauge charts are similar to pie charts in that they have a circular shape\n // and don't support grouping. We use a similar approach to pie charts.\n const pointRect = getSolidGaugeTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private get commonTrackAttrs() {\n return { fill: \"transparent\", zIndex: -1, \"pointer-events\": \"none\", direction: this.direction };\n }\n\n // We compute the direction from the chart container and then explicitly set it to the track\n // elements, as otherwise the direction check done for track elements always results to \"ltr\".\n private get direction() {\n const isRtl = getIsRtl(this.context.chart().container.parentElement);\n return isRtl ? \"rtl\" : \"ltr\";\n }\n}\n\n// A helper class to draw the cursor elements (include cursor line and matched points markers).\nclass HighlightCursorCartesian {\n private lineElement = new SVGRendererSingle();\n private markerElementsPool = new SVGRendererPool();\n\n public create(target: Rect, point: null | Highcharts.Point, group: readonly Highcharts.Point[], showLine: boolean) {\n this.hide();\n if (!group[0]?.series) {\n return;\n }\n\n const chart = group[0]?.series.chart;\n if (!chart) {\n return;\n }\n if (showLine) {\n // The cursor line is rendered orthogonally to the x axis (when the chart is inverted, the line is rendered horizontally).\n // The line is 1px thick, and is rendered through the center of the target's rect.\n const lineAttrs = chart.inverted\n ? {\n x: chart.plotLeft,\n y: chart.plotTop + target.y - target.height - 1,\n width: chart.plotWidth,\n height: 1,\n }\n : {\n x: target.x + target.width / 2,\n y: chart.plotTop,\n width: 1,\n height: chart.plotHeight,\n };\n this.lineElement.rect(chart.renderer, { ...Styles.cursorLine, ...lineAttrs });\n }\n for (const p of group.filter(this.isPointEligibleForMarker)) {\n if (p.plotX !== undefined && p.plotY !== undefined) {\n const selected = p === point;\n const className = clsx(testClasses[\"highlight-marker\"], selected && testClasses[\"highlight-marker-selected\"]);\n renderMarker({ chart, pool: this.markerElementsPool, point: p, selected, className });\n }\n }\n }\n\n public hide() {\n this.lineElement.hide();\n this.markerElementsPool.hideAll();\n }\n\n public destroy() {\n this.lineElement.destroy();\n this.markerElementsPool.destroyAll();\n }\n\n private isPointEligibleForMarker = (point: Highcharts.Point) => {\n return (\n isPointVisible(point) &&\n !isXThreshold(point.series) &&\n point.series.type !== \"column\" &&\n point.series.type !== \"errorbar\"\n );\n };\n}\n\nfunction getPieChartTargetPlacement(point: Highcharts.Point): Rect {\n // The pie series segments do not provide plotX, plotY to compute the tooltip placement.\n // Instead, there is a `tooltipPos` tuple, which is not covered by TS.\n // See: https://github.com/highcharts/highcharts/issues/23118.\n if (\"tooltipPos\" in point && Array.isArray(point.tooltipPos)) {\n return safeRect({ x: point.tooltipPos[0], y: point.tooltipPos[1], width: 0, height: 0 });\n }\n // We use the alternative, middle, tooltip placement as a fallback, in case the undocumented \"tooltipPos\"\n // is no longer available in the point.\n return getPieMiddlePlacement(point);\n}\n\nfunction getPieMiddlePlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n const [relativeX, relativeY, relativeDiameter] = point.series.center;\n const plotLeft = chart.plotLeft;\n const plotTop = chart.plotTop;\n const centerX = plotLeft + (typeof relativeX === \"number\" ? relativeX : (relativeX / 100) * chart.plotWidth);\n const centerY = plotTop + (typeof relativeY === \"number\" ? relativeY : (relativeY / 100) * chart.plotHeight);\n const radius =\n (typeof relativeDiameter === \"number\" ? relativeDiameter : (relativeDiameter / 100) * chart.plotWidth) / 2;\n return { x: centerX, y: centerY - radius, width: 1, height: 2 * radius };\n}\n\nfunction getSolidGaugeTargetPlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n return safeRect({\n x: chart.plotLeft + chart.plotWidth / 2,\n y: chart.plotTop + chart.plotHeight / 2,\n width: 0,\n height: 0,\n });\n}\n"]}
|
|
@@ -11,7 +11,7 @@ import { useSelector } from "../../internal/utils/async-store";
|
|
|
11
11
|
import { getChartSeries } from "../../internal/utils/chart-series";
|
|
12
12
|
import { useDebouncedValue } from "../../internal/utils/use-debounced-value";
|
|
13
13
|
import { getFormatter } from "../formatters";
|
|
14
|
-
import { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isXThreshold } from "../utils";
|
|
14
|
+
import { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isPointVisible, isXThreshold, } from "../utils";
|
|
15
15
|
import styles from "../styles.css.js";
|
|
16
16
|
const MIN_VISIBLE_BLOCK_SIZE = 200;
|
|
17
17
|
const DEFAULT_DEBOUNCE = 200;
|
|
@@ -173,6 +173,9 @@ function findTooltipSeriesItems(series, group, seriesSorting) {
|
|
|
173
173
|
const matchedSeries = new Set();
|
|
174
174
|
const matchedItems = [];
|
|
175
175
|
for (const point of group) {
|
|
176
|
+
if (!isPointVisible(point)) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
176
179
|
// We only support errorbar series that are linked to other series. In tooltip content we add
|
|
177
180
|
// linked error bars to series detail slot.
|
|
178
181
|
if (point.series.type === "errorbar") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-tooltip.js","sourceRoot":"","sources":["../../../../src/core/components/core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AAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,4HAA4H;QAC5H,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO,EAAE,IAAI,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC;QACF,8FAA8F;SAC7F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;QACZ,MAAM,WAAW,GAAG,MAAA,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,mCAAI,EAAE,CAAC;QAC3E,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9G,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACrD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useState } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\nimport Box from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\nimport LiveRegion from \"@cloudscape-design/components/live-region\";\n\nimport ChartSeriesDetails, { ChartSeriesDetailItem } from \"../../internal/components/series-details\";\nimport { useSelector } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { useDebouncedValue } from \"../../internal/utils/use-debounced-value\";\nimport { ChartAPI } from \"../chart-api\";\nimport { getFormatter } from \"../formatters\";\nimport { BaseI18nStrings, CoreChartProps } from \"../interfaces\";\nimport { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isXThreshold } from \"../utils\";\n\nimport styles from \"../styles.css.js\";\n\nconst MIN_VISIBLE_BLOCK_SIZE = 200;\nconst DEFAULT_DEBOUNCE = 200;\n\ntype ExpandedSeriesState = Record<string, Set<string>>;\n\ninterface ExpandedSeriesStateProps {\n expandedSeries: ExpandedSeriesState;\n setExpandedSeries: (cb: (state: ExpandedSeriesState) => ExpandedSeriesState) => void;\n}\n\ninterface RenderedTooltipContent {\n header: React.ReactNode;\n body: React.ReactNode;\n footer: React.ReactNode;\n}\n\ninterface MatchedItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n}\n\nexport function ChartTooltip({\n placement = \"target\",\n size,\n getTooltipContent: getTooltipContentOverrides,\n api,\n i18nStrings,\n debounce = false,\n seriesSorting = \"as-added\",\n}: CoreChartProps.TooltipOptions & {\n i18nStrings?: BaseI18nStrings;\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n api: ChartAPI;\n}) {\n const [expandedSeries, setExpandedSeries] = useState<ExpandedSeriesState>({});\n const tooltip = useSelector(api.tooltipStore, (s) => s);\n const debouncedTooltip = useDebouncedValue(tooltip, debounce === true ? DEFAULT_DEBOUNCE : debounce || 0);\n\n if (\n !debouncedTooltip ||\n !debouncedTooltip.visible ||\n debouncedTooltip.group.length === 0 ||\n debouncedTooltip.group[0].series === undefined\n ) {\n return null;\n }\n\n const chart = debouncedTooltip.group[0]?.series.chart;\n const renderers = getTooltipContentOverrides?.({ point: debouncedTooltip.point, group: debouncedTooltip.group });\n const getTrack = placement === \"target\" ? api.getTargetTrack : api.getGroupTrack;\n const position = (() => {\n if (placement === \"target\" || placement === \"middle\") {\n return !chart.inverted ? \"right\" : \"bottom\";\n } else {\n return !chart.inverted ? \"bottom\" : \"right\";\n }\n })();\n const content = getTooltipContent(api, {\n renderers,\n point: debouncedTooltip.point,\n group: debouncedTooltip.group,\n expandedSeries,\n setExpandedSeries,\n seriesSorting,\n hideTooltip: () => {\n api.hideTooltip();\n },\n });\n if (!content) {\n return null;\n }\n return (\n <InternalChartTooltip\n getTrack={getTrack}\n trackKey={getTrackKey(debouncedTooltip.point, debouncedTooltip.group)}\n container={null}\n dismissButton={debouncedTooltip.pinned}\n dismissAriaLabel={i18nStrings?.detailPopoverDismissAriaLabel}\n onDismiss={api.onDismissTooltip}\n onMouseEnter={api.onMouseEnterTooltip}\n onMouseLeave={api.onMouseLeaveTooltip}\n title={content.header}\n footer={\n content.footer ? (\n <>\n <hr aria-hidden={true} />\n {content.footer}\n </>\n ) : null\n }\n size={size}\n position={position}\n minVisibleBlockSize={MIN_VISIBLE_BLOCK_SIZE}\n >\n <LiveRegion>{content.body}</LiveRegion>\n </InternalChartTooltip>\n );\n}\n\nfunction getTrackKey(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n const pointId = point && (point.options.id || point.options.name);\n if (point && pointId) {\n return `p-${pointId}-${point.x}-${point.y}`;\n }\n if (point) {\n return `p-${point.x}-${point.y}`;\n }\n return `g_${group.length}_${group[0].x}`;\n}\n\nfunction getTooltipContent(\n api: ChartAPI,\n props: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): null | RenderedTooltipContent {\n if (props.point && props.point.series.type === \"pie\") {\n return getTooltipContentPie(api, { ...props, point: props.point });\n } else if (props.group.length > 0 && props.group[0].series.type !== \"pie\") {\n return getTooltipContentCartesian(api, props);\n } else {\n return null;\n }\n}\n\nfunction getTooltipContentCartesian(\n api: ChartAPI,\n {\n point,\n group,\n expandedSeries,\n renderers = {},\n setExpandedSeries,\n hideTooltip,\n seriesSorting,\n }: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): RenderedTooltipContent {\n // The cartesian tooltip might or might not have a selected point, but it always has a non-empty group.\n // By design, every point of the group has the same x value.\n const x = group[0].x;\n const chart = group[0].series.chart;\n const getSeriesMarker = (series: Highcharts.Series) => {\n const itemOptions = api.context.settings.getItemOptions?.(getSeriesId(series));\n return api.renderMarker({\n type: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status),\n });\n };\n const matchedItems = findTooltipSeriesItems(getChartSeries(chart.series), group, seriesSorting);\n const detailItems: ChartSeriesDetailItem[] = matchedItems.map((item) => {\n const valueFormatter = getFormatter(item.point.series.yAxis);\n const itemY = isXThreshold(item.point.series) ? null : (item.point.y ?? null);\n const customContent = renderers.point\n ? renderers.point({\n item,\n hideTooltip,\n })\n : undefined;\n return {\n key: customContent?.key ?? item.point.series.name,\n value: customContent?.value ?? valueFormatter(itemY),\n marker: getSeriesMarker(item.point.series),\n subItems: customContent?.subItems,\n expandableId: customContent?.expandable ? item.point.series.name : undefined,\n highlighted: item.point.x === point?.x && item.point.y === point?.y,\n description:\n customContent?.description === undefined && item.errorRanges.length ? (\n <>\n {item.errorRanges.map((errorBarPoint, index) => (\n <div key={index} className={styles[\"error-range\"]}>\n <span>{errorBarPoint.series.userOptions.name ? errorBarPoint.series.userOptions.name : \"\"}</span>\n <span>\n {valueFormatter(errorBarPoint.options.low ?? 0)} - {valueFormatter(errorBarPoint.options.high ?? 0)}\n </span>\n </div>\n ))}\n </>\n ) : (\n customContent?.description\n ),\n };\n });\n // We only support cartesian charts with a single x axis.\n const titleFormatter = getFormatter(chart.xAxis[0]);\n const slotRenderProps: CoreChartProps.TooltipSlotProps = {\n x,\n items: matchedItems,\n hideTooltip: hideTooltip,\n };\n return {\n header: renderers.header?.(slotRenderProps) ?? titleFormatter(x),\n body: renderers.body?.(slotRenderProps) ?? (\n <ChartSeriesDetails\n details={detailItems}\n expandedSeries={expandedSeries[x]}\n setExpandedState={(id, isExpanded) => {\n setExpandedSeries((oldState) => {\n const expandedSeriesInCurrentCoordinate = new Set(oldState[x]);\n if (isExpanded) {\n expandedSeriesInCurrentCoordinate.add(id);\n } else {\n expandedSeriesInCurrentCoordinate.delete(id);\n }\n return { ...oldState, [x]: expandedSeriesInCurrentCoordinate };\n });\n }}\n />\n ),\n footer: renderers.footer?.(slotRenderProps),\n };\n}\n\nfunction getTooltipContentPie(\n api: ChartAPI,\n {\n point,\n renderers = {},\n hideTooltip,\n }: { point: Highcharts.Point } & { renderers?: CoreChartProps.TooltipContentRenderer; hideTooltip: () => void },\n): RenderedTooltipContent {\n const tooltipDetails: CoreChartProps.TooltipSlotProps = {\n x: point.x,\n items: [{ point, errorRanges: [] }],\n hideTooltip,\n };\n\n const itemOptions = api.context.settings.getItemOptions?.(getPointId(point));\n const markerAriaLabel = api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status);\n\n return {\n header: renderers.header?.(tooltipDetails) ?? (\n <div className={styles[\"tooltip-default-header\"]}>\n {api.renderMarker({\n type: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: markerAriaLabel,\n })}\n <Box variant=\"span\" fontWeight=\"bold\">\n {point.name}\n </Box>\n </div>\n ),\n body:\n renderers.body?.(tooltipDetails) ??\n (renderers.details ? (\n <ChartSeriesDetails\n details={renderers.details({\n point,\n hideTooltip,\n })}\n compactList={true}\n />\n ) : (\n // We expect all pie chart segments to have defined y values. We use y=0 as fallback\n // because the property is optional in Highcharts types.\n <ChartSeriesDetails details={[{ key: point.series.name, value: point.y ?? 0 }]} />\n )),\n footer: renderers.footer?.(tooltipDetails),\n };\n}\n\nfunction findTooltipSeriesItems(\n series: readonly Highcharts.Series[],\n group: readonly Highcharts.Point[],\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>,\n): MatchedItem[] {\n const seriesOrder = series.reduce((d, s, i) => d.set(s, i), new Map<Highcharts.Series, number>());\n const getSeriesIndex = (s: Highcharts.Series) => seriesOrder.get(s) ?? -1;\n const seriesErrors = new Map<string, Highcharts.Point[]>();\n const matchedSeries = new Set<Highcharts.Series>();\n const matchedItems: MatchedItem[] = [];\n for (const point of group) {\n // We only support errorbar series that are linked to other series. In tooltip content we add\n // linked error bars to series detail slot.\n if (point.series.type === \"errorbar\") {\n if (point.series.linkedParent) {\n addError(getSeriesId(point.series.linkedParent), point);\n } else {\n warnOnce(\n \"chart-components\",\n 'The `linkedTo` property of \"errorbar\" series is missing, or points to a series that does not exist.',\n );\n }\n } else {\n addMatchedPoints(point);\n }\n }\n function addError(seriesId: string, errorPoint: Highcharts.Point) {\n if (errorPoint.options.low !== undefined && errorPoint.options.high !== undefined) {\n const errorRanges = seriesErrors.get(seriesId) ?? [];\n errorRanges.push(errorPoint);\n seriesErrors.set(seriesId, errorRanges);\n }\n }\n function addMatchedPoints(point: Highcharts.Point) {\n if (!matchedSeries.has(point.series)) {\n matchedSeries.add(point.series);\n if (isXThreshold(point.series)) {\n matchedItems.push({ point, errorRanges: [] });\n } else {\n point.series.data\n .filter((d) => d.x === point.x)\n .sort((a, b) => (a.y ?? 0) - (b.y ?? 0))\n .forEach((point) => matchedItems.push({ point, errorRanges: [] }));\n }\n }\n }\n return (\n matchedItems\n .sort((i1, i2) => {\n if (seriesSorting === \"by-value-desc\") {\n return (i2.point.y ?? 0) - (i1.point.y ?? 0);\n }\n // We sort matched items by series order. If there are multiple items that belong to the same series, we sort them by value.\n const s1 = getSeriesIndex(i1.point.series) - getSeriesIndex(i2.point.series);\n return s1 || (i1.point.y ?? 0) - (i2.point.y ?? 0);\n })\n // For each series item we add linked error ranges, sorted by their respective series indices.\n .map((item) => {\n const errorRanges = seriesErrors.get(getSeriesId(item.point.series)) ?? [];\n const sortedErrorRanges = errorRanges.sort((i1, i2) => getSeriesIndex(i1.series) - getSeriesIndex(i2.series));\n return { ...item, errorRanges: sortedErrorRanges };\n })\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core-tooltip.js","sourceRoot":"","sources":["../../../../src/core/components/core-tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iEAAiE,CAAC;AACvG,OAAO,UAAU,MAAM,2CAA2C,CAAC;AAEnE,OAAO,kBAA6C,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAoB7B,MAAM,UAAU,YAAY,CAAC,EAC3B,SAAS,GAAG,QAAQ,EACpB,IAAI,EACJ,iBAAiB,EAAE,0BAA0B,EAC7C,GAAG,EACH,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,aAAa,GAAG,UAAU,G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iBAAiB,EAAE,CAAC;IACrD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useState } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\nimport Box from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\nimport LiveRegion from \"@cloudscape-design/components/live-region\";\n\nimport ChartSeriesDetails, { ChartSeriesDetailItem } from \"../../internal/components/series-details\";\nimport { useSelector } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { useDebouncedValue } from \"../../internal/utils/use-debounced-value\";\nimport { ChartAPI } from \"../chart-api\";\nimport { getFormatter } from \"../formatters\";\nimport { BaseI18nStrings, CoreChartProps } from \"../interfaces\";\nimport {\n getPointColor,\n getPointId,\n getSeriesColor,\n getSeriesId,\n getSeriesMarkerType,\n isPointVisible,\n isXThreshold,\n} from \"../utils\";\n\nimport styles from \"../styles.css.js\";\n\nconst MIN_VISIBLE_BLOCK_SIZE = 200;\nconst DEFAULT_DEBOUNCE = 200;\n\ntype ExpandedSeriesState = Record<string, Set<string>>;\n\ninterface ExpandedSeriesStateProps {\n expandedSeries: ExpandedSeriesState;\n setExpandedSeries: (cb: (state: ExpandedSeriesState) => ExpandedSeriesState) => void;\n}\n\ninterface RenderedTooltipContent {\n header: React.ReactNode;\n body: React.ReactNode;\n footer: React.ReactNode;\n}\n\ninterface MatchedItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n}\n\nexport function ChartTooltip({\n placement = \"target\",\n size,\n getTooltipContent: getTooltipContentOverrides,\n api,\n i18nStrings,\n debounce = false,\n seriesSorting = \"as-added\",\n}: CoreChartProps.TooltipOptions & {\n i18nStrings?: BaseI18nStrings;\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n api: ChartAPI;\n}) {\n const [expandedSeries, setExpandedSeries] = useState<ExpandedSeriesState>({});\n const tooltip = useSelector(api.tooltipStore, (s) => s);\n const debouncedTooltip = useDebouncedValue(tooltip, debounce === true ? DEFAULT_DEBOUNCE : debounce || 0);\n\n if (\n !debouncedTooltip ||\n !debouncedTooltip.visible ||\n debouncedTooltip.group.length === 0 ||\n debouncedTooltip.group[0].series === undefined\n ) {\n return null;\n }\n\n const chart = debouncedTooltip.group[0]?.series.chart;\n const renderers = getTooltipContentOverrides?.({ point: debouncedTooltip.point, group: debouncedTooltip.group });\n const getTrack = placement === \"target\" ? api.getTargetTrack : api.getGroupTrack;\n const position = (() => {\n if (placement === \"target\" || placement === \"middle\") {\n return !chart.inverted ? \"right\" : \"bottom\";\n } else {\n return !chart.inverted ? \"bottom\" : \"right\";\n }\n })();\n const content = getTooltipContent(api, {\n renderers,\n point: debouncedTooltip.point,\n group: debouncedTooltip.group,\n expandedSeries,\n setExpandedSeries,\n seriesSorting,\n hideTooltip: () => {\n api.hideTooltip();\n },\n });\n if (!content) {\n return null;\n }\n return (\n <InternalChartTooltip\n getTrack={getTrack}\n trackKey={getTrackKey(debouncedTooltip.point, debouncedTooltip.group)}\n container={null}\n dismissButton={debouncedTooltip.pinned}\n dismissAriaLabel={i18nStrings?.detailPopoverDismissAriaLabel}\n onDismiss={api.onDismissTooltip}\n onMouseEnter={api.onMouseEnterTooltip}\n onMouseLeave={api.onMouseLeaveTooltip}\n title={content.header}\n footer={\n content.footer ? (\n <>\n <hr aria-hidden={true} />\n {content.footer}\n </>\n ) : null\n }\n size={size}\n position={position}\n minVisibleBlockSize={MIN_VISIBLE_BLOCK_SIZE}\n >\n <LiveRegion>{content.body}</LiveRegion>\n </InternalChartTooltip>\n );\n}\n\nfunction getTrackKey(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n const pointId = point && (point.options.id || point.options.name);\n if (point && pointId) {\n return `p-${pointId}-${point.x}-${point.y}`;\n }\n if (point) {\n return `p-${point.x}-${point.y}`;\n }\n return `g_${group.length}_${group[0].x}`;\n}\n\nfunction getTooltipContent(\n api: ChartAPI,\n props: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): null | RenderedTooltipContent {\n if (props.point && props.point.series.type === \"pie\") {\n return getTooltipContentPie(api, { ...props, point: props.point });\n } else if (props.group.length > 0 && props.group[0].series.type !== \"pie\") {\n return getTooltipContentCartesian(api, props);\n } else {\n return null;\n }\n}\n\nfunction getTooltipContentCartesian(\n api: ChartAPI,\n {\n point,\n group,\n expandedSeries,\n renderers = {},\n setExpandedSeries,\n hideTooltip,\n seriesSorting,\n }: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): RenderedTooltipContent {\n // The cartesian tooltip might or might not have a selected point, but it always has a non-empty group.\n // By design, every point of the group has the same x value.\n const x = group[0].x;\n const chart = group[0].series.chart;\n const getSeriesMarker = (series: Highcharts.Series) => {\n const itemOptions = api.context.settings.getItemOptions?.(getSeriesId(series));\n return api.renderMarker({\n type: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status),\n });\n };\n const matchedItems = findTooltipSeriesItems(getChartSeries(chart.series), group, seriesSorting);\n const detailItems: ChartSeriesDetailItem[] = matchedItems.map((item) => {\n const valueFormatter = getFormatter(item.point.series.yAxis);\n const itemY = isXThreshold(item.point.series) ? null : (item.point.y ?? null);\n const customContent = renderers.point\n ? renderers.point({\n item,\n hideTooltip,\n })\n : undefined;\n return {\n key: customContent?.key ?? item.point.series.name,\n value: customContent?.value ?? valueFormatter(itemY),\n marker: getSeriesMarker(item.point.series),\n subItems: customContent?.subItems,\n expandableId: customContent?.expandable ? item.point.series.name : undefined,\n highlighted: item.point.x === point?.x && item.point.y === point?.y,\n description:\n customContent?.description === undefined && item.errorRanges.length ? (\n <>\n {item.errorRanges.map((errorBarPoint, index) => (\n <div key={index} className={styles[\"error-range\"]}>\n <span>{errorBarPoint.series.userOptions.name ? errorBarPoint.series.userOptions.name : \"\"}</span>\n <span>\n {valueFormatter(errorBarPoint.options.low ?? 0)} - {valueFormatter(errorBarPoint.options.high ?? 0)}\n </span>\n </div>\n ))}\n </>\n ) : (\n customContent?.description\n ),\n };\n });\n // We only support cartesian charts with a single x axis.\n const titleFormatter = getFormatter(chart.xAxis[0]);\n const slotRenderProps: CoreChartProps.TooltipSlotProps = {\n x,\n items: matchedItems,\n hideTooltip: hideTooltip,\n };\n return {\n header: renderers.header?.(slotRenderProps) ?? titleFormatter(x),\n body: renderers.body?.(slotRenderProps) ?? (\n <ChartSeriesDetails\n details={detailItems}\n expandedSeries={expandedSeries[x]}\n setExpandedState={(id, isExpanded) => {\n setExpandedSeries((oldState) => {\n const expandedSeriesInCurrentCoordinate = new Set(oldState[x]);\n if (isExpanded) {\n expandedSeriesInCurrentCoordinate.add(id);\n } else {\n expandedSeriesInCurrentCoordinate.delete(id);\n }\n return { ...oldState, [x]: expandedSeriesInCurrentCoordinate };\n });\n }}\n />\n ),\n footer: renderers.footer?.(slotRenderProps),\n };\n}\n\nfunction getTooltipContentPie(\n api: ChartAPI,\n {\n point,\n renderers = {},\n hideTooltip,\n }: { point: Highcharts.Point } & { renderers?: CoreChartProps.TooltipContentRenderer; hideTooltip: () => void },\n): RenderedTooltipContent {\n const tooltipDetails: CoreChartProps.TooltipSlotProps = {\n x: point.x,\n items: [{ point, errorRanges: [] }],\n hideTooltip,\n };\n\n const itemOptions = api.context.settings.getItemOptions?.(getPointId(point));\n const markerAriaLabel = api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status);\n\n return {\n header: renderers.header?.(tooltipDetails) ?? (\n <div className={styles[\"tooltip-default-header\"]}>\n {api.renderMarker({\n type: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: markerAriaLabel,\n })}\n <Box variant=\"span\" fontWeight=\"bold\">\n {point.name}\n </Box>\n </div>\n ),\n body:\n renderers.body?.(tooltipDetails) ??\n (renderers.details ? (\n <ChartSeriesDetails\n details={renderers.details({\n point,\n hideTooltip,\n })}\n compactList={true}\n />\n ) : (\n // We expect all pie chart segments to have defined y values. We use y=0 as fallback\n // because the property is optional in Highcharts types.\n <ChartSeriesDetails details={[{ key: point.series.name, value: point.y ?? 0 }]} />\n )),\n footer: renderers.footer?.(tooltipDetails),\n };\n}\n\nfunction findTooltipSeriesItems(\n series: readonly Highcharts.Series[],\n group: readonly Highcharts.Point[],\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>,\n): MatchedItem[] {\n const seriesOrder = series.reduce((d, s, i) => d.set(s, i), new Map<Highcharts.Series, number>());\n const getSeriesIndex = (s: Highcharts.Series) => seriesOrder.get(s) ?? -1;\n const seriesErrors = new Map<string, Highcharts.Point[]>();\n const matchedSeries = new Set<Highcharts.Series>();\n const matchedItems: MatchedItem[] = [];\n for (const point of group) {\n if (!isPointVisible(point)) {\n continue;\n }\n // We only support errorbar series that are linked to other series. In tooltip content we add\n // linked error bars to series detail slot.\n if (point.series.type === \"errorbar\") {\n if (point.series.linkedParent) {\n addError(getSeriesId(point.series.linkedParent), point);\n } else {\n warnOnce(\n \"chart-components\",\n 'The `linkedTo` property of \"errorbar\" series is missing, or points to a series that does not exist.',\n );\n }\n } else {\n addMatchedPoints(point);\n }\n }\n function addError(seriesId: string, errorPoint: Highcharts.Point) {\n if (errorPoint.options.low !== undefined && errorPoint.options.high !== undefined) {\n const errorRanges = seriesErrors.get(seriesId) ?? [];\n errorRanges.push(errorPoint);\n seriesErrors.set(seriesId, errorRanges);\n }\n }\n function addMatchedPoints(point: Highcharts.Point) {\n if (!matchedSeries.has(point.series)) {\n matchedSeries.add(point.series);\n if (isXThreshold(point.series)) {\n matchedItems.push({ point, errorRanges: [] });\n } else {\n point.series.data\n .filter((d) => d.x === point.x)\n .sort((a, b) => (a.y ?? 0) - (b.y ?? 0))\n .forEach((point) => matchedItems.push({ point, errorRanges: [] }));\n }\n }\n }\n return (\n matchedItems\n .sort((i1, i2) => {\n if (seriesSorting === \"by-value-desc\") {\n return (i2.point.y ?? 0) - (i1.point.y ?? 0);\n }\n // We sort matched items by series order. If there are multiple items that belong to the same series, we sort them by value.\n const s1 = getSeriesIndex(i1.point.series) - getSeriesIndex(i2.point.series);\n return s1 || (i1.point.y ?? 0) - (i2.point.y ?? 0);\n })\n // For each series item we add linked error ranges, sorted by their respective series indices.\n .map((item) => {\n const errorRanges = seriesErrors.get(getSeriesId(item.point.series)) ?? [];\n const sortedErrorRanges = errorRanges.sort((i1, i2) => getSeriesIndex(i1.series) - getSeriesIndex(i2.series));\n return { ...item, errorRanges: sortedErrorRanges };\n })\n );\n}\n"]}
|
package/core/interfaces.d.ts
CHANGED
|
@@ -177,27 +177,27 @@ export interface BaseTooltipPointFormatted {
|
|
|
177
177
|
value: React.ReactNode;
|
|
178
178
|
}>;
|
|
179
179
|
}
|
|
180
|
-
export interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {
|
|
180
|
+
export interface AreaSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {
|
|
181
181
|
type: "area";
|
|
182
182
|
data: readonly PointDataItemType[];
|
|
183
183
|
}
|
|
184
|
-
export interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {
|
|
184
|
+
export interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {
|
|
185
185
|
type: "areaspline";
|
|
186
186
|
data: readonly PointDataItemType[];
|
|
187
187
|
}
|
|
188
|
-
export interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {
|
|
188
|
+
export interface ColumnSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {
|
|
189
189
|
type: "column";
|
|
190
190
|
data: readonly PointDataItemType[];
|
|
191
191
|
}
|
|
192
|
-
export interface LineSeriesOptions extends BaseCartesianLineLikeOptions {
|
|
192
|
+
export interface LineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {
|
|
193
193
|
type: "line";
|
|
194
194
|
data: readonly PointDataItemType[];
|
|
195
195
|
}
|
|
196
|
-
export interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {
|
|
196
|
+
export interface SplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {
|
|
197
197
|
type: "spline";
|
|
198
198
|
data: readonly PointDataItemType[];
|
|
199
199
|
}
|
|
200
|
-
export interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {
|
|
200
|
+
export interface ScatterSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {
|
|
201
201
|
type: "scatter";
|
|
202
202
|
data: readonly PointDataItemType[];
|
|
203
203
|
marker?: PointMarkerOptions;
|
|
@@ -246,6 +246,16 @@ interface BaseSeriesOptions {
|
|
|
246
246
|
color?: string;
|
|
247
247
|
}
|
|
248
248
|
type BaseCartesianSeriesOptions = BaseSeriesOptions;
|
|
249
|
+
export interface LinkableSeries {
|
|
250
|
+
/**
|
|
251
|
+
* Links this series to another series by ID, or `":previous"` for the immediately preceding series.
|
|
252
|
+
* A linked series does not appear as a separate item in the legend or series filter, and its visibility
|
|
253
|
+
* follows the series it is linked to. It still renders in the chart and appears as a separate row in the tooltip.
|
|
254
|
+
*
|
|
255
|
+
* Use this to attach projected, forecast, or supplementary series to a primary series without cluttering the legend.
|
|
256
|
+
*/
|
|
257
|
+
linkedTo?: string;
|
|
258
|
+
}
|
|
249
259
|
interface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {
|
|
250
260
|
dashStyle?: Highcharts.DashStyleValue;
|
|
251
261
|
}
|
package/core/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","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 type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * When set to true, enables horizontal scrolling for legend items with long text.\n * By default, long text is truncated with ellipsis.\n */\n enableHorizontalScroll?: boolean;\n /**\n * This property only applies when there are no secondary items and `position=\"bottom\"`.\n */\n horizontalAlignment?: LegendOptionsHorizontalAlignment;\n }\n\n export type LegendOptionsHorizontalAlignment = \"start\" | \"center\";\n\n export type LegendItem = InternalComponentTypes.LegendItem;\n export type LegendTooltipContent = InternalComponentTypes.LegendTooltipContent;\n export type GetLegendTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export type GetLegendTooltipContentProps = InternalComponentTypes.GetLegendTooltipContentProps;\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\" | \"target\";\n size?: \"small\" | \"medium\" | \"large\";\n debounce?: number | boolean;\n seriesSorting?: \"as-added\" | \"by-value-desc\";\n }\n\n export type GetTooltipContent = (props: GetTooltipContentProps) => TooltipContentRenderer;\n export interface GetTooltipContentProps {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }\n export interface TooltipContentRenderer {\n point?: (props: TooltipPointProps) => TooltipPointFormatted;\n details?: (props: TooltipDetailsProps) => readonly TooltipDetail[];\n header?: (props: TooltipSlotProps) => React.ReactNode;\n body?: (props: TooltipSlotProps) => React.ReactNode;\n footer?: (props: TooltipSlotProps) => React.ReactNode;\n }\n export type TooltipPointFormatted = BaseTooltipPointFormatted;\n export interface TooltipContentItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n }\n export interface TooltipPointProps {\n item: TooltipContentItem;\n hideTooltip: () => void;\n }\n export interface TooltipSlotProps {\n x: number;\n items: TooltipContentItem[];\n hideTooltip: () => void;\n }\n\n export interface TooltipDetailsProps {\n point: Highcharts.Point;\n hideTooltip: () => void;\n }\n\n export type TooltipDetail = BaseTooltipDetail;\n\n export interface LegendItemHighlightDetail {\n item: LegendItem;\n }\n\n export interface ApiInteraction {\n interactionType: \"api\";\n }\n export interface FilterInteraction {\n interactionType: \"filter\";\n }\n export interface ToggleInteraction {\n interactionType: \"toggle\";\n targetItemId: string;\n }\n export interface SelectInteraction {\n interactionType: \"select\";\n targetItemId: string;\n }\n\n export type InteractionKind = ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction;\n\n export type VisibleItemsChangeDetail = { items: readonly LegendItem[] } & InteractionKind;\n\n export interface HighlightChangeDetail {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n isApiCall: boolean;\n }\n export interface HighlightClearDetail {\n isApiCall: boolean;\n }\n\n export type I18nStrings = CartesianI18nStrings & PieI18nStrings & CoreI18nStrings;\n}\n\nexport interface CoreLegendProps {\n items: readonly CoreLegendProps.Item[];\n title?: string;\n ariaLabel?: string;\n actions?: React.ReactNode;\n alignment?: \"horizontal\" | \"vertical\";\n enableHorizontalScroll?: boolean;\n horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;\n onClearHighlight?: NonCancelableEventHandler;\n onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreLegendProps.VisibleItemsChangeDetail>;\n getLegendTooltipContent?: CoreLegendProps.GetTooltipContent;\n}\n\nexport namespace CoreLegendProps {\n export type Item = InternalComponentTypes.LegendItem;\n export type GetTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export interface ItemHighlightDetail {\n item: Item;\n }\n export type VisibleItemsChangeDetail = { items: readonly string[] } & (\n | CoreChartProps.ToggleInteraction\n | CoreChartProps.SelectInteraction\n );\n}\n\n// Utility types\n\nexport interface Rect {\n x: number;\n y: number;\n height: number;\n width: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","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 type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\nexport interface LinkableSeries {\n /**\n * Links this series to another series by ID, or `\":previous\"` for the immediately preceding series.\n * A linked series does not appear as a separate item in the legend or series filter, and its visibility\n * follows the series it is linked to. It still renders in the chart and appears as a separate row in the tooltip.\n *\n * Use this to attach projected, forecast, or supplementary series to a primary series without cluttering the legend.\n */\n linkedTo?: string;\n}\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * When set to true, enables horizontal scrolling for legend items with long text.\n * By default, long text is truncated with ellipsis.\n */\n enableHorizontalScroll?: boolean;\n /**\n * This property only applies when there are no secondary items and `position=\"bottom\"`.\n */\n horizontalAlignment?: LegendOptionsHorizontalAlignment;\n }\n\n export type LegendOptionsHorizontalAlignment = \"start\" | \"center\";\n\n export type LegendItem = InternalComponentTypes.LegendItem;\n export type LegendTooltipContent = InternalComponentTypes.LegendTooltipContent;\n export type GetLegendTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export type GetLegendTooltipContentProps = InternalComponentTypes.GetLegendTooltipContentProps;\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\" | \"target\";\n size?: \"small\" | \"medium\" | \"large\";\n debounce?: number | boolean;\n seriesSorting?: \"as-added\" | \"by-value-desc\";\n }\n\n export type GetTooltipContent = (props: GetTooltipContentProps) => TooltipContentRenderer;\n export interface GetTooltipContentProps {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }\n export interface TooltipContentRenderer {\n point?: (props: TooltipPointProps) => TooltipPointFormatted;\n details?: (props: TooltipDetailsProps) => readonly TooltipDetail[];\n header?: (props: TooltipSlotProps) => React.ReactNode;\n body?: (props: TooltipSlotProps) => React.ReactNode;\n footer?: (props: TooltipSlotProps) => React.ReactNode;\n }\n export type TooltipPointFormatted = BaseTooltipPointFormatted;\n export interface TooltipContentItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n }\n export interface TooltipPointProps {\n item: TooltipContentItem;\n hideTooltip: () => void;\n }\n export interface TooltipSlotProps {\n x: number;\n items: TooltipContentItem[];\n hideTooltip: () => void;\n }\n\n export interface TooltipDetailsProps {\n point: Highcharts.Point;\n hideTooltip: () => void;\n }\n\n export type TooltipDetail = BaseTooltipDetail;\n\n export interface LegendItemHighlightDetail {\n item: LegendItem;\n }\n\n export interface ApiInteraction {\n interactionType: \"api\";\n }\n export interface FilterInteraction {\n interactionType: \"filter\";\n }\n export interface ToggleInteraction {\n interactionType: \"toggle\";\n targetItemId: string;\n }\n export interface SelectInteraction {\n interactionType: \"select\";\n targetItemId: string;\n }\n\n export type InteractionKind = ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction;\n\n export type VisibleItemsChangeDetail = { items: readonly LegendItem[] } & InteractionKind;\n\n export interface HighlightChangeDetail {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n isApiCall: boolean;\n }\n export interface HighlightClearDetail {\n isApiCall: boolean;\n }\n\n export type I18nStrings = CartesianI18nStrings & PieI18nStrings & CoreI18nStrings;\n}\n\nexport interface CoreLegendProps {\n items: readonly CoreLegendProps.Item[];\n title?: string;\n ariaLabel?: string;\n actions?: React.ReactNode;\n alignment?: \"horizontal\" | \"vertical\";\n enableHorizontalScroll?: boolean;\n horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;\n onClearHighlight?: NonCancelableEventHandler;\n onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreLegendProps.VisibleItemsChangeDetail>;\n getLegendTooltipContent?: CoreLegendProps.GetTooltipContent;\n}\n\nexport namespace CoreLegendProps {\n export type Item = InternalComponentTypes.LegendItem;\n export type GetTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export interface ItemHighlightDetail {\n item: Item;\n }\n export type VisibleItemsChangeDetail = { items: readonly string[] } & (\n | CoreChartProps.ToggleInteraction\n | CoreChartProps.SelectInteraction\n );\n}\n\n// Utility types\n\nexport interface Rect {\n x: number;\n y: number;\n height: number;\n width: number;\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "chart-components";
|
|
2
|
-
export var PACKAGE_VERSION = "1.0.0 (
|
|
2
|
+
export var PACKAGE_VERSION = "1.0.0 (9a1b8225)";
|
|
3
3
|
export var THEME = "open-source-visual-refresh";
|
|
4
4
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
5
5
|
export var SYSTEM = "core";
|
package/internal/manifest.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type { Series } from "highcharts";
|
|
1
|
+
import type { Point, Series } from "highcharts";
|
|
2
2
|
interface InternalSeries extends Series {
|
|
3
3
|
options: Series["options"] & {
|
|
4
4
|
isInternal?: boolean;
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
7
|
export declare function getChartSeries(series: InternalSeries[]): InternalSeries[];
|
|
8
|
+
/**
|
|
9
|
+
* Returns point series or series it is linked to.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getMasterSeries(point: Point): Series;
|
|
12
|
+
/**
|
|
13
|
+
* Returns point series and all series linked to it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getLinkedSeries(point: Point): Series[];
|
|
8
16
|
export {};
|
|
@@ -8,4 +8,20 @@ export function getChartSeries(series) {
|
|
|
8
8
|
// navigator is causing duplicated unexpected datapoints and series entries in the chart.
|
|
9
9
|
return series.filter((s) => !s.options.isInternal);
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns point series or series it is linked to.
|
|
13
|
+
*/
|
|
14
|
+
export function getMasterSeries(point) {
|
|
15
|
+
var _a;
|
|
16
|
+
const masterSeries = (_a = point.series.linkedParent) !== null && _a !== void 0 ? _a : point.series;
|
|
17
|
+
return masterSeries;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns point series and all series linked to it.
|
|
21
|
+
*/
|
|
22
|
+
export function getLinkedSeries(point) {
|
|
23
|
+
const masterSeries = getMasterSeries(point);
|
|
24
|
+
const linkedSeries = [masterSeries, ...masterSeries.linkedSeries];
|
|
25
|
+
return linkedSeries;
|
|
26
|
+
}
|
|
11
27
|
//# sourceMappingURL=chart-series.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-series.js","sourceRoot":"","sources":["../../../../src/internal/utils/chart-series.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAYtC,MAAM,UAAU,cAAc,CAAC,MAAwB;IACrD,uFAAuF;IAEvF,4EAA4E;IAC5E,0FAA0F;IAE1F,2FAA2F;IAC3F,yFAAyF;IAEzF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACrD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Series } from \"highcharts\";\n\n// isInternal is currently not a publicly supported prop\n// https://github.com/highcharts/highcharts/issues/23278\ninterface InternalSeries extends Series {\n options: Series[\"options\"] & {\n isInternal?: boolean;\n };\n}\n\nexport function getChartSeries(series: InternalSeries[]) {\n // Filters out internal series from chart, e.g., series from navigator, scrollbar, etc.\n\n // When calling chart.series, the result includes both the main chart series\n // and additional internal series (e.g., navigator series) when using Highstock navigator.\n\n // We are adding datapoints and doing other calculations and using Highstock version with a\n // navigator is causing duplicated unexpected datapoints and series entries in the chart.\n\n return series.filter((s) => !s.options.isInternal);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-series.js","sourceRoot":"","sources":["../../../../src/internal/utils/chart-series.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAYtC,MAAM,UAAU,cAAc,CAAC,MAAwB;IACrD,uFAAuF;IAEvF,4EAA4E;IAC5E,0FAA0F;IAE1F,2FAA2F;IAC3F,yFAAyF;IAEzF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;;IAC1C,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,MAAM,CAAC,YAAY,mCAAI,KAAK,CAAC,MAAM,CAAC;IAC/D,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAClE,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point, Series } from \"highcharts\";\n\n// isInternal is currently not a publicly supported prop\n// https://github.com/highcharts/highcharts/issues/23278\ninterface InternalSeries extends Series {\n options: Series[\"options\"] & {\n isInternal?: boolean;\n };\n}\n\nexport function getChartSeries(series: InternalSeries[]) {\n // Filters out internal series from chart, e.g., series from navigator, scrollbar, etc.\n\n // When calling chart.series, the result includes both the main chart series\n // and additional internal series (e.g., navigator series) when using Highstock navigator.\n\n // We are adding datapoints and doing other calculations and using Highstock version with a\n // navigator is causing duplicated unexpected datapoints and series entries in the chart.\n\n return series.filter((s) => !s.options.isInternal);\n}\n\n/**\n * Returns point series or series it is linked to.\n */\nexport function getMasterSeries(point: Point): Series {\n const masterSeries = point.series.linkedParent ?? point.series;\n return masterSeries;\n}\n\n/**\n * Returns point series and all series linked to it.\n */\nexport function getLinkedSeries(point: Point): Series[] {\n const masterSeries = getMasterSeries(point);\n const linkedSeries = [masterSeries, ...masterSeries.linkedSeries];\n return linkedSeries;\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { isPointVisible } from "../../core/utils";
|
|
3
4
|
// Although series data can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints
|
|
4
5
|
// than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)
|
|
5
6
|
export const getSeriesData = (data) => {
|
|
6
|
-
return data.filter((d) => !!d);
|
|
7
|
+
return data.filter((d) => !!d && isPointVisible(d));
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=series-data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series-data.js","sourceRoot":"","sources":["../../../../src/internal/utils/series-data.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,qIAAqI;AACrI,wIAAwI;AACxI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAkB,EAAgB,EAAE;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"series-data.js","sourceRoot":"","sources":["../../../../src/internal/utils/series-data.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qIAAqI;AACrI,wIAAwI;AACxI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAkB,EAAgB,EAAE;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point } from \"highcharts\";\n\nimport { isPointVisible } from \"../../core/utils\";\n\n// Although series data 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)\nexport const getSeriesData = (data: Array<Point>): Array<Point> => {\n return data.filter((d) => !!d && isPointVisible(d));\n};\n"]}
|