@cloudscape-design/chart-components 1.0.58 → 1.0.60
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/core/chart-api/chart-extra-pointer.js +3 -10
- package/core/chart-api/chart-extra-pointer.js.map +1 -1
- package/core/chart-api/chart-extra-tooltip.js +1 -1
- package/core/chart-api/chart-extra-tooltip.js.map +1 -1
- package/internal/chart-styles.d.ts +1 -1
- package/internal/chart-styles.js +1 -1
- package/internal/chart-styles.js.map +1 -1
- package/internal/components/series-marker/render-marker.js +2 -2
- package/internal/components/series-marker/render-marker.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -154,16 +154,9 @@ export class ChartExtraPointer {
|
|
|
154
154
|
};
|
|
155
155
|
this.applyCursorStyle = () => {
|
|
156
156
|
const container = this.context.chart().container;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
if (this.hoveredPoint || this.hoveredGroup) {
|
|
163
|
-
setCursor("pointer");
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
setCursor("default");
|
|
157
|
+
if (container) {
|
|
158
|
+
const value = this.hoveredPoint || this.hoveredGroup ? "pointer" : "default";
|
|
159
|
+
container.style.cursor = value;
|
|
167
160
|
}
|
|
168
161
|
};
|
|
169
162
|
this.context = context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-extra-pointer.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-pointer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,gBAAgB,GAA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C,SAAS,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,SAAS,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC;QAxKA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CAuKF","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 { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { DebouncedCall } from \"../../internal/utils/utils\";\nimport { isPointVisible } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst HOVER_LOST_DELAY = 25;\n\nexport interface ChartExtraPointerHandlers {\n onPointHover(point: Highcharts.Point): void;\n onGroupHover(group: Highcharts.Point[]): void;\n onHoverLost(): void;\n onPointClick(point: Highcharts.Point): void;\n onGroupClick(group: Highcharts.Point[]): void;\n}\n\n// Chart helper that implements pointer events (click and hover).\nexport class ChartExtraPointer {\n private context: ChartExtraContext;\n private handlers: ChartExtraPointerHandlers;\n private hoveredPoint: null | Highcharts.Point = null;\n private hoveredGroup: null | Highcharts.Point[] = null;\n private tooltipHovered = false;\n private hoverLostCall = new DebouncedCall();\n\n constructor(context: ChartExtraContext, handlers: ChartExtraPointerHandlers) {\n this.context = context;\n this.handlers = handlers;\n }\n\n public onChartLoad = (chart: Highcharts.Chart) => {\n chart.container.addEventListener(\"mousemove\", this.onChartMousemove);\n chart.container.addEventListener(\"mouseout\", this.onChartMouseout);\n };\n\n public onChartDestroy = () => {\n this.context.chartOrNull?.container?.removeEventListener(\"mousemove\", this.onChartMousemove);\n this.context.chartOrNull?.container?.removeEventListener(\"mouseout\", this.onChartMouseout);\n };\n\n // This event is triggered by Highcharts when the cursor is over a Highcharts point. We leave this to\n // Highcharts because it includes computation of complex shape intersections, such as pie chart segments.\n // When triggered, we set the given point as hovered, and it takes precedence over hovered groups.\n public onSeriesPointMouseOver = (point: Highcharts.Point) => {\n this.setHoveredPoint(point);\n };\n\n // When the pointer leaves a point, it does not necessarily mean the hover state needs to be cleared, as another\n // point or group can be hovered next. If it does not happen, the on-hover-lost handler is called after a short delay.\n public onSeriesPointMouseOut = () => {\n this.hoveredPoint = null;\n this.clearHover();\n };\n\n // We clear hover state when the pointer is moved outside the chart, unless it is moved inside the tooltip.\n // Wo do, hover, clear the point and group hover state so that if the pointer leaves chart from the tooltip,\n // the on-hover-lost handler is still called.\n public onMouseEnterTooltip = () => {\n this.tooltipHovered = true;\n this.hoveredPoint = null;\n this.hoveredGroup = null;\n };\n\n // When the pointer leaves the tooltip it can hover another point or group. If that does not happen,\n // the on-hover-lost handler is called after a short delay.\n public onMouseLeaveTooltip = () => {\n this.tooltipHovered = false;\n this.clearHover();\n };\n\n // The mouse-move handler takes all move events inside the chart, and its purpose is to capture hover for groups\n // of points (those having matching X value in cartesian charts), as this is not directly supported by Highcharts.\n // Points hovering takes precedence over groups hovering.\n private onChartMousemove = (event: MouseEvent) => {\n const chart = this.context.chart();\n // In pie charts there is no support for groups - only a single point can be hovered at a time.\n if (getChartSeries(chart.series).some((s) => s.type === \"pie\")) {\n return;\n }\n // The plotX and plotY are pointer coordinates, normalized against the chart plot.\n const normalized = chart.pointer.normalize(event);\n const plotX = normalized.chartX;\n const plotY = normalized.chartY;\n const { plotLeft, plotTop, plotWidth, plotHeight } = chart;\n // We only check for matched groups if the plotX, plotY are within the plot area, where series are rendered.\n if (plotX >= plotLeft && plotX <= plotLeft + plotWidth && plotY >= plotTop && plotY <= plotTop + plotHeight) {\n // We match groups by comparing the plotX, plotY against each group rect. If the pointer is within one of\n // the rects - the group is considered matched. Otherwise, we take the group which is closest to the pointer.\n // This is done to avoid gaps, when the hover state switches between on and off in a sparsely populated chart,\n // causing the tooltip to show and hide as the pointer moves.\n let matchedGroup: Highcharts.Point[] = [];\n let minDistance = Number.POSITIVE_INFINITY;\n for (const { group, rect } of this.context.derived.groupRects) {\n const [target, start, end] = chart.inverted\n ? [plotY, rect.y, rect.y + rect.height]\n : [plotX, rect.x, rect.x + rect.width];\n const minTargetDistance = Math.min(Math.abs(start - target), Math.abs(end - target));\n if (start <= target && target < end) {\n matchedGroup = group;\n break;\n } else if (minTargetDistance < minDistance) {\n minDistance = minTargetDistance;\n matchedGroup = group;\n }\n }\n this.setHoveredGroup(matchedGroup);\n }\n // If the plotX, plotY are outside of the series area (e.g. if the pointer is above axis titles or ticks),\n // we clear the group hover state and trigger the on-hover-lost after a short delay.\n else {\n this.hoveredGroup = null;\n this.clearHover();\n }\n };\n\n // This event is triggered when the pointer leaves the chart area. Here, it is technically not necessary to add\n // a delay before calling the on-hover-lost handler, but it is done for consistency in the UX.\n private onChartMouseout = () => {\n this.hoveredGroup = null;\n this.clearHover();\n };\n\n // This event is triggered by Highcharts when there is a click inside the chart plot. It might or might not include\n // the point, hovered immediately before the click.\n public onChartClick = (point: null | Highcharts.Point) => {\n this.onClick(point);\n };\n\n // This event is triggered by Highcharts when a series point is clicked, it always has a point target.\n public onSeriesPointClick = (point: Highcharts.Point) => {\n this.onClick(point);\n };\n\n // We treat the chart and point clicks the same, but call different handlers depending on the target (null or point).\n // When the point is not present, we assume the click was done on a group, so we take the group that was hovered before\n // the click event triggered.\n // Before calling the on-point-click or on-group-click handlers, we verify if the target point or group are still valid\n // (visible, and not destroyed by Highcharts).\n private onClick = (point: null | Highcharts.Point) => {\n const targetPoint = point ?? (this.hoveredPoint && isPointVisible(this.hoveredPoint) ? this.hoveredPoint : null);\n if (targetPoint) {\n this.handlers.onPointClick(targetPoint);\n return;\n }\n const targetGroup = this.hoveredGroup?.filter(isPointVisible) ?? null;\n if (targetGroup && targetGroup.length > 0) {\n this.handlers.onGroupClick(targetGroup);\n return;\n }\n };\n\n private setHoveredPoint = (point: Highcharts.Point) => {\n if (isPointVisible(point)) {\n this.hoveredPoint = point;\n this.hoveredGroup = null;\n this.handlers.onPointHover(point);\n this.applyCursorStyle();\n }\n };\n\n private setHoveredGroup = (group: Highcharts.Point[]) => {\n if (!this.hoveredPoint || !isPointVisible(this.hoveredPoint)) {\n const availablePoints = group.filter(isPointVisible);\n this.hoveredPoint = null;\n this.hoveredGroup = availablePoints;\n this.handlers.onGroupHover(availablePoints);\n this.applyCursorStyle();\n }\n };\n\n // The function calls the on-hover-lost handler in a short delay to give time for the hover to\n // transition from one target to another. Before calling the handler we check if no target\n // (point, group, or tooltip) is hovered.\n private clearHover = () => {\n this.hoverLostCall.call(() => {\n if (!this.hoveredPoint && !this.hoveredGroup && !this.tooltipHovered) {\n this.handlers.onHoverLost();\n this.applyCursorStyle();\n }\n }, HOVER_LOST_DELAY);\n };\n\n private applyCursorStyle = () => {\n const container = this.context.chart().container;\n const setCursor = (value: \"pointer\" | \"default\") => {\n if (container && container.style.cursor !== value) {\n container.style.cursor = value;\n }\n };\n if (this.hoveredPoint || this.hoveredGroup) {\n setCursor(\"pointer\");\n } else {\n setCursor(\"default\");\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-extra-pointer.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-pointer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAU5B,iEAAiE;AACjE,MAAM,OAAO,iBAAiB;IAQ5B,YAAY,OAA0B,EAAE,QAAmC;QALnE,iBAAY,GAA4B,IAAI,CAAC;QAC7C,iBAAY,GAA8B,IAAI,CAAC;QAC/C,mBAAc,GAAG,KAAK,CAAC;QACvB,kBAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAOrC,gBAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;YAC/C,KAA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ACpC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;gBAC5C,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC;QAEF,8FAA8F;QAC9F,0FAA0F;QAC1F,yCAAyC;QACjC,eAAU,GAAG,GAAG,EAAE;YACxB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;oBACrE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;oBAC5B,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC1B,CAAC;YACH,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACvB,CAAC,CAAC;QAEM,qBAAgB,GAAG,GAAG,EAAE;YAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC;YACjD,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC7E,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;YACjC,CAAC;QACH,CAAC,CAAC;QAlKA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CAiKF","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 { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { DebouncedCall } from \"../../internal/utils/utils\";\nimport { isPointVisible } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst HOVER_LOST_DELAY = 25;\n\nexport interface ChartExtraPointerHandlers {\n onPointHover(point: Highcharts.Point): void;\n onGroupHover(group: Highcharts.Point[]): void;\n onHoverLost(): void;\n onPointClick(point: Highcharts.Point): void;\n onGroupClick(group: Highcharts.Point[]): void;\n}\n\n// Chart helper that implements pointer events (click and hover).\nexport class ChartExtraPointer {\n private context: ChartExtraContext;\n private handlers: ChartExtraPointerHandlers;\n private hoveredPoint: null | Highcharts.Point = null;\n private hoveredGroup: null | Highcharts.Point[] = null;\n private tooltipHovered = false;\n private hoverLostCall = new DebouncedCall();\n\n constructor(context: ChartExtraContext, handlers: ChartExtraPointerHandlers) {\n this.context = context;\n this.handlers = handlers;\n }\n\n public onChartLoad = (chart: Highcharts.Chart) => {\n chart.container.addEventListener(\"mousemove\", this.onChartMousemove);\n chart.container.addEventListener(\"mouseout\", this.onChartMouseout);\n };\n\n public onChartDestroy = () => {\n this.context.chartOrNull?.container?.removeEventListener(\"mousemove\", this.onChartMousemove);\n this.context.chartOrNull?.container?.removeEventListener(\"mouseout\", this.onChartMouseout);\n };\n\n // This event is triggered by Highcharts when the cursor is over a Highcharts point. We leave this to\n // Highcharts because it includes computation of complex shape intersections, such as pie chart segments.\n // When triggered, we set the given point as hovered, and it takes precedence over hovered groups.\n public onSeriesPointMouseOver = (point: Highcharts.Point) => {\n this.setHoveredPoint(point);\n };\n\n // When the pointer leaves a point, it does not necessarily mean the hover state needs to be cleared, as another\n // point or group can be hovered next. If it does not happen, the on-hover-lost handler is called after a short delay.\n public onSeriesPointMouseOut = () => {\n this.hoveredPoint = null;\n this.clearHover();\n };\n\n // We clear hover state when the pointer is moved outside the chart, unless it is moved inside the tooltip.\n // Wo do, hover, clear the point and group hover state so that if the pointer leaves chart from the tooltip,\n // the on-hover-lost handler is still called.\n public onMouseEnterTooltip = () => {\n this.tooltipHovered = true;\n this.hoveredPoint = null;\n this.hoveredGroup = null;\n };\n\n // When the pointer leaves the tooltip it can hover another point or group. If that does not happen,\n // the on-hover-lost handler is called after a short delay.\n public onMouseLeaveTooltip = () => {\n this.tooltipHovered = false;\n this.clearHover();\n };\n\n // The mouse-move handler takes all move events inside the chart, and its purpose is to capture hover for groups\n // of points (those having matching X value in cartesian charts), as this is not directly supported by Highcharts.\n // Points hovering takes precedence over groups hovering.\n private onChartMousemove = (event: MouseEvent) => {\n const chart = this.context.chart();\n // In pie charts there is no support for groups - only a single point can be hovered at a time.\n if (getChartSeries(chart.series).some((s) => s.type === \"pie\")) {\n return;\n }\n // The plotX and plotY are pointer coordinates, normalized against the chart plot.\n const normalized = chart.pointer.normalize(event);\n const plotX = normalized.chartX;\n const plotY = normalized.chartY;\n const { plotLeft, plotTop, plotWidth, plotHeight } = chart;\n // We only check for matched groups if the plotX, plotY are within the plot area, where series are rendered.\n if (plotX >= plotLeft && plotX <= plotLeft + plotWidth && plotY >= plotTop && plotY <= plotTop + plotHeight) {\n // We match groups by comparing the plotX, plotY against each group rect. If the pointer is within one of\n // the rects - the group is considered matched. Otherwise, we take the group which is closest to the pointer.\n // This is done to avoid gaps, when the hover state switches between on and off in a sparsely populated chart,\n // causing the tooltip to show and hide as the pointer moves.\n let matchedGroup: Highcharts.Point[] = [];\n let minDistance = Number.POSITIVE_INFINITY;\n for (const { group, rect } of this.context.derived.groupRects) {\n const [target, start, end] = chart.inverted\n ? [plotY, rect.y, rect.y + rect.height]\n : [plotX, rect.x, rect.x + rect.width];\n const minTargetDistance = Math.min(Math.abs(start - target), Math.abs(end - target));\n if (start <= target && target < end) {\n matchedGroup = group;\n break;\n } else if (minTargetDistance < minDistance) {\n minDistance = minTargetDistance;\n matchedGroup = group;\n }\n }\n this.setHoveredGroup(matchedGroup);\n }\n // If the plotX, plotY are outside of the series area (e.g. if the pointer is above axis titles or ticks),\n // we clear the group hover state and trigger the on-hover-lost after a short delay.\n else {\n this.hoveredGroup = null;\n this.clearHover();\n }\n };\n\n // This event is triggered when the pointer leaves the chart area. Here, it is technically not necessary to add\n // a delay before calling the on-hover-lost handler, but it is done for consistency in the UX.\n private onChartMouseout = () => {\n this.hoveredGroup = null;\n this.clearHover();\n };\n\n // This event is triggered by Highcharts when there is a click inside the chart plot. It might or might not include\n // the point, hovered immediately before the click.\n public onChartClick = (point: null | Highcharts.Point) => {\n this.onClick(point);\n };\n\n // This event is triggered by Highcharts when a series point is clicked, it always has a point target.\n public onSeriesPointClick = (point: Highcharts.Point) => {\n this.onClick(point);\n };\n\n // We treat the chart and point clicks the same, but call different handlers depending on the target (null or point).\n // When the point is not present, we assume the click was done on a group, so we take the group that was hovered before\n // the click event triggered.\n // Before calling the on-point-click or on-group-click handlers, we verify if the target point or group are still valid\n // (visible, and not destroyed by Highcharts).\n private onClick = (point: null | Highcharts.Point) => {\n const targetPoint = point ?? (this.hoveredPoint && isPointVisible(this.hoveredPoint) ? this.hoveredPoint : null);\n if (targetPoint) {\n this.handlers.onPointClick(targetPoint);\n return;\n }\n const targetGroup = this.hoveredGroup?.filter(isPointVisible) ?? null;\n if (targetGroup && targetGroup.length > 0) {\n this.handlers.onGroupClick(targetGroup);\n return;\n }\n };\n\n private setHoveredPoint = (point: Highcharts.Point) => {\n if (isPointVisible(point)) {\n this.hoveredPoint = point;\n this.hoveredGroup = null;\n this.handlers.onPointHover(point);\n this.applyCursorStyle();\n }\n };\n\n private setHoveredGroup = (group: Highcharts.Point[]) => {\n if (!this.hoveredPoint || !isPointVisible(this.hoveredPoint)) {\n const availablePoints = group.filter(isPointVisible);\n this.hoveredPoint = null;\n this.hoveredGroup = availablePoints;\n this.handlers.onGroupHover(availablePoints);\n this.applyCursorStyle();\n }\n };\n\n // The function calls the on-hover-lost handler in a short delay to give time for the hover to\n // transition from one target to another. Before calling the handler we check if no target\n // (point, group, or tooltip) is hovered.\n private clearHover = () => {\n this.hoverLostCall.call(() => {\n if (!this.hoveredPoint && !this.hoveredGroup && !this.tooltipHovered) {\n this.handlers.onHoverLost();\n this.applyCursorStyle();\n }\n }, HOVER_LOST_DELAY);\n };\n\n private applyCursorStyle = () => {\n const container = this.context.chart().container;\n if (container) {\n const value = this.hoveredPoint || this.hoveredGroup ? \"pointer\" : \"default\";\n container.style.cursor = value;\n }\n };\n}\n"]}
|
|
@@ -128,7 +128,7 @@ export class ChartExtraTooltip extends AsyncStore {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
get commonTrackAttrs() {
|
|
131
|
-
return { fill: "transparent", zIndex: -1,
|
|
131
|
+
return { fill: "transparent", zIndex: -1, "pointer-events": "none", direction: this.direction };
|
|
132
132
|
}
|
|
133
133
|
// We compute the direction from the chart container and then explicitly set it to the track
|
|
134
134
|
// elements, as otherwise the direction check done for track elements always results to "ltr".
|
|
@@ -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,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,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG3F,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAWvC,oEAAoE;AACpE,MAAM,OAAO,iBAAkB,SAAQ,UAAgC;IA2BrE,YAAY,OAA0B;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,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G,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, 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, style: \"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,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG3F,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAWvC,oEAAoE;AACpE,MAAM,OAAO,iBAAkB,SAAQ,UAAgC;IA2BrE,YAAY,OAA0B;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAzBnE,kGAAkG;QAClG,mFAAmF;QAC5E,gBAAW,GAAG,KAAK,CAAC;QACnB,oBAAe,GAAG,IAAI,aAAa,EAAE,CAAC;QACtC,mBAAc,GAAG,GAAG,EAAE;YAC5B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;gBACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,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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, 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"]}
|
package/internal/chart-styles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-styles.js","sourceRoot":"","sources":["../../../src/internal/chart-styles.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8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CAAC;IACR,KAAK,EAAE,CAAC;IACR,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAwC;CACzE,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAA0C;IACpE,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,2BAA2B;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAiF;IAC7G,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,2BAA2B;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8C;IACzE,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAyB;IACrD,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,MAAM;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,MAAM;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAwB;IACxD,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport {\n colorBackgroundContainerContent,\n colorChartsLineTick,\n colorChartsPaletteCategorical1,\n colorChartsPaletteCategorical2,\n colorChartsPaletteCategorical3,\n colorChartsPaletteCategorical4,\n colorChartsPaletteCategorical5,\n colorChartsPaletteCategorical6,\n colorChartsPaletteCategorical7,\n colorChartsPaletteCategorical8,\n colorChartsPaletteCategorical9,\n colorChartsPaletteCategorical10,\n colorChartsThresholdNeutral,\n colorTextBodyDefault,\n colorTextBodySecondary,\n fontFamilyBase,\n fontSizeBodyM,\n fontSizeBodyS,\n fontWeightHeadingS,\n} from \"@cloudscape-design/design-tokens\";\n\nimport styles from \"./styles.css.js\";\n\n// Here we define chart styles and colors, used across multiple components, including core chart, cartesian- and pie charts,\n// series markers.\n\nexport const colors = [\n colorChartsPaletteCategorical1,\n colorChartsPaletteCategorical2,\n colorChartsPaletteCategorical3,\n colorChartsPaletteCategorical4,\n colorChartsPaletteCategorical5,\n colorChartsPaletteCategorical6,\n colorChartsPaletteCategorical7,\n colorChartsPaletteCategorical8,\n colorChartsPaletteCategorical9,\n colorChartsPaletteCategorical10,\n];\n\nexport const chart: Highcharts.ChartOptions = {\n spacing: [10, 10, 0, 0],\n backgroundColor: \"transparent\",\n};\n\nexport const axisTitleCss: Highcharts.CSSObject = {\n color: colorTextBodyDefault,\n fontSize: fontSizeBodyM,\n fontWeight: fontWeightHeadingS,\n};\n\nexport const axisLabelsCss: Highcharts.CSSObject = {\n color: colorTextBodySecondary,\n fontSize: fontSizeBodyS,\n};\n\nexport const xAxisOptions: Highcharts.XAxisOptions = {\n tickColor: colorChartsLineTick,\n lineColor: colorChartsLineTick,\n gridLineColor: colorChartsLineTick,\n lineWidth: 1,\n crosshair: false,\n};\n\nexport const yAxisOptions: Highcharts.YAxisOptions = {\n tickColor: colorChartsLineTick,\n lineColor: colorChartsLineTick,\n gridLineColor: colorChartsLineTick,\n lineWidth: 0,\n crosshair: false,\n};\n\nexport const chartPlotCss: Highcharts.CSSObject = {\n font: fontFamilyBase,\n color: colorTextBodyDefault,\n fontSize: fontSizeBodyM,\n};\n\nexport const seriesBorderColor = colorBackgroundContainerContent;\n\nexport const hiddenSeriesMarker = { enabled: false, radius: 3, symbol: \"circle\" };\n\nexport const areaSeries = {\n fillOpacity: 0.4,\n marker: hiddenSeriesMarker,\n};\n\nexport const lineSeries = {\n marker: hiddenSeriesMarker,\n};\n\nexport const columnSeries = {\n groupPadding: 0.075,\n borderRadius: 4,\n borderWidth: 2,\n marker: hiddenSeriesMarker,\n};\n\nexport const errorbarSeries = {\n color: colorChartsThresholdNeutral,\n stemColor: colorChartsThresholdNeutral,\n whiskerColor: colorChartsThresholdNeutral,\n};\n\nexport const pieSeries = {\n borderWidth: 2,\n // This sets the color of the empty pie/donut ring.\n // See: https://github.com/highcharts/highcharts/issues/23073.\n color: \"transparent\",\n size: \"60%\",\n};\nexport const donutSeries = {\n ...pieSeries,\n innerSize: \"80%\",\n};\n\nexport const pieSeriesDataLabels = {\n connectorColor: colorChartsThresholdNeutral,\n};\n\nexport const dimmedPlotLineOpacity = 0.4;\n\nexport const seriesDataLabelsCss: Highcharts.CSSObject = {\n font: fontFamilyBase,\n color: colorTextBodyDefault,\n fontSize: fontSizeBodyM,\n fontWeight: fontWeightHeadingS,\n textOutline: \"\",\n};\n\nexport const seriesOpacityInactive = 0.3;\n\nexport const verticalAxisTitleBlockSize = 24;\nexport const verticalAxisTitleMargin = 4;\n\nexport const navigationFocusOutline = {\n class: styles[\"focus-outline\"],\n \"stroke-width\": 2,\n rx: 4,\n zIndex: 10,\n};\n\nexport const cursorLine = {\n fill: colorChartsLineTick,\n zIndex: 5,\n \"pointer-events\": \"none\",\n};\n\nexport const focusOutlineOffsets = {\n chart: -1,\n group: 4,\n point: 6,\n pointByType: { column: 2, pie: 2 } as Record<string, number | undefined>,\n};\n\nexport const thresholdSeries: Partial<Highcharts.SeriesLineOptions> = {\n dashStyle: \"ShortDash\",\n lineWidth: 0,\n color: colorChartsThresholdNeutral,\n};\n\nexport const thresholdPlotLine: Partial<Highcharts.XAxisPlotLinesOptions | Highcharts.YAxisPlotLinesOptions> = {\n width: 2,\n dashStyle: \"ShortDash\",\n zIndex: 3,\n color: colorChartsThresholdNeutral,\n};\n\nexport const chatPlotBaseline: Partial<Highcharts.XAxisPlotLinesOptions> = {\n color: colorChartsLineTick,\n width: 2,\n zIndex: 2,\n};\n\nexport const innerAreaTitleCss: Highcharts.CSSObject = {\n fontSize: \"28\",\n fontWeight: \"bold\",\n};\n\nexport const innerAreaDescriptionCss: Highcharts.CSSObject = {\n fontSize: \"18\",\n fontWeight: \"bold\",\n color: colorTextBodySecondary,\n};\n\nexport const segmentDescriptionCss: React.CSSProperties = {\n fontFamily: fontFamilyBase,\n fontWeight: \"normal\",\n fontSize: fontSizeBodyS,\n color: colorTextBodySecondary,\n};\n\nexport const tooltipSnap = 4;\n"]}
|
|
@@ -57,7 +57,7 @@ function getDefaultPointProps(point, selected, className) {
|
|
|
57
57
|
const pointStyle = {
|
|
58
58
|
zIndex: selected ? 6 : 5,
|
|
59
59
|
opacity: 1,
|
|
60
|
-
|
|
60
|
+
"pointer-events": "none",
|
|
61
61
|
class: className,
|
|
62
62
|
"stroke-width": 2,
|
|
63
63
|
stroke: selected ? colorTextBodyDefault : point.color,
|
|
@@ -69,7 +69,7 @@ function getDefaultPointProps(point, selected, className) {
|
|
|
69
69
|
stroke: point.color,
|
|
70
70
|
fill: "transparent",
|
|
71
71
|
opacity: 0.4,
|
|
72
|
-
|
|
72
|
+
"pointer-events": "none",
|
|
73
73
|
r: 8,
|
|
74
74
|
};
|
|
75
75
|
return { size, pointStyle, haloStyle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-marker.js","sourceRoot":"","sources":["../../../../../src/internal/components/series-marker/render-marker.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAazG,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAuB;;IAC3F,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC3D,OAAO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Q,CAAC;YAClB,KAAK,SAAS;gBACZ,OAAO,SAAS,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,eAAe,CAAC;YACzB,KAAK,QAAQ,CAAC;YACd;gBACE,OAAO,QAAQ,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { colorBackgroundContainerContent, colorTextBodyDefault } from \"@cloudscape-design/design-tokens\";\n\nimport { SVGRendererPool } from \"../../utils/renderer-utils\";\nimport { ChartSeriesMarkerType } from \"./interfaces\";\n\ninterface RenderMarkerOptions {\n chart: Highcharts.Chart;\n pool: SVGRendererPool;\n point: Highcharts.Point;\n selected: boolean;\n className?: string;\n}\n\nexport function renderMarker({ chart, pool, point, selected, className }: RenderMarkerOptions) {\n if (point.plotX === undefined || point.plotY === undefined) {\n return;\n }\n\n const rr = chart.renderer;\n const inverted = !!chart.inverted;\n const { size, pointStyle, haloStyle } = getPointProps(point, selected, className);\n const x = inverted ? chart.plotLeft + chart.plotWidth - point.plotY : chart.plotLeft + (point.plotX ?? 0);\n const y = inverted ? chart.plotTop + chart.plotHeight - point.plotX : chart.plotTop + (point.plotY ?? 0);\n\n if (selected) {\n pool.circle(rr, { ...haloStyle, x, y });\n }\n\n const type = getSeriesMarkerType(point.series);\n switch (type) {\n case \"square\":\n return pool.rect(rr, { ...pointStyle, x: x - size, y: y - size, width: size * 2, height: size * 2 });\n\n case \"diamond\": {\n const path = [\"M\", x, y - size, \"L\", x + size, y, \"L\", x, y + size, \"L\", x - size, y, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"triangle\": {\n const path = [\"M\", x, y - size, \"L\", x + size, y + size, \"L\", x - size, y + size, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"triangle-down\": {\n const path = [\"M\", x, y + size, \"L\", x - size, y - size, \"L\", x + size, y - size, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"circle\":\n default:\n return pool.circle(rr, { ...pointStyle, x, y, r: size });\n }\n}\n\nfunction getPointProps(point: Highcharts.Point, selected: boolean, className?: string) {\n switch (point.series.type) {\n case \"bubble\":\n return getBubblePointProps(point, selected, className);\n default:\n return getDefaultPointProps(point, selected, className);\n }\n}\n\nfunction getBubblePointProps(point: Highcharts.Point, selected: boolean, className?: string) {\n const { pointStyle, haloStyle } = getDefaultPointProps(point, selected, className);\n const size = Math.max(4, (point.graphic?.getBBox().width ?? 8) / 2 - 2);\n pointStyle.fill = point.color;\n pointStyle.stroke = selected ? colorTextBodyDefault : colorBackgroundContainerContent;\n haloStyle.r = size + 4;\n return { size, pointStyle, haloStyle };\n}\n\nfunction getDefaultPointProps(point: Highcharts.Point, selected: boolean, className?: string) {\n const size = selected ? 4 : 3;\n const pointStyle: Highcharts.SVGAttributes = {\n zIndex: selected ? 6 : 5,\n opacity: 1,\n \"pointer-events\": \"none\",\n class: className,\n \"stroke-width\": 2,\n stroke: selected ? colorTextBodyDefault : point.color,\n fill: selected ? point.color : colorBackgroundContainerContent,\n };\n const haloStyle: Highcharts.SVGAttributes = {\n zIndex: 6,\n \"stroke-width\": 4,\n stroke: point.color,\n fill: \"transparent\",\n opacity: 0.4,\n \"pointer-events\": \"none\",\n r: 8,\n };\n return { size, pointStyle, haloStyle };\n}\n\nfunction getSeriesMarkerType(series: Highcharts.Series): ChartSeriesMarkerType {\n const seriesSymbol = \"symbol\" in series && typeof series.symbol === \"string\" ? series.symbol : \"circle\";\n if (series.type === \"scatter\") {\n switch (seriesSymbol) {\n case \"square\":\n return \"square\";\n case \"diamond\":\n return \"diamond\";\n case \"triangle\":\n return \"triangle\";\n case \"triangle-down\":\n return \"triangle-down\";\n case \"circle\":\n default:\n return \"circle\";\n }\n }\n return \"circle\";\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 (b5527240)";
|
|
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