@neo4j-ndl/react-charts 1.3.3 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/lib/cjs/charts/Chart.js.map +1 -1
  2. package/lib/cjs/charts/ChartContainer.js.map +1 -1
  3. package/lib/cjs/charts/ChartEmpty.js +1 -1
  4. package/lib/cjs/charts/ChartEmpty.js.map +1 -1
  5. package/lib/cjs/charts/ChartRender.js +1 -1
  6. package/lib/cjs/charts/ChartRender.js.map +1 -1
  7. package/lib/cjs/charts/ChartTooltip.js +1 -1
  8. package/lib/cjs/charts/ChartTooltip.js.map +1 -1
  9. package/lib/cjs/charts/Legend.js +1 -1
  10. package/lib/cjs/charts/Legend.js.map +1 -1
  11. package/lib/cjs/charts/LegendItem.js +1 -1
  12. package/lib/cjs/charts/LegendItem.js.map +1 -1
  13. package/lib/cjs/charts/LegendLayout.js +1 -1
  14. package/lib/cjs/charts/LegendLayout.js.map +1 -1
  15. package/lib/cjs/charts/hooks/use-chart-instance.js +1 -1
  16. package/lib/cjs/charts/hooks/use-chart-instance.js.map +1 -1
  17. package/lib/cjs/charts/hooks/use-chart-option.js +1 -1
  18. package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
  19. package/lib/cjs/charts/hooks/use-chart-refs.js +1 -1
  20. package/lib/cjs/charts/hooks/use-chart-refs.js.map +1 -1
  21. package/lib/cjs/charts/hooks/use-chart-zoom.js +1 -1
  22. package/lib/cjs/charts/hooks/use-chart-zoom.js.map +1 -1
  23. package/lib/cjs/charts/hooks/use-legend-interactions.js +1 -1
  24. package/lib/cjs/charts/hooks/use-legend-interactions.js.map +1 -1
  25. package/lib/cjs/charts/hooks/use-legend-series.js +1 -1
  26. package/lib/cjs/charts/hooks/use-legend-series.js.map +1 -1
  27. package/lib/cjs/charts/hooks/use-legend-visibility.js +1 -1
  28. package/lib/cjs/charts/hooks/use-legend-visibility.js.map +1 -1
  29. package/lib/cjs/charts/index.js +1 -1
  30. package/lib/cjs/charts/index.js.map +1 -1
  31. package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js.map +1 -1
  32. package/lib/cjs/charts/tests/ChartZoomHarness.js +1 -1
  33. package/lib/cjs/charts/tests/ChartZoomHarness.js.map +1 -1
  34. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +1 -1
  35. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -1
  36. package/lib/cjs/charts/tests/PieChartWithRerender.js +1 -1
  37. package/lib/cjs/charts/tests/PieChartWithRerender.js.map +1 -1
  38. package/lib/cjs/charts/tests/chart-test-utils.js +1 -1
  39. package/lib/cjs/charts/tests/chart-test-utils.js.map +1 -1
  40. package/lib/cjs/charts/themes/ndl-echarts-theme.js +1 -1
  41. package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
  42. package/lib/cjs/charts/utils/aria-description.js +1 -1
  43. package/lib/cjs/charts/utils/aria-description.js.map +1 -1
  44. package/lib/cjs/charts/utils/build-chart-option.js +1 -1
  45. package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
  46. package/lib/cjs/charts/utils/chart-tooltip-formatter.js.map +1 -1
  47. package/lib/cjs/charts/utils/chart-types.js +1 -1
  48. package/lib/cjs/charts/utils/chart-types.js.map +1 -1
  49. package/lib/cjs/charts/utils/defaults.js +1 -1
  50. package/lib/cjs/charts/utils/defaults.js.map +1 -1
  51. package/lib/cjs/charts/utils/format-utils.js +1 -1
  52. package/lib/cjs/charts/utils/format-utils.js.map +1 -1
  53. package/lib/cjs/charts/utils/legend-layout.js +1 -1
  54. package/lib/cjs/charts/utils/legend-layout.js.map +1 -1
  55. package/lib/cjs/charts/utils/legend-utils.js +1 -1
  56. package/lib/cjs/charts/utils/legend-utils.js.map +1 -1
  57. package/lib/cjs/charts/utils/threshold.js +1 -1
  58. package/lib/cjs/charts/utils/threshold.js.map +1 -1
  59. package/lib/cjs/charts/utils/user-option-utils.js +1 -1
  60. package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
  61. package/lib/cjs/index.js +1 -1
  62. package/lib/cjs/index.js.map +1 -1
  63. package/lib/esm/charts/Chart.js.map +1 -1
  64. package/lib/esm/charts/ChartContainer.js.map +1 -1
  65. package/lib/esm/charts/ChartEmpty.js +1 -1
  66. package/lib/esm/charts/ChartEmpty.js.map +1 -1
  67. package/lib/esm/charts/ChartRender.js +1 -1
  68. package/lib/esm/charts/ChartRender.js.map +1 -1
  69. package/lib/esm/charts/ChartTooltip.js +1 -1
  70. package/lib/esm/charts/ChartTooltip.js.map +1 -1
  71. package/lib/esm/charts/Legend.js +1 -1
  72. package/lib/esm/charts/Legend.js.map +1 -1
  73. package/lib/esm/charts/LegendItem.js +1 -1
  74. package/lib/esm/charts/LegendItem.js.map +1 -1
  75. package/lib/esm/charts/LegendLayout.js +1 -1
  76. package/lib/esm/charts/LegendLayout.js.map +1 -1
  77. package/lib/esm/charts/hooks/use-chart-instance.js +1 -1
  78. package/lib/esm/charts/hooks/use-chart-instance.js.map +1 -1
  79. package/lib/esm/charts/hooks/use-chart-option.js +1 -1
  80. package/lib/esm/charts/hooks/use-chart-option.js.map +1 -1
  81. package/lib/esm/charts/hooks/use-chart-refs.js +1 -1
  82. package/lib/esm/charts/hooks/use-chart-refs.js.map +1 -1
  83. package/lib/esm/charts/hooks/use-chart-zoom.js +1 -1
  84. package/lib/esm/charts/hooks/use-chart-zoom.js.map +1 -1
  85. package/lib/esm/charts/hooks/use-legend-interactions.js +1 -1
  86. package/lib/esm/charts/hooks/use-legend-interactions.js.map +1 -1
  87. package/lib/esm/charts/hooks/use-legend-series.js +1 -1
  88. package/lib/esm/charts/hooks/use-legend-series.js.map +1 -1
  89. package/lib/esm/charts/hooks/use-legend-visibility.js +1 -1
  90. package/lib/esm/charts/hooks/use-legend-visibility.js.map +1 -1
  91. package/lib/esm/charts/index.js +1 -1
  92. package/lib/esm/charts/index.js.map +1 -1
  93. package/lib/esm/charts/tests/ChartWrapperWithTooltipFormatter.js.map +1 -1
  94. package/lib/esm/charts/tests/ChartZoomHarness.js +1 -1
  95. package/lib/esm/charts/tests/ChartZoomHarness.js.map +1 -1
  96. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +1 -1
  97. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -1
  98. package/lib/esm/charts/tests/PieChartWithRerender.js +1 -1
  99. package/lib/esm/charts/tests/PieChartWithRerender.js.map +1 -1
  100. package/lib/esm/charts/tests/chart-test-utils.js +1 -1
  101. package/lib/esm/charts/tests/chart-test-utils.js.map +1 -1
  102. package/lib/esm/charts/themes/ndl-echarts-theme.js +1 -1
  103. package/lib/esm/charts/themes/ndl-echarts-theme.js.map +1 -1
  104. package/lib/esm/charts/utils/aria-description.js +1 -1
  105. package/lib/esm/charts/utils/aria-description.js.map +1 -1
  106. package/lib/esm/charts/utils/build-chart-option.js +1 -1
  107. package/lib/esm/charts/utils/build-chart-option.js.map +1 -1
  108. package/lib/esm/charts/utils/chart-tooltip-formatter.js.map +1 -1
  109. package/lib/esm/charts/utils/chart-types.js +1 -1
  110. package/lib/esm/charts/utils/chart-types.js.map +1 -1
  111. package/lib/esm/charts/utils/defaults.js +1 -1
  112. package/lib/esm/charts/utils/defaults.js.map +1 -1
  113. package/lib/esm/charts/utils/format-utils.js +1 -1
  114. package/lib/esm/charts/utils/format-utils.js.map +1 -1
  115. package/lib/esm/charts/utils/legend-layout.js +1 -1
  116. package/lib/esm/charts/utils/legend-layout.js.map +1 -1
  117. package/lib/esm/charts/utils/legend-utils.js +1 -1
  118. package/lib/esm/charts/utils/legend-utils.js.map +1 -1
  119. package/lib/esm/charts/utils/threshold.js +1 -1
  120. package/lib/esm/charts/utils/threshold.js.map +1 -1
  121. package/lib/esm/charts/utils/user-option-utils.js +1 -1
  122. package/lib/esm/charts/utils/user-option-utils.js.map +1 -1
  123. package/lib/esm/index.js +1 -1
  124. package/lib/esm/index.js.map +1 -1
  125. package/lib/types/charts/Chart.d.ts +1 -1
  126. package/lib/types/charts/ChartContainer.d.ts +1 -1
  127. package/lib/types/charts/ChartRender.d.ts +1 -1
  128. package/lib/types/charts/ChartTooltip.d.ts +1 -1
  129. package/lib/types/charts/Legend.d.ts +1 -1
  130. package/lib/types/charts/LegendItem.d.ts +1 -1
  131. package/lib/types/charts/LegendLayout.d.ts +1 -1
  132. package/lib/types/charts/hooks/use-chart-instance.d.ts +1 -1
  133. package/lib/types/charts/hooks/use-chart-option.d.ts +1 -1
  134. package/lib/types/charts/hooks/use-chart-refs.d.ts +1 -1
  135. package/lib/types/charts/hooks/use-chart-zoom.d.ts +1 -1
  136. package/lib/types/charts/hooks/use-legend-interactions.d.ts +1 -1
  137. package/lib/types/charts/hooks/use-legend-series.d.ts +1 -1
  138. package/lib/types/charts/hooks/use-legend-visibility.d.ts +1 -1
  139. package/lib/types/charts/index.d.ts +1 -1
  140. package/lib/types/charts/tests/ChartWrapperWithTooltipFormatter.d.ts +1 -1
  141. package/lib/types/charts/tests/ChartZoomHarness.d.ts +1 -1
  142. package/lib/types/charts/tests/HorizontalBarWithVerticalSlider.d.ts +1 -1
  143. package/lib/types/charts/tests/PieChartWithRerender.d.ts +1 -1
  144. package/lib/types/charts/tests/chart-test-utils.d.ts +1 -1
  145. package/lib/types/charts/utils/aria-description.d.ts +1 -1
  146. package/lib/types/charts/utils/build-chart-option.d.ts +1 -1
  147. package/lib/types/charts/utils/chart-tooltip-formatter.d.ts +1 -1
  148. package/lib/types/charts/utils/chart-types.d.ts +1 -1
  149. package/lib/types/charts/utils/defaults.d.ts +1 -1
  150. package/lib/types/charts/utils/format-utils.d.ts +1 -1
  151. package/lib/types/charts/utils/legend-layout.d.ts +1 -1
  152. package/lib/types/charts/utils/legend-utils.d.ts +1 -1
  153. package/lib/types/charts/utils/threshold.d.ts +1 -1
  154. package/lib/types/charts/utils/user-option-utils.d.ts +1 -1
  155. package/lib/types/index.d.ts +1 -1
  156. package/package.json +6 -5
  157. package/skills/ndl-react-charts/SKILL.md +6 -1
  158. package/skills/ndl-react-charts/components/charts.md +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"use-legend-interactions.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-interactions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAgHH,gDA0DC;AAWD,0DAoDC;AAvOD,qCAA6D;AAC7D,iCASe;AAGf,wDAG+B;AAC/B,kDAAqD;AACrD,qDAAuD;AAEvD,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,4BAA4B,GAAG;IACnC,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;CACV,CAAC;AAkBX,MAAM,oBAAoB,GAAG,CAAC,MAA6B,EAAE,EAAE,CAC7D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,WAAC,OAAA,CAAC,MAAA,UAAU,CAAC,IAAI,mCAAI,EAAE,EAAE,IAAI,CAAC,CAAA,EAAA,CAAC,CAAC,CAAC;AAEhF,MAAM,4BAA4B,GAAG,CACnC,SAAkC,EAClC,MAA6B,EAC7B,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE7C,OAAO,CACL,aAAa,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QACtC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,WAC1B,OAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,MAAA,UAAU,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAA,EAAA,CACvE,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,QAAiC,EAAE,EAAE,CACzE,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAC7B,CAAC,C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O,CAAC,CAAC;QACvC,CAAC;QAED,YAAY,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACrC,IAAA,wCAAyB,EACvB,cAAc,EACd,MAAM,EACN,cAAc,EACd,CAAC,cAAc,CAAC,EAChB,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAC3C,CAAC;QACJ,CAAC,EAAE,+BAA+B,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CACzC,CAAC;IAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type EChartsType, getInstanceByDom } from 'echarts';\nimport {\n type Dispatch,\n type MutableRefObject,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport type { LegendProps } from '../utils/chart-types';\nimport {\n highlightOrDownplaySeries,\n resetAllSeriesHighlight,\n} from '../utils/legend-utils';\nimport { isThresholdLine } from '../utils/threshold';\nimport { useChartRefsContext } from './use-chart-refs';\n\nconst LEGEND_HOVER_HIGHLIGHT_DELAY_MS = 80;\nconst LEGEND_SELECTION_EVENT_TYPES = [\n 'legendselectchanged',\n 'legendselectall',\n 'legendselected',\n 'legendunselected',\n] as const;\n\ntype LegendSeries = LegendProps['series'];\ntype LegendSelectionEventType = (typeof LEGEND_SELECTION_EVENT_TYPES)[number];\n\ntype LegendSelectionEventParams = {\n selected?: Record<string, boolean> | null;\n};\n\ntype UseLegendHoverHighlightParams = {\n selectedSeries: Record<string, boolean>;\n series: LegendSeries;\n};\n\ntype UseLegendSelectionParams = {\n series: LegendProps['series'];\n};\n\nconst getAllSeriesSelected = (series: LegendProps['series']) =>\n Object.fromEntries(series.map((seriesItem) => [seriesItem.name ?? '', true]));\n\nconst hasSelectionForCurrentSeries = (\n selection: Record<string, boolean>,\n series: LegendProps['series'],\n) => {\n const selectedNames = Object.keys(selection);\n\n return (\n selectedNames.length === series.length &&\n series.every((seriesItem) =>\n Object.prototype.hasOwnProperty.call(selection, seriesItem.name ?? ''),\n )\n );\n};\n\nconst filterThresholdLineSelection = (selected: Record<string, boolean>) =>\n Object.fromEntries(\n Object.entries(selected).filter(\n ([key]) => !(isThresholdLine(key) ?? false),\n ),\n );\n\nconst clearTimeoutRef = (\n timeoutRef: MutableRefObject<ReturnType<typeof setTimeout> | null>,\n) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n};\n\nconst createLegendSelectionEventHandler =\n (\n chart: EChartsType,\n eventType: LegendSelectionEventType,\n setSelectedSeries: Dispatch<SetStateAction<Record<string, boolean>>>,\n ) =>\n (params: unknown) => {\n if (\n typeof params !== 'object' ||\n params === null ||\n !('selected' in params) ||\n params.selected === null\n ) {\n return;\n }\n\n if (eventType === 'legendselectchanged') {\n resetAllSeriesHighlight(chart);\n }\n\n setSelectedSeries(\n filterThresholdLineSelection(\n (params as LegendSelectionEventParams).selected ?? {},\n ),\n );\n };\n\n/**\n * Owns React legend selection and keeps it synchronized with ECharts.\n *\n * Current series changes preserve existing selection by name, new series default\n * to visible, removed series are dropped, and ECharts legend events update the\n * React state used to render legend items.\n */\nexport function useLegendSelection({ series }: UseLegendSelectionParams) {\n const { chartEchartRef, legendSelectedRef } = useChartRefsContext();\n const initialSelected = useMemo(() => getAllSeriesSelected(series), [series]);\n const [selectedSeries, setSelectedSeries] =\n useState<Record<string, boolean>>(initialSelected);\n\n const renderedSelectedSeries = hasSelectionForCurrentSeries(\n selectedSeries,\n series,\n )\n ? selectedSeries\n : initialSelected;\n\n useEffect(() => {\n const prev = legendSelectedRef.current ?? {};\n const next: Record<string, boolean> = {};\n\n for (const seriesItem of series) {\n const name = seriesItem.name ?? '';\n next[name] = prev[name] ?? true;\n }\n\n setSelectedSeries(next);\n }, [legendSelectedRef, series]);\n\n useEffect(() => {\n legendSelectedRef.current = selectedSeries;\n }, [legendSelectedRef, selectedSeries]);\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n if (!chart) {\n return;\n }\n\n const eventHandlers = LEGEND_SELECTION_EVENT_TYPES.map((eventType) => {\n const handler = createLegendSelectionEventHandler(\n chart,\n eventType,\n setSelectedSeries,\n );\n chart.on(eventType, handler);\n\n return { eventType, handler };\n });\n\n return () => {\n eventHandlers.forEach(({ eventType, handler }) => {\n chart.off(eventType, handler);\n });\n };\n }, [chartEchartRef]);\n\n return { renderedSelectedSeries };\n}\n\n/**\n * Creates a delayed ECharts highlighter for legend item hover state.\n *\n * Legend hover moves often happen as a quick leave/enter pair between adjacent\n * items. Keeping separate highlight and downplay timers lets the next hover\n * cancel the previous opposite action, preventing the chart from flickering\n * between emphasized and reset states. Deselected legend items are ignored so\n * hidden series do not get emphasized through hover.\n */\nexport function useLegendHoverHighlight({\n selectedSeries,\n series,\n}: UseLegendHoverHighlightParams) {\n const { chartEchartRef } = useChartRefsContext();\n const highlightTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const downplayTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n clearTimeoutRef(highlightTimeOut);\n clearTimeoutRef(downplayTimeOut);\n };\n }, []);\n\n const toggleHighlight = useCallback(\n (\n seriesToUpdate: { name: string; color: string },\n shouldHighlight: boolean,\n ) => {\n const isDeselected =\n seriesToUpdate.name === undefined\n ? false\n : !selectedSeries[seriesToUpdate.name];\n\n if (isDeselected) {\n return;\n }\n\n const timeoutToClear = shouldHighlight\n ? downplayTimeOut\n : highlightTimeOut;\n const timeoutToSet = shouldHighlight ? highlightTimeOut : downplayTimeOut;\n\n if (timeoutToClear.current) {\n clearTimeout(timeoutToClear.current);\n }\n\n timeoutToSet.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartEchartRef,\n series,\n selectedSeries,\n [seriesToUpdate],\n shouldHighlight ? 'highlight' : 'downplay',\n );\n }, LEGEND_HOVER_HIGHLIGHT_DELAY_MS);\n },\n [chartEchartRef, selectedSeries, series],\n );\n\n return { toggleHighlight };\n}\n"]}
1
+ {"version":3,"file":"use-legend-interactions.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-interactions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAgHH,gDA0DC;AAWD,0DAoDC;AAvOD,qCAA6D;AAC7D,iCASe;AAGf,wDAG+B;AAC/B,kDAAqD;AACrD,qDAAuD;AAEvD,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,4BAA4B,GAAG;IACnC,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;CACV,CAAC;AAkBX,MAAM,oBAAoB,GAAG,CAAC,MAA6B,EAAE,EAAE,CAC7D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,WAAC,OAAA,CAAC,MAAA,UAAU,CAAC,IAAI,mCAAI,EAAE,EAAE,IAAI,CAAC,CAAA,EAAA,CAAC,CAAC,CAAC;AAEhF,MAAM,4BAA4B,GAAG,CACnC,SAAkC,EAClC,MAA6B,EAC7B,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE7C,OAAO,CACL,aAAa,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QACtC,MAAM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CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,eAAe;YACpC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,gBAAgB,CAAC;QACrB,MAAM,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC;QAE1E,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3B,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,YAAY,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACrC,IAAA,wCAAyB,EACvB,cAAc,EACd,MAAM,EACN,cAAc,EACd,CAAC,cAAc,CAAC,EAChB,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAC3C,CAAC;QACJ,CAAC,EAAE,+BAA+B,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CACzC,CAAC;IAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type EChartsType, getInstanceByDom } from 'echarts';\nimport {\n type Dispatch,\n type MutableRefObject,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport type { LegendProps } from '../utils/chart-types';\nimport {\n highlightOrDownplaySeries,\n resetAllSeriesHighlight,\n} from '../utils/legend-utils';\nimport { isThresholdLine } from '../utils/threshold';\nimport { useChartRefsContext } from './use-chart-refs';\n\nconst LEGEND_HOVER_HIGHLIGHT_DELAY_MS = 80;\nconst LEGEND_SELECTION_EVENT_TYPES = [\n 'legendselectchanged',\n 'legendselectall',\n 'legendselected',\n 'legendunselected',\n] as const;\n\ntype LegendSeries = LegendProps['series'];\ntype LegendSelectionEventType = (typeof LEGEND_SELECTION_EVENT_TYPES)[number];\n\ntype LegendSelectionEventParams = {\n selected?: Record<string, boolean> | null;\n};\n\ntype UseLegendHoverHighlightParams = {\n selectedSeries: Record<string, boolean>;\n series: LegendSeries;\n};\n\ntype UseLegendSelectionParams = {\n series: LegendProps['series'];\n};\n\nconst getAllSeriesSelected = (series: LegendProps['series']) =>\n Object.fromEntries(series.map((seriesItem) => [seriesItem.name ?? '', true]));\n\nconst hasSelectionForCurrentSeries = (\n selection: Record<string, boolean>,\n series: LegendProps['series'],\n) => {\n const selectedNames = Object.keys(selection);\n\n return (\n selectedNames.length === series.length &&\n series.every((seriesItem) =>\n Object.prototype.hasOwnProperty.call(selection, seriesItem.name ?? ''),\n )\n );\n};\n\nconst filterThresholdLineSelection = (selected: Record<string, boolean>) =>\n Object.fromEntries(\n Object.entries(selected).filter(\n ([key]) => !(isThresholdLine(key) ?? false),\n ),\n );\n\nconst clearTimeoutRef = (\n timeoutRef: MutableRefObject<ReturnType<typeof setTimeout> | null>,\n) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n};\n\nconst createLegendSelectionEventHandler =\n (\n chart: EChartsType,\n eventType: LegendSelectionEventType,\n setSelectedSeries: Dispatch<SetStateAction<Record<string, boolean>>>,\n ) =>\n (params: unknown) => {\n if (\n typeof params !== 'object' ||\n params === null ||\n !('selected' in params) ||\n params.selected === null\n ) {\n return;\n }\n\n if (eventType === 'legendselectchanged') {\n resetAllSeriesHighlight(chart);\n }\n\n setSelectedSeries(\n filterThresholdLineSelection(\n (params as LegendSelectionEventParams).selected ?? {},\n ),\n );\n };\n\n/**\n * Owns React legend selection and keeps it synchronized with ECharts.\n *\n * Current series changes preserve existing selection by name, new series default\n * to visible, removed series are dropped, and ECharts legend events update the\n * React state used to render legend items.\n */\nexport function useLegendSelection({ series }: UseLegendSelectionParams) {\n const { chartEchartRef, legendSelectedRef } = useChartRefsContext();\n const initialSelected = useMemo(() => getAllSeriesSelected(series), [series]);\n const [selectedSeries, setSelectedSeries] =\n useState<Record<string, boolean>>(initialSelected);\n\n const renderedSelectedSeries = hasSelectionForCurrentSeries(\n selectedSeries,\n series,\n )\n ? selectedSeries\n : initialSelected;\n\n useEffect(() => {\n const prev = legendSelectedRef.current ?? {};\n const next: Record<string, boolean> = {};\n\n for (const seriesItem of series) {\n const name = seriesItem.name ?? '';\n next[name] = prev[name] ?? true;\n }\n\n setSelectedSeries(next);\n }, [legendSelectedRef, series]);\n\n useEffect(() => {\n legendSelectedRef.current = selectedSeries;\n }, [legendSelectedRef, selectedSeries]);\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n if (!chart) {\n return;\n }\n\n const eventHandlers = LEGEND_SELECTION_EVENT_TYPES.map((eventType) => {\n const handler = createLegendSelectionEventHandler(\n chart,\n eventType,\n setSelectedSeries,\n );\n chart.on(eventType, handler);\n\n return { eventType, handler };\n });\n\n return () => {\n eventHandlers.forEach(({ eventType, handler }) => {\n chart.off(eventType, handler);\n });\n };\n }, [chartEchartRef]);\n\n return { renderedSelectedSeries };\n}\n\n/**\n * Creates a delayed ECharts highlighter for legend item hover state.\n *\n * Legend hover moves often happen as a quick leave/enter pair between adjacent\n * items. Keeping separate highlight and downplay timers lets the next hover\n * cancel the previous opposite action, preventing the chart from flickering\n * between emphasized and reset states. Deselected legend items are ignored so\n * hidden series do not get emphasized through hover.\n */\nexport function useLegendHoverHighlight({\n selectedSeries,\n series,\n}: UseLegendHoverHighlightParams) {\n const { chartEchartRef } = useChartRefsContext();\n const highlightTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const downplayTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n clearTimeoutRef(highlightTimeOut);\n clearTimeoutRef(downplayTimeOut);\n };\n }, []);\n\n const toggleHighlight = useCallback(\n (\n seriesToUpdate: { name: string; color: string },\n shouldHighlight: boolean,\n ) => {\n const isDeselected =\n seriesToUpdate.name === undefined\n ? false\n : !selectedSeries[seriesToUpdate.name];\n\n if (isDeselected) {\n return;\n }\n\n const timeoutToClear = shouldHighlight\n ? downplayTimeOut\n : highlightTimeOut;\n const timeoutToSet = shouldHighlight ? highlightTimeOut : downplayTimeOut;\n\n if (timeoutToClear.current) {\n clearTimeout(timeoutToClear.current);\n }\n\n timeoutToSet.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartEchartRef,\n series,\n selectedSeries,\n [seriesToUpdate],\n shouldHighlight ? 'highlight' : 'downplay',\n );\n }, LEGEND_HOVER_HIGHLIGHT_DELAY_MS);\n },\n [chartEchartRef, selectedSeries, series],\n );\n\n return { toggleHighlight };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /**
2
+ /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
5
5
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"use-legend-series.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-series.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AA2MH,0CAgEC;AApQD,qCAA2C;AAC3C,iCAAgC;AAOhC,kDAAqD;AACrD,qDAAuE;AAgCvE,MAAM,qBAAqB,GAAG,CAAC,MAAwB,EAAE,EAAE,CACzD,MAAM,CAAC,IAAI,KAAK,MAAM;IACtB,OAAO,MAAM,CAAC,IAAI,KAA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BAAM,IAAI,aAAa,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;oBACxC,YAAY,CAAC,IAAI,CACf,GAAG,kBAAkB,CAAC;wBACpB,KAAK;wBACL,OAAO,EAAE,mBAAmB,CAC1B,aAAa,EACb,aAAkC,CACnC;wBACD,eAAe,EAAE,MAAA,aAAa,CAAC,MAAM,0CAAE,QAAQ;wBAC/C,YAAY,EAAE,wBAAwB;wBACtC,mBAAmB;wBACnB,WAAW,EAAE,KAAK;qBACnB,CAAC,CACH,CAAC;oBACF,OAAO;gBACT,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;oBAEhC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACvB,OAAO;oBACT,CAAC;oBAED,MAAM,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;oBAChE,YAAY,CAAC,IAAI,CAAC;wBAChB,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;wBACpD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;qBACnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE;QACD,cAAc;QACd,WAAW;QACX,uBAAuB;QACvB,mBAAmB;QACnB,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type {\n DatasetComponentOption,\n EChartsOption,\n EChartsType,\n} from 'echarts';\nimport { getInstanceByDom } from 'echarts';\nimport { useMemo } from 'react';\n\nimport type {\n LegendProps,\n NeedleSeries,\n SeriesOption,\n} from '../utils/chart-types';\nimport { isThresholdLine } from '../utils/threshold';\nimport { type ChartRefs, useChartRefsContext } from './use-chart-refs';\n\ntype UseLegendSeriesParams = {\n chartOption: EChartsOption | undefined;\n isWaitingForFirstResize: boolean;\n};\n\ntype LegendSeries = LegendProps['series'];\ntype NeedleSeriesItem = NeedleSeries[number];\ntype SeriesWithDataset = SeriesOption & {\n datasetId?: string;\n datasetIndex?: number;\n};\n\ntype PieLegendSeriesParams = {\n chart: EChartsType | undefined;\n dataset: DatasetComponentOption | undefined;\n encodedItemName: unknown;\n isAllVisible: boolean;\n legendColorCacheRef: ChartRefs['legendColorCacheRef'];\n seriesIndex: number;\n};\n\ntype GetCachedLegendColorParams = {\n chart: EChartsType | undefined;\n dataIndexInside: number;\n isAllVisible: boolean;\n legendColorCacheRef: ChartRefs['legendColorCacheRef'];\n name: string;\n seriesIndex: number;\n};\n\nconst isThresholdLineSeries = (series: NeedleSeriesItem) =>\n series.type === 'line' &&\n typeof series.name === 'string' &&\n isThresholdLine(series.name);\n\nconst getDatasetForSeries = (\n optionDataset: EChartsOption['dataset'],\n series: SeriesWithDataset,\n) => {\n const datasetList = Array.isArray(optionDataset)\n ? optionDataset\n : [optionDataset];\n\n if (series.datasetId && Array.isArray(optionDataset)) {\n return datasetList.find((dataset) => dataset?.id === series.datasetId);\n }\n\n if (series.datasetIndex !== undefined) {\n return datasetList[series.datasetIndex];\n }\n\n return datasetList[0];\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst getCachedLegendColor = ({\n chart,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n dataIndexInside,\n}: GetCachedLegendColorParams) => {\n const freshColor = chart?.getVisual(\n { dataIndexInside, seriesIndex },\n 'color',\n );\n\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n return (\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000')\n );\n};\n\nconst createPieLegendSeriesItem = ({\n chart,\n dataIndexInside,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n}: GetCachedLegendColorParams) => ({\n color: getCachedLegendColor({\n chart,\n dataIndexInside,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n }),\n name,\n});\n\nconst getPieLegendSeriesFromArrayRows = ({\n chart,\n dataset,\n encodedItemName,\n isAllVisible,\n legendColorCacheRef,\n seriesIndex,\n}: PieLegendSeriesParams): LegendSeries => {\n const source = dataset?.source;\n if (!Array.isArray(source) || !Array.isArray(source[0])) {\n return [];\n }\n\n const itemNameIndex = source[0].findIndex((item) => item === encodedItemName);\n if (itemNameIndex === -1) {\n return [];\n }\n\n return source.slice(1).flatMap((row, rowIndex) => {\n if (!Array.isArray(row)) {\n return [];\n }\n\n return createPieLegendSeriesItem({\n chart,\n dataIndexInside: rowIndex,\n isAllVisible,\n legendColorCacheRef,\n name: String(row[itemNameIndex]),\n seriesIndex,\n });\n });\n};\n\nconst getPieLegendSeriesFromObjectRows = ({\n chart,\n dataset,\n encodedItemName,\n isAllVisible,\n legendColorCacheRef,\n seriesIndex,\n}: PieLegendSeriesParams): LegendSeries => {\n const source = dataset?.source;\n if (!Array.isArray(source) || typeof encodedItemName !== 'string') {\n return [];\n }\n\n return source.flatMap((row, rowIndex) => {\n if (!isRecord(row) || !(encodedItemName in row)) {\n return [];\n }\n\n return createPieLegendSeriesItem({\n chart,\n dataIndexInside: rowIndex,\n isAllVisible,\n legendColorCacheRef,\n name: String(row[encodedItemName]),\n seriesIndex,\n });\n });\n};\n\nconst getPieLegendSeries = (params: PieLegendSeriesParams): LegendSeries => {\n const source = params.dataset?.source;\n if (!Array.isArray(source) || source.length === 0) {\n return [];\n }\n\n return Array.isArray(source[0])\n ? getPieLegendSeriesFromArrayRows(params)\n : getPieLegendSeriesFromObjectRows(params);\n};\n\n/**\n * Derives Needle legend rows from ECharts' normalized option and visual state.\n *\n * Standard series map one-to-one with legend items. Pie charts instead create a\n * legend item for each data row, so the hook reads the encoded item-name column\n * from the dataset and asks ECharts for each slice color. Fresh colors are\n * cached while all slices are visible because ECharts reports dimmed colors for\n * deselected slices.\n *\n * The hook waits until the first chart resize has completed so color lookups run\n * against an initialized ECharts instance.\n */\nexport function useLegendSeries({\n chartOption,\n isWaitingForFirstResize,\n}: UseLegendSeriesParams): LegendSeries | undefined {\n const { chartEchartRef, legendColorCacheRef, legendSelectedRef } =\n useChartRefsContext();\n\n return useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n const optionSeries = (chartOption?.series as NeedleSeries) ?? [];\n const optionDataset = chartOption?.dataset;\n const isAllLegendSeriesVisible = Object.values(\n legendSelectedRef.current,\n ).every((isVisible) => isVisible);\n\n const legendSeries: LegendSeries = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (isThresholdLineSeries(currentSeries)) {\n return;\n } else if (currentSeries.type === 'pie') {\n legendSeries.push(\n ...getPieLegendSeries({\n chart,\n dataset: getDatasetForSeries(\n optionDataset,\n currentSeries as SeriesWithDataset,\n ),\n encodedItemName: currentSeries.encode?.itemName,\n isAllVisible: isAllLegendSeriesVisible,\n legendColorCacheRef,\n seriesIndex: index,\n }),\n );\n return;\n } else {\n const name = currentSeries.name;\n\n if (name === undefined) {\n return;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries;\n }, [\n chartEchartRef,\n chartOption,\n isWaitingForFirstResize,\n legendColorCacheRef,\n legendSelectedRef,\n ]);\n}\n"]}
1
+ {"version":3,"file":"use-legend-series.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-series.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AA2MH,0CAgEC;AApQD,qCAA2C;AAC3C,iCAAgC;AAOhC,kDAAqD;AACrD,qDAAuE;AAgCvE,MAAM,qBAAqB,GAAG,CAAC,MAAwB,EAAE,EAAE,CACzD,MAAM,CAAC,IAAI,KAAK,MAAM;IACtB,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;IAC/B,IAAA,2BAAe,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE/B,MAAM,mBAAmB,GAAG,CAC1B,aAAuC,EACvC,MAAyB,EACzB,EAAE;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9C,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAEpB,IAAI,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACrD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,MAAK,MAAM,CAAC,SAAS,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,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,CAAC;qBACnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE;QACD,cAAc;QACd,WAAW;QACX,uBAAuB;QACvB,mBAAmB;QACnB,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type {\n DatasetComponentOption,\n EChartsOption,\n EChartsType,\n} from 'echarts';\nimport { getInstanceByDom } from 'echarts';\nimport { useMemo } from 'react';\n\nimport type {\n LegendProps,\n NeedleSeries,\n SeriesOption,\n} from '../utils/chart-types';\nimport { isThresholdLine } from '../utils/threshold';\nimport { type ChartRefs, useChartRefsContext } from './use-chart-refs';\n\ntype UseLegendSeriesParams = {\n chartOption: EChartsOption | undefined;\n isWaitingForFirstResize: boolean;\n};\n\ntype LegendSeries = LegendProps['series'];\ntype NeedleSeriesItem = NeedleSeries[number];\ntype SeriesWithDataset = SeriesOption & {\n datasetId?: string;\n datasetIndex?: number;\n};\n\ntype PieLegendSeriesParams = {\n chart: EChartsType | undefined;\n dataset: DatasetComponentOption | undefined;\n encodedItemName: unknown;\n isAllVisible: boolean;\n legendColorCacheRef: ChartRefs['legendColorCacheRef'];\n seriesIndex: number;\n};\n\ntype GetCachedLegendColorParams = {\n chart: EChartsType | undefined;\n dataIndexInside: number;\n isAllVisible: boolean;\n legendColorCacheRef: ChartRefs['legendColorCacheRef'];\n name: string;\n seriesIndex: number;\n};\n\nconst isThresholdLineSeries = (series: NeedleSeriesItem) =>\n series.type === 'line' &&\n typeof series.name === 'string' &&\n isThresholdLine(series.name);\n\nconst getDatasetForSeries = (\n optionDataset: EChartsOption['dataset'],\n series: SeriesWithDataset,\n) => {\n const datasetList = Array.isArray(optionDataset)\n ? optionDataset\n : [optionDataset];\n\n if (series.datasetId && Array.isArray(optionDataset)) {\n return datasetList.find((dataset) => dataset?.id === series.datasetId);\n }\n\n if (series.datasetIndex !== undefined) {\n return datasetList[series.datasetIndex];\n }\n\n return datasetList[0];\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst getCachedLegendColor = ({\n chart,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n dataIndexInside,\n}: GetCachedLegendColorParams) => {\n const freshColor = chart?.getVisual(\n { dataIndexInside, seriesIndex },\n 'color',\n );\n\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n return (\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000')\n );\n};\n\nconst createPieLegendSeriesItem = ({\n chart,\n dataIndexInside,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n}: GetCachedLegendColorParams) => ({\n color: getCachedLegendColor({\n chart,\n dataIndexInside,\n isAllVisible,\n legendColorCacheRef,\n name,\n seriesIndex,\n }),\n name,\n});\n\nconst getPieLegendSeriesFromArrayRows = ({\n chart,\n dataset,\n encodedItemName,\n isAllVisible,\n legendColorCacheRef,\n seriesIndex,\n}: PieLegendSeriesParams): LegendSeries => {\n const source = dataset?.source;\n if (!Array.isArray(source) || !Array.isArray(source[0])) {\n return [];\n }\n\n const itemNameIndex = source[0].findIndex((item) => item === encodedItemName);\n if (itemNameIndex === -1) {\n return [];\n }\n\n return source.slice(1).flatMap((row, rowIndex) => {\n if (!Array.isArray(row)) {\n return [];\n }\n\n return createPieLegendSeriesItem({\n chart,\n dataIndexInside: rowIndex,\n isAllVisible,\n legendColorCacheRef,\n name: String(row[itemNameIndex]),\n seriesIndex,\n });\n });\n};\n\nconst getPieLegendSeriesFromObjectRows = ({\n chart,\n dataset,\n encodedItemName,\n isAllVisible,\n legendColorCacheRef,\n seriesIndex,\n}: PieLegendSeriesParams): LegendSeries => {\n const source = dataset?.source;\n if (!Array.isArray(source) || typeof encodedItemName !== 'string') {\n return [];\n }\n\n return source.flatMap((row, rowIndex) => {\n if (!isRecord(row) || !(encodedItemName in row)) {\n return [];\n }\n\n return createPieLegendSeriesItem({\n chart,\n dataIndexInside: rowIndex,\n isAllVisible,\n legendColorCacheRef,\n name: String(row[encodedItemName]),\n seriesIndex,\n });\n });\n};\n\nconst getPieLegendSeries = (params: PieLegendSeriesParams): LegendSeries => {\n const source = params.dataset?.source;\n if (!Array.isArray(source) || source.length === 0) {\n return [];\n }\n\n return Array.isArray(source[0])\n ? getPieLegendSeriesFromArrayRows(params)\n : getPieLegendSeriesFromObjectRows(params);\n};\n\n/**\n * Derives Needle legend rows from ECharts' normalized option and visual state.\n *\n * Standard series map one-to-one with legend items. Pie charts instead create a\n * legend item for each data row, so the hook reads the encoded item-name column\n * from the dataset and asks ECharts for each slice color. Fresh colors are\n * cached while all slices are visible because ECharts reports dimmed colors for\n * deselected slices.\n *\n * The hook waits until the first chart resize has completed so color lookups run\n * against an initialized ECharts instance.\n */\nexport function useLegendSeries({\n chartOption,\n isWaitingForFirstResize,\n}: UseLegendSeriesParams): LegendSeries | undefined {\n const { chartEchartRef, legendColorCacheRef, legendSelectedRef } =\n useChartRefsContext();\n\n return useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n const optionSeries = (chartOption?.series as NeedleSeries) ?? [];\n const optionDataset = chartOption?.dataset;\n const isAllLegendSeriesVisible = Object.values(\n legendSelectedRef.current,\n ).every((isVisible) => isVisible);\n\n const legendSeries: LegendSeries = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (isThresholdLineSeries(currentSeries)) {\n return;\n } else if (currentSeries.type === 'pie') {\n legendSeries.push(\n ...getPieLegendSeries({\n chart,\n dataset: getDatasetForSeries(\n optionDataset,\n currentSeries as SeriesWithDataset,\n ),\n encodedItemName: currentSeries.encode?.itemName,\n isAllVisible: isAllLegendSeriesVisible,\n legendColorCacheRef,\n seriesIndex: index,\n }),\n );\n return;\n } else {\n const name = currentSeries.name;\n\n if (name === undefined) {\n return;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries;\n }, [\n chartEchartRef,\n chartOption,\n isWaitingForFirstResize,\n legendColorCacheRef,\n legendSelectedRef,\n ]);\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /**
2
+ /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
5
5
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"use-legend-visibility.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-visibility.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qCAA2C;AAC3C,iCAAoC;AAEpC,kDAAqD;AACrD,qDAAuD;AAEhD,MAAM,mBAAmB,GAAG,CACjC,cAAuC,EACvC,EAAE;IACF,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,oCAAmB,GAAE,CAAC;IAEjD,MAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,CAAC,IAAwB,EAAE,EAAE;QAC3B,IAAI,cAAc,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,cA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AClB,aAAa,EAAE,CAAC;QAClB,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAEvD,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,CAAC;gBACpB,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,cAAc,EAAE,aAAa,CAAC,CAChD,CAAC;IAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AACpC,CAAC,CAAC;AApFW,QAAA,mBAAmB,uBAoF9B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { getInstanceByDom } from 'echarts';\nimport { useCallback } from 'react';\n\nimport { isThresholdLine } from '../utils/threshold';\nimport { useChartRefsContext } from './use-chart-refs';\n\nexport const useLegendVisibility = (\n selectedSeries: Record<string, boolean>,\n) => {\n const { chartEchartRef } = useChartRefsContext();\n\n const setOnlyVisible = useCallback(\n (name: string | undefined) => {\n if (chartEchartRef.current === null) {\n return;\n }\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n name: name,\n type: 'legendSelect',\n });\n\n const otherNames = Object.keys(selectedSeries).filter(\n (seriesName) => seriesName !== name,\n );\n otherNames.forEach((name) => {\n if (isThresholdLine(name)) {\n return;\n }\n\n chart?.dispatchAction({\n name: name,\n type: 'legendUnSelect',\n });\n });\n },\n [chartEchartRef, selectedSeries],\n );\n\n const setAllVisible = useCallback(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n type: 'legendAllSelect',\n });\n }, [chartEchartRef]);\n\n /**\n * Toggle the visibility of a legend series\n *\n * The toggle logic depends on the current state of the series:\n * - If only the legend series that was selected is visible: show all series\n * - If all series are visible: hide all except the series that was selected\n * - Otherwise: toggle the legend series\n *\n * The isOnlyVisible and isAllSeriesSelected states can't be calculated in this\n * function since different legend types require different logic.\n */\n const toggleLegendVisibility = useCallback(\n (\n name: string | undefined,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n ) => {\n if (chartEchartRef.current === null || name === undefined) {\n return;\n }\n\n if (isOnlyVisible) {\n setAllVisible();\n } else if (isAllSeriesSelected) {\n setOnlyVisible(name);\n } else {\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n name: name,\n type: 'legendToggleSelect',\n });\n }\n },\n [chartEchartRef, setOnlyVisible, setAllVisible],\n );\n\n return { toggleLegendVisibility };\n};\n"]}
1
+ {"version":3,"file":"use-legend-visibility.js","sourceRoot":"","sources":["../../../../src/charts/hooks/use-legend-visibility.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qCAA2C;AAC3C,iCAAoC;AAEpC,kDAAqD;AACrD,qDAAuD;AAEhD,MAAM,mBAAmB,GAAG,CACjC,cAAuC,EACvC,EAAE;IACF,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,oCAAmB,GAAE,CAAC;IAEjD,MAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,CAAC,IAAwB,EAAE,EAAE;QAC3B,IAAI,cAAc,CAAC,OAAO,KAAK,IAAI,E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,KAAK,SAAS,EAAE,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAEvD,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,CAAC;gBACpB,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,cAAc,EAAE,aAAa,CAAC,CAChD,CAAC;IAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AACpC,CAAC,CAAC;AApFW,QAAA,mBAAmB,uBAoF9B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { getInstanceByDom } from 'echarts';\nimport { useCallback } from 'react';\n\nimport { isThresholdLine } from '../utils/threshold';\nimport { useChartRefsContext } from './use-chart-refs';\n\nexport const useLegendVisibility = (\n selectedSeries: Record<string, boolean>,\n) => {\n const { chartEchartRef } = useChartRefsContext();\n\n const setOnlyVisible = useCallback(\n (name: string | undefined) => {\n if (chartEchartRef.current === null) {\n return;\n }\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n name: name,\n type: 'legendSelect',\n });\n\n const otherNames = Object.keys(selectedSeries).filter(\n (seriesName) => seriesName !== name,\n );\n otherNames.forEach((name) => {\n if (isThresholdLine(name)) {\n return;\n }\n\n chart?.dispatchAction({\n name: name,\n type: 'legendUnSelect',\n });\n });\n },\n [chartEchartRef, selectedSeries],\n );\n\n const setAllVisible = useCallback(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n type: 'legendAllSelect',\n });\n }, [chartEchartRef]);\n\n /**\n * Toggle the visibility of a legend series\n *\n * The toggle logic depends on the current state of the series:\n * - If only the legend series that was selected is visible: show all series\n * - If all series are visible: hide all except the series that was selected\n * - Otherwise: toggle the legend series\n *\n * The isOnlyVisible and isAllSeriesSelected states can't be calculated in this\n * function since different legend types require different logic.\n */\n const toggleLegendVisibility = useCallback(\n (\n name: string | undefined,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n ) => {\n if (chartEchartRef.current === null || name === undefined) {\n return;\n }\n\n if (isOnlyVisible) {\n setAllVisible();\n } else if (isAllSeriesSelected) {\n setOnlyVisible(name);\n } else {\n const chart = getInstanceByDom(chartEchartRef.current);\n\n chart?.dispatchAction({\n name: name,\n type: 'legendToggleSelect',\n });\n }\n },\n [chartEchartRef, setOnlyVisible, setAllVisible],\n );\n\n return { toggleLegendVisibility };\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /**
2
+ /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
5
5
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/charts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,+CAA6B;AAC7B,2IAA2I;AAC3I,6CAAoE;AAA3D,4HAAA,gCAAgC,OAAA","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport * from './Chart';\nexport * from './ChartEmpty';\n// Export utils and types that were previously exported from Chart.tsx. Not sure that they are needed, but keeping them to not be breaking.\nexport { defaultThresholdLineSeriesOption } from './utils/defaults';\nexport {\n type ChartEmptyProps,\n type ThresholdLineSeriesOption,\n type Values,\n type SeriesOption,\n type EchartsSeries,\n type NeedleSeries,\n} from './utils/chart-types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/charts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,+CAA6B;AAC7B,2IAA2I;AAC3I,6CAAoE;AAA3D,4HAAA,gCAAgC,OAAA","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport * from './Chart';\nexport * from './ChartEmpty';\n// Export utils and types that were previously exported from Chart.tsx. Not sure that they are needed, but keeping them to not be breaking.\nexport { defaultThresholdLineSeriesOption } from './utils/defaults';\nexport {\n type ChartEmptyProps,\n type ThresholdLineSeriesOption,\n type Values,\n type SeriesOption,\n type EchartsSeries,\n type NeedleSeries,\n} from './utils/chart-types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWrapperWithTooltipFormatter.js","sourceRoot":"","sources":["../../../../src/charts/tests/ChartWrapperWithTooltipFormatter.tsx"],"names":[],"mappings":";;AA4BA,4EAaC;;AAnBD,oCAAiC;AACjC;;;GAGG;AAEH,SAAgB,gCAAgC,CAC9C,KAAmC;IAEnC,OAAO,CACL,uBAAC,aAAK,oBACA,KAAK,IACT,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,cAAc,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,aAAa,KAAK,EAAE;aACzD;SACF,IACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type ComponentProps } from 'react';\n\nimport { Chart } from '../Chart';\n/** Chart Wrapper is required to get a valid tooltip formatter for the chart\n * This is to do with the way Playwright mounts components for testing.\n * https://playwright.dev/docs/test-components#test-stories\n */\n\nexport function ChartWrapperWithTooltipFormatter(\n props: ComponentProps<typeof Chart>,\n): React.JSX.Element {\n return (\n <Chart\n {...props}\n option={{\n tooltip: {\n valueFormatter: (value: unknown) => `formatted ${value}`,\n },\n }}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"ChartWrapperWithTooltipFormatter.js","sourceRoot":"","sources":["../../../../src/charts/tests/ChartWrapperWithTooltipFormatter.tsx"],"names":[],"mappings":";;AA4BA,4EAaC;;AAnBD,oCAAiC;AACjC;;;GAGG;AAEH,SAAgB,gCAAgC,CAC9C,KAAmC;IAEnC,OAAO,CACL,uBAAC,aAAK,oBACA,KAAK,IACT,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,cAAc,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,aAAa,KAAK,EAAE;aACzD;SACF,IACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type ComponentProps } from 'react';\n\nimport { Chart } from '../Chart';\n/** Chart Wrapper is required to get a valid tooltip formatter for the chart\n * This is to do with the way Playwright mounts components for testing.\n * https://playwright.dev/docs/test-components#test-stories\n */\n\nexport function ChartWrapperWithTooltipFormatter(\n props: ComponentProps<typeof Chart>,\n): React.JSX.Element {\n return (\n <Chart\n {...props}\n option={{\n tooltip: {\n valueFormatter: (value: unknown) => `formatted ${value}`,\n },\n }}\n />\n );\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChartZoomHarness = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- /**
5
+ /*!
6
6
  *
7
7
  * Copyright (c) "Neo4j"
8
8
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"ChartZoomHarness.js","sourceRoot":"","sources":["../../../../src/charts/tests/ChartZoomHarness.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAChD,qCAA2C;AAC3C,iCAMe;AAkBf,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,kBAAkB,GAAG;IACzB,CAAC,MAAM,EAAE,OAAO,CAAC;IACjB,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;QACzD,KAAK;QACL,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,GAGT,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,IAAA,cAAM,EAAa,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,CAAC,IAAc,EAAE,EAAE;QAChD,YAAY,CAAC,OAAO,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,GAAG,EAAE;;YACpB,MAAM,aAAa,GACjB,MAAA,YAAY,CAAC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E,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,0BAG9C,EACT,gCAAK,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAClE,uBAAC,oBAAK,IACJ,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EACjC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,EACzC,MAAM,EAAE;wBACN;4BACE,qGAAqG;4BACrG,qCAAqC;4BACrC,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE;4BACjC,IAAI,EAAE,OAAO;4BACb,IAAI,EAAE,MAAM;yBACb;qBACF,EACD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,MAAM,EAAE;wBACN,QAAQ,EAAE;4BACR;gCACE,UAAU,EAAE,MAAM;gCAClB,IAAI,EAAE,QAAQ;gCACd,gBAAgB,EAAE,KAAK;6BACxB;yBACF;wBACD,OAAO,EAAE;4BACP,OAAO,EAAE;gCACP,QAAQ,EAAE;oCACR,UAAU,EAAE,KAAK;iCAClB;6BACF;yBACF;qBACF,GACD,GACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AA9FW,QAAA,gBAAgB,oBA8F3B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { getInstanceByDom } from 'echarts';\nimport {\n type ComponentProps,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\ntype ChartSettings = ComponentProps<typeof Chart>['settings'];\n\nexport type ZoomCall = { endValue: number; startValue: number };\n\nexport type ZoomHarnessApi = {\n /** Applied zoom windows, in data values, as ECharts currently has them. */\n getAppliedZoomWindows: () => ZoomCall[];\n /** Every `callbacks.onZoom` invocation the consumer received. */\n getZoomCalls: () => ZoomCall[];\n /** Data value at a pixel offset inside the chart element. */\n pixelToValue: (pixelX: number) => number;\n resetZoomCalls: () => void;\n};\n\ntype HarnessWindow = Window & { chartZoomHarness?: ZoomHarnessApi };\n\nconst POINT_COUNT = 180;\n\nconst zoomHarnessDataset = [\n ['time', 'value'],\n ...Array.from({ length: POINT_COUNT }, (_unused, index) => [\n index,\n Number((40 + Math.sin(index / 6) * 12).toFixed(2)),\n ]),\n];\n\n/**\n * Reproduces the consumer setup from the metrics UI: a chart with toolbox\n * brush-zoom whose parent re-renders while the chart stays mounted, passing a\n * freshly built `option` object on every render.\n */\nexport const ChartZoomHarness = ({\n settings,\n}: {\n settings?: ChartSettings;\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const zoomCallsRef = useRef<ZoomCall[]>([]);\n const [, setRerenderCount] = useState(0);\n\n const handleZoom = useCallback((zoom: ZoomCall) => {\n zoomCallsRef.current = [...zoomCallsRef.current, zoom];\n }, []);\n\n useEffect(() => {\n const getChart = () => {\n const echartElement =\n containerRef.current?.querySelector('.ndl-chart-echart');\n return echartElement instanceof HTMLElement\n ? getInstanceByDom(echartElement)\n : undefined;\n };\n\n (window as HarnessWindow).chartZoomHarness = {\n getAppliedZoomWindows: () => {\n const dataZoom = (\n getChart()?.getOption() as\n | { dataZoom?: { endValue?: number; startValue?: number }[] }\n | undefined\n )?.dataZoom;\n\n return (dataZoom ?? [])\n .filter(\n (item) =>\n item.startValue !== undefined && item.endValue !== undefined,\n )\n .map((item) => ({\n endValue: item.endValue as number,\n startValue: item.startValue as number,\n }));\n },\n getZoomCalls: () => zoomCallsRef.current,\n pixelToValue: (pixelX: number) =>\n getChart()?.convertFromPixel({ xAxisIndex: 0 }, pixelX) as number,\n resetZoomCalls: () => {\n zoomCallsRef.current = [];\n },\n };\n }, []);\n\n return (\n <div ref={containerRef} style={{ height: '420px', width: '900px' }}>\n <button\n type=\"button\"\n data-testid=\"force-rerender\"\n onClick={() => setRerenderCount((count) => count + 1)}\n >\n Re-render\n </button>\n <div className=\"ndl-chart\" style={{ height: '380px', width: '100%' }}>\n <Chart\n callbacks={{ onZoom: handleZoom }}\n dataset={[{ source: zoomHarnessDataset }]}\n series={[\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'time', y: 'value' },\n name: 'Value',\n type: 'line',\n },\n ]}\n settings={settings}\n xAxis={{ type: 'value' }}\n yAxis={{ type: 'value' }}\n option={{\n dataZoom: [\n {\n filterMode: 'none',\n type: 'inside',\n zoomOnMouseWheel: false,\n },\n ],\n toolbox: {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n },\n },\n },\n }}\n />\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"ChartZoomHarness.js","sourceRoot":"","sources":["../../../../src/charts/tests/ChartZoomHarness.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAChD,qCAA2C;AAC3C,iCAMe;AAkBf,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,kBAAkB,GAAG;IACzB,CAAC,MAAM,EAAE,OAAO,CAAC;IACjB,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,OAAO,EAAE,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BACjC,IAAI,EAAE,OAAO;4BACb,IAAI,EAAE,MAAM;yBACb;qBACF,EACD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,MAAM,EAAE;wBACN,QAAQ,EAAE;4BACR;gCACE,UAAU,EAAE,MAAM;gCAClB,IAAI,EAAE,QAAQ;gCACd,gBAAgB,EAAE,KAAK;6BACxB;yBACF;wBACD,OAAO,EAAE;4BACP,OAAO,EAAE;gCACP,QAAQ,EAAE;oCACR,UAAU,EAAE,KAAK;iCAClB;6BACF;yBACF;qBACF,GACD,GACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AA9FW,QAAA,gBAAgB,oBA8F3B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { getInstanceByDom } from 'echarts';\nimport {\n type ComponentProps,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\ntype ChartSettings = ComponentProps<typeof Chart>['settings'];\n\nexport type ZoomCall = { endValue: number; startValue: number };\n\nexport type ZoomHarnessApi = {\n /** Applied zoom windows, in data values, as ECharts currently has them. */\n getAppliedZoomWindows: () => ZoomCall[];\n /** Every `callbacks.onZoom` invocation the consumer received. */\n getZoomCalls: () => ZoomCall[];\n /** Data value at a pixel offset inside the chart element. */\n pixelToValue: (pixelX: number) => number;\n resetZoomCalls: () => void;\n};\n\ntype HarnessWindow = Window & { chartZoomHarness?: ZoomHarnessApi };\n\nconst POINT_COUNT = 180;\n\nconst zoomHarnessDataset = [\n ['time', 'value'],\n ...Array.from({ length: POINT_COUNT }, (_unused, index) => [\n index,\n Number((40 + Math.sin(index / 6) * 12).toFixed(2)),\n ]),\n];\n\n/**\n * Reproduces the consumer setup from the metrics UI: a chart with toolbox\n * brush-zoom whose parent re-renders while the chart stays mounted, passing a\n * freshly built `option` object on every render.\n */\nexport const ChartZoomHarness = ({\n settings,\n}: {\n settings?: ChartSettings;\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const zoomCallsRef = useRef<ZoomCall[]>([]);\n const [, setRerenderCount] = useState(0);\n\n const handleZoom = useCallback((zoom: ZoomCall) => {\n zoomCallsRef.current = [...zoomCallsRef.current, zoom];\n }, []);\n\n useEffect(() => {\n const getChart = () => {\n const echartElement =\n containerRef.current?.querySelector('.ndl-chart-echart');\n return echartElement instanceof HTMLElement\n ? getInstanceByDom(echartElement)\n : undefined;\n };\n\n (window as HarnessWindow).chartZoomHarness = {\n getAppliedZoomWindows: () => {\n const dataZoom = (\n getChart()?.getOption() as\n | { dataZoom?: { endValue?: number; startValue?: number }[] }\n | undefined\n )?.dataZoom;\n\n return (dataZoom ?? [])\n .filter(\n (item) =>\n item.startValue !== undefined && item.endValue !== undefined,\n )\n .map((item) => ({\n endValue: item.endValue as number,\n startValue: item.startValue as number,\n }));\n },\n getZoomCalls: () => zoomCallsRef.current,\n pixelToValue: (pixelX: number) =>\n getChart()?.convertFromPixel({ xAxisIndex: 0 }, pixelX) as number,\n resetZoomCalls: () => {\n zoomCallsRef.current = [];\n },\n };\n }, []);\n\n return (\n <div ref={containerRef} style={{ height: '420px', width: '900px' }}>\n <button\n type=\"button\"\n data-testid=\"force-rerender\"\n onClick={() => setRerenderCount((count) => count + 1)}\n >\n Re-render\n </button>\n <div className=\"ndl-chart\" style={{ height: '380px', width: '100%' }}>\n <Chart\n callbacks={{ onZoom: handleZoom }}\n dataset={[{ source: zoomHarnessDataset }]}\n series={[\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'time', y: 'value' },\n name: 'Value',\n type: 'line',\n },\n ]}\n settings={settings}\n xAxis={{ type: 'value' }}\n yAxis={{ type: 'value' }}\n option={{\n dataZoom: [\n {\n filterMode: 'none',\n type: 'inside',\n zoomOnMouseWheel: false,\n },\n ],\n toolbox: {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n },\n },\n },\n }}\n />\n </div>\n </div>\n );\n};\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HorizontalBarWithVerticalSlider = exports.verticalSliderCategories = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- /**
5
+ /*!
6
6
  *
7
7
  * Copyright (c) "Neo4j"
8
8
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalBarWithVerticalSlider.js","sourceRoot":"","sources":["../../../../src/charts/tests/HorizontalBarWithVerticalSlider.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAChD,qCAA2C;AAC3C,iCAAkC;AAErB,QAAA,wBAAwB,GAAG;IACtC,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,WAAW;CACZ,CAAC;AAEF,MAAM,OAAO,GAAG;IACd;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;QAC5B,MAAM,EAAE,gCAAwB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,GAAG;YACH,EAAE,GAAG,KAAK,GAAG,EAAE;SAChB,CAAC;KACH;CACF,CAAC;AAgBF,MAA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EAAE;aACjE,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAC3B,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAC3D,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,+BAA+B,mCAoC1C","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { getInstanceByDom } from 'echarts';\nimport { useEffect } from 'react';\n\nexport const verticalSliderCategories = [\n 'Friday',\n 'Saturday',\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday II',\n];\n\nconst dataset = [\n {\n dimensions: ['day', 'First'],\n source: verticalSliderCategories.map((day, index) => [\n day,\n 10 + index * 12,\n ]),\n },\n];\n\nexport type VerticalSliderHarnessApi = {\n /** Resolved layout of the first dataZoom component and the grid. */\n getResolvedLayout: () => {\n grid: { right?: number | string };\n slider: Record<string, unknown>;\n };\n /** Applies a zoom window through the slider's dataZoom action. */\n zoomTo: (start: number, end: number) => void;\n};\n\ntype HarnessWindow = Window & {\n verticalSliderHarness?: VerticalSliderHarnessApi;\n};\n\nconst getChart = () => {\n const element = document.querySelector('.ndl-chart-echart');\n return element instanceof HTMLElement ? getInstanceByDom(element) : undefined;\n};\n\n/**\n * Horizontal bar chart (value x-axis, category y-axis) with a slider bound to\n * the category axis, which Needle lays out as a vertical slider on the right.\n */\nexport const HorizontalBarWithVerticalSlider = () => {\n useEffect(() => {\n (window as HarnessWindow).verticalSliderHarness = {\n getResolvedLayout: () => {\n const option = getChart()?.getOption() as\n | {\n dataZoom?: Record<string, unknown>[];\n grid?: { right?: number | string }[];\n }\n | undefined;\n\n return {\n grid: option?.grid?.[0] ?? {},\n slider: option?.dataZoom?.[0] ?? {},\n };\n },\n zoomTo: (start: number, end: number) => {\n getChart()?.dispatchAction({ end, start, type: 'dataZoom' });\n },\n };\n }, []);\n\n return (\n <div style={{ height: '420px', width: '760px' }}>\n <Chart\n dataset={dataset}\n series={[\n // oxlint-disable-next-line\n { encode: { x: 'First', y: 'day' }, name: 'First', type: 'bar' },\n ]}\n xAxis={{ type: 'value' }}\n yAxis={{ type: 'category' }}\n option={{ dataZoom: [{ type: 'slider', yAxisIndex: [0] }] }}\n />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"HorizontalBarWithVerticalSlider.js","sourceRoot":"","sources":["../../../../src/charts/tests/HorizontalBarWithVerticalSlider.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAChD,qCAA2C;AAC3C,iCAAkC;AAErB,QAAA,wBAAwB,GAAG;IACtC,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,WAAW;CACZ,CAAC;AAEF,MAAM,OAAO,GAAG;IACd;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;QAC5B,MAAM,EAAE,gCAAwB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,GAAG;YACH,EAAE,GAAG,KAAK,GAAG,EAAE;SAChB,CAAC;KACH;CACF,CAAC;AAgBF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AAK,EAAE;aACjE,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAC3B,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAC3D,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,+BAA+B,mCAoC1C","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { getInstanceByDom } from 'echarts';\nimport { useEffect } from 'react';\n\nexport const verticalSliderCategories = [\n 'Friday',\n 'Saturday',\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday II',\n];\n\nconst dataset = [\n {\n dimensions: ['day', 'First'],\n source: verticalSliderCategories.map((day, index) => [\n day,\n 10 + index * 12,\n ]),\n },\n];\n\nexport type VerticalSliderHarnessApi = {\n /** Resolved layout of the first dataZoom component and the grid. */\n getResolvedLayout: () => {\n grid: { right?: number | string };\n slider: Record<string, unknown>;\n };\n /** Applies a zoom window through the slider's dataZoom action. */\n zoomTo: (start: number, end: number) => void;\n};\n\ntype HarnessWindow = Window & {\n verticalSliderHarness?: VerticalSliderHarnessApi;\n};\n\nconst getChart = () => {\n const element = document.querySelector('.ndl-chart-echart');\n return element instanceof HTMLElement ? getInstanceByDom(element) : undefined;\n};\n\n/**\n * Horizontal bar chart (value x-axis, category y-axis) with a slider bound to\n * the category axis, which Needle lays out as a vertical slider on the right.\n */\nexport const HorizontalBarWithVerticalSlider = () => {\n useEffect(() => {\n (window as HarnessWindow).verticalSliderHarness = {\n getResolvedLayout: () => {\n const option = getChart()?.getOption() as\n | {\n dataZoom?: Record<string, unknown>[];\n grid?: { right?: number | string }[];\n }\n | undefined;\n\n return {\n grid: option?.grid?.[0] ?? {},\n slider: option?.dataZoom?.[0] ?? {},\n };\n },\n zoomTo: (start: number, end: number) => {\n getChart()?.dispatchAction({ end, start, type: 'dataZoom' });\n },\n };\n }, []);\n\n return (\n <div style={{ height: '420px', width: '760px' }}>\n <Chart\n dataset={dataset}\n series={[\n // oxlint-disable-next-line\n { encode: { x: 'First', y: 'day' }, name: 'First', type: 'bar' },\n ]}\n xAxis={{ type: 'value' }}\n yAxis={{ type: 'category' }}\n option={{ dataZoom: [{ type: 'slider', yAxisIndex: [0] }] }}\n />\n </div>\n );\n};\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PieChartWithRerenderComponent = PieChartWithRerenderComponent;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- /**
5
+ /*!
6
6
  *
7
7
  * Copyright (c) "Neo4j"
8
8
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"PieChartWithRerender.js","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":";;AA+BA,sEAmDC;;AAlFD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAEhD,iCAAyC;AAQzC,SAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACM;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CA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O,EAAE,cAAc,GACvB,GACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport type { EChartsOption } from 'echarts';\nimport { useRef, useState } from 'react';\n\ntype PieChartWithRerenderProps = {\n dataset1: EChartsOption['dataset'];\n dataset2: EChartsOption['dataset'];\n datasetNewCategories: EChartsOption['dataset'];\n};\n\nexport function PieChartWithRerenderComponent({\n dataset1,\n dataset2,\n datasetNewCategories,\n}: PieChartWithRerenderProps) {\n const [renderCount, setRenderCount] = useState(0);\n const [shouldUseNewCategories, setShouldUseNewCategories] = useState(false);\n const chartRenderCount = useRef(0);\n chartRenderCount.current += 1;\n\n const currentDataset = shouldUseNewCategories\n ? datasetNewCategories\n : renderCount % 2 === 0\n ? dataset1\n : dataset2;\n\n return (\n <div>\n <div style={{ display: 'flex', gap: '8px', marginBottom: '12px' }}>\n <button\n type=\"button\"\n data-testid=\"rerender-button\"\n onClick={() => setRenderCount((count) => count + 1)}\n >\n Re-render\n </button>\n <button\n type=\"button\"\n data-testid=\"switch-categories-button\"\n onClick={() => setShouldUseNewCategories((value) => !value)}\n >\n Switch categories\n </button>\n <span data-testid=\"render-count\">{chartRenderCount.current}</span>\n </div>\n <div style={{ height: '350px', width: '100%' }}>\n <Chart\n legend={{ show: true }}\n series={[\n {\n center: ['50%', '50%'],\n encode: { itemName: 'product', value: '2015' },\n radius: '90%',\n type: 'pie',\n },\n ]}\n dataset={currentDataset}\n />\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"PieChartWithRerender.js","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":";;AA+BA,sEAmDC;;AAlFD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAAgD;AAEhD,iCAAyC;AAQzC,SAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACM;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC;IACnC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAC;IAE9B,MAAM,cAAc,GAAG,sBAAsB;QAC3C,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,WAAW,GAAG,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,QAAQ,CAAC;IAEf,OAAO,CACL,4CACE,iCAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAC/D,mCACE,IAAI,EAAC,QAAQ,iBACD,iBAAiB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,0BAG5C,EACT,mCACE,IAAI,EAAC,QAAQ,iBACD,0BAA0B,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,kCAGpD,EACT,gDAAkB,cAAc,YAAE,gBAAgB,CAAC,OAAO,GAAQ,IAC9D,EACN,gCAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5C,uBAAC,oBAAK,IACJ,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EACtB,MAAM,EAAE;wBACN;4BACE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;4BACtB,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;4BAC9C,MAAM,EAAE,KAAK;4BACb,IAAI,EAAE,KAAK;yBACZ;qBACF,EACD,OAAO,EAAE,cAAc,GACvB,GACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport type { EChartsOption } from 'echarts';\nimport { useRef, useState } from 'react';\n\ntype PieChartWithRerenderProps = {\n dataset1: EChartsOption['dataset'];\n dataset2: EChartsOption['dataset'];\n datasetNewCategories: EChartsOption['dataset'];\n};\n\nexport function PieChartWithRerenderComponent({\n dataset1,\n dataset2,\n datasetNewCategories,\n}: PieChartWithRerenderProps) {\n const [renderCount, setRenderCount] = useState(0);\n const [shouldUseNewCategories, setShouldUseNewCategories] = useState(false);\n const chartRenderCount = useRef(0);\n chartRenderCount.current += 1;\n\n const currentDataset = shouldUseNewCategories\n ? datasetNewCategories\n : renderCount % 2 === 0\n ? dataset1\n : dataset2;\n\n return (\n <div>\n <div style={{ display: 'flex', gap: '8px', marginBottom: '12px' }}>\n <button\n type=\"button\"\n data-testid=\"rerender-button\"\n onClick={() => setRenderCount((count) => count + 1)}\n >\n Re-render\n </button>\n <button\n type=\"button\"\n data-testid=\"switch-categories-button\"\n onClick={() => setShouldUseNewCategories((value) => !value)}\n >\n Switch categories\n </button>\n <span data-testid=\"render-count\">{chartRenderCount.current}</span>\n </div>\n <div style={{ height: '350px', width: '100%' }}>\n <Chart\n legend={{ show: true }}\n series={[\n {\n center: ['50%', '50%'],\n encode: { itemName: 'product', value: '2015' },\n radius: '90%',\n type: 'pie',\n },\n ]}\n dataset={currentDataset}\n />\n </div>\n </div>\n );\n}\n"]}
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.waitForAnimationEnd = exports.expectDefaultFormattedTooltipToBeVisible = exports.expectFormattedTooltipToBeVisible = exports.clickSeries = exports.expectAllLegendsNeutral = exports.expectLegendsDeselected = exports.expectLegendsSelected = exports.expectLegendSeriesToBeVisibleInChart = exports.expectLegendSeriesToBeHighlightedInChart = exports.expectSingleSeriesNotToBeBlurred = exports.getLegendMeasuringObserverResult = exports.startLegendMeasuringObserver = exports.expectChartElementVisible = exports.barChart = exports.barChartWithTooltipFormatter = exports.pieChartWithTooltipFormatter = exports.multiSeriesChart = exports.multiSeriesChartProps = exports.barChartProps = exports.pieChartProps = exports.chartColorsAfterHighlighting = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
- /**
14
+ /*!
15
15
  *
16
16
  * Copyright (c) "Neo4j"
17
17
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAA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mB,uBAQ9B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { expect } from '@playwright/experimental-ct-react';\nimport { type Page } from '@playwright/test';\nimport { type ComponentProps } from 'react';\n\nimport { ChartWrapperWithTooltipFormatter } from './ChartWrapperWithTooltipFormatter';\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex - Color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nconst convertHexToRGB = (hex: string) => {\n const normalizedHex = hex.replace(/^#/, '');\n\n const red = parseInt(normalizedHex.substring(0, 2), 16);\n const green = parseInt(normalizedHex.substring(2, 4), 16);\n const blue = parseInt(normalizedHex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const chartColorsAfterHighlighting: Record<number, string> = {\n 1: 'rgb(93,207,216)',\n 2: 'rgb(84,80,223)',\n 3: 'rgb(242,152,62)',\n 4: 'rgb(221,75,155)',\n 5: 'rgb(156,154,255)',\n 6: 'rgb(132,244,136)',\n 7: 'rgb(69,140,249)',\n 8: 'rgb(113,69,188)',\n 9: 'rgb(240,210,70)',\n 10: 'rgb(210,126,49)',\n 11: 'rgb(78,151,121)',\n 12: 'rgb(190,255,117)',\n};\n\nexport const pieChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: [\n {\n source: [\n ['product', '2012'],\n [seriesName, value],\n ],\n },\n ],\n legend: {\n show: true,\n },\n series: [\n {\n center: ['50%', '50%'],\n encode: {\n itemName: 'product',\n value: '2012',\n },\n itemStyle: {\n color: rgbSeriesColor,\n },\n radius: '90%',\n type: 'pie' as const,\n },\n ],\n});\n\nexport const barChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: {\n dimensions: ['Country', 'Sales'],\n source: [['Finland', value]],\n },\n legend: {\n show: true,\n },\n series: [\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'Country', y: 'Sales' },\n itemStyle: {\n color: rgbSeriesColor,\n },\n name: seriesName,\n type: 'bar' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n});\n\nexport const multiSeriesChartProps = {\n dataset: {\n dimensions: ['day', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth'],\n source: [\n ['Monday', 20, 40, 60, 80, 100, 120],\n ['Tuesday', 30, 50, 70, 90, 110, 130],\n ['Wednesday', 25, 45, 65, 85, 105, 125],\n ['Thursday', 35, 55, 75, 95, 115, 135],\n ['Friday', 40, 60, 80, 100, 120, 140],\n ],\n },\n legend: {\n show: true,\n },\n option: {},\n series: [\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'first' },\n name: 'First Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'second' },\n name: 'Second Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'third' },\n name: 'Third Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'fourth' },\n name: 'Fourth Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'fifth' },\n name: 'Fifth Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'sixth' },\n name: 'Sixth Series',\n type: 'line' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n};\n\nexport const multiSeriesChart = ({\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n}) => (\n <div style={{ height, width }} className=\"ndl-chart\">\n <Chart {...multiSeriesChartProps} {...chartProps} />\n </div>\n);\n\nexport const pieChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...pieChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChart = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <Chart\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg').first()).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nexport const startLegendMeasuringObserver = async (\n page: Page,\n options: { chartLayoutSelector?: string } = {},\n) => {\n await page.evaluate(({ chartLayoutSelector }) => {\n const windowWithLegendObserver = window as Window & {\n __chartHeightDuringLegendMeasurement?: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n __legendMeasuringClassWasAdded?: boolean;\n __legendMeasuringObserver?: MutationObserver;\n };\n const legendElement = document.querySelector('.ndl-chart-legend');\n const chartLayout = chartLayoutSelector\n ? document.querySelector(chartLayoutSelector)\n : undefined;\n\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement = undefined;\n windowWithLegendObserver.__legendMeasuringClassWasAdded = false;\n windowWithLegendObserver.__legendMeasuringObserver?.disconnect();\n\n if (!legendElement) {\n return;\n }\n\n const observer = new MutationObserver(() => {\n if (!legendElement.classList.contains('ndl-chart-legend-calculating')) {\n return;\n }\n\n windowWithLegendObserver.__legendMeasuringClassWasAdded = true;\n\n if (\n chartLayout &&\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement ===\n undefined\n ) {\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement =\n chartLayout.getBoundingClientRect().height;\n }\n });\n\n observer.observe(legendElement, {\n attributeFilter: ['class'],\n attributes: true,\n });\n windowWithLegendObserver.__legendMeasuringObserver = observer;\n }, options);\n};\n\nexport const getLegendMeasuringObserverResult = async (page: Page) =>\n page.evaluate(() => {\n const windowWithLegendObserver = window as Window & {\n __chartHeightDuringLegendMeasurement?: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n __legendMeasuringClassWasAdded?: boolean;\n __legendMeasuringObserver?: MutationObserver;\n };\n\n windowWithLegendObserver.__legendMeasuringObserver?.disconnect();\n\n return {\n chartHeightDuringMeasurement:\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement,\n didAddMeasuringClass:\n windowWithLegendObserver.__legendMeasuringClassWasAdded ?? false,\n };\n });\n\nconst SELECTORS = {\n CHECKMARK:\n '.ndl-chart-legend > .ndl-chart-legend-item .ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend > .ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `.ndl-chart-legend > [data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `.ndl-chart-legend > [data-labelname=\"${name}\"].ndl-chart-legend-item-deselected`,\n} as const;\n\nconst getGraphPaletteColorFromSeriesIndex = (index: string): string => {\n const hexColor = tokens.categorical[index as keyof typeof tokens.categorical];\n if (!hexColor) {\n throw new Error(`Categorical palette index ${index} not found`);\n }\n\n return hexColor;\n};\n\n/**\n * Checks so a single series is not blurred.\n */\nexport const expectSingleSeriesNotToBeBlurred = async (\n page: Page,\n seriesName: string,\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n const seriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === seriesName) +\n 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[seriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n seriesIndex.toString(),\n );\n\n // More flexible color matching - try both with and without spaces\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n // Wait for the element to be attached to the DOM before checking its attributes\n await expect(pathLocator).toBeAttached({ timeout: 10000 });\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n};\n\n/**\n * Checks so that the seriesNamesToBeHighlighted are visible in the chart and that other series are blurred.\n */\nexport const expectLegendSeriesToBeHighlightedInChart = async (\n page: Page,\n seriesNamesToBeHighlighted: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n for (const name of seriesNamesToBeHighlighted) {\n const highlightedSeriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[highlightedSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n highlightedSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n }\n\n const seriesToBeBlurred = allChartSeries.filter(\n (series) => !seriesNamesToBeHighlighted.includes(series.name),\n );\n\n for (const series of seriesToBeBlurred) {\n const blurredSeriesIndex =\n allChartSeries.findIndex(\n (seriesItem) => seriesItem.name === series.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[blurredSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n blurredSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).toHaveAttribute('stroke-opacity');\n }\n};\n\n/**\n * Identifies if the series are visible / not visible in the chart by checking\n * component-owned legend state. ECharts rewrites generated SVG paths during\n * legend updates, which makes exact path color selectors flaky in Firefox.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n await expect(page.locator('svg path').first()).toBeAttached();\n\n for (const name of seriesNamesToBeVisible) {\n const visibleLegendItem = page.locator(\n `.ndl-chart-legend > [data-labelname=\"${name}\"]`,\n );\n\n if ((await visibleLegendItem.count()) > 0) {\n await expect(visibleLegendItem).not.toHaveClass(\n /ndl-chart-legend-item-deselected/,\n );\n }\n }\n\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenLegendItem = page.locator(\n SELECTORS.seriesDeselected(hiddenSeriesItem.name),\n );\n\n if ((await hiddenLegendItem.count()) > 0) {\n await expect(hiddenLegendItem).toBeVisible();\n }\n }\n};\n\n// Check so legends are selected -> has checkmark and no strike-through classes\nexport const expectLegendsSelected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesCheckmark(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesDeselected(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are deselected -> has strike-through and no checkmark classes\nexport const expectLegendsDeselected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesDeselected(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesCheckmark(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so all legends are neutral -> no checkmark and no strike-through classes\nexport const expectAllLegendsNeutral = async (page: Page) => {\n await expect(page.locator(SELECTORS.CHECKMARK)).not.toBeVisible();\n await expect(page.locator(SELECTORS.DESELECTED)).not.toBeVisible();\n};\n\n/**\n * Clicks the series legend item and hover the chart to make sure no blur effect exists on other series in the chart.\n * This is needed to make sure the series has the correct color when looking for them in the chart in later steps.\n */\nexport const clickSeries = async (page: Page, seriesName: string) => {\n await page\n .locator(`.ndl-chart-legend > [data-labelname=\"${seriesName}\"]`)\n .click();\n await page.hover('.ndl-chart');\n};\n\nexport const expectFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n await expect(\n page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`)),\n ).toBeVisible();\n await page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`))\n .hover();\n const tooltip = page.getByText(`${seriesName}formatted ${value}`);\n await expect(tooltip).toBeVisible();\n};\n\nexport const expectDefaultFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n const chartElement = page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[fill=\"${rgbWithSpaces}\"]`));\n\n await expect(chartElement).toBeVisible();\n await chartElement.hover();\n\n const tooltip = page.locator('.ndl-charts-chart-tooltip');\n await expect(tooltip).toContainText(seriesName);\n await expect(tooltip).toContainText(\n new Intl.NumberFormat('en-US').format(value),\n );\n};\n\nexport const waitForAnimationEnd = (page: Page, selector: string) => {\n return page\n .locator(selector)\n .evaluate((element) =>\n Promise.all(\n element.getAnimations().map((animation) => animation.finished),\n ),\n );\n};\n"]}
1
+ {"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,0DAAgD;AAChD,6EAA2D;AAI3D,yFAAsF;AAEtF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;IACtC,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE5C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,OAAO,OAAO,GAAG,KAAK,KAAK,KAAK,IAAI,GAAG,CAAC;AAC1C,CAAC,CAAC;AAEW,QAAA,4BAA4B,GAA2B;IAClE,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,gBAAgB;IACnB,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,kBAAkB;IACrB,CAAC,EAAE,kBAAkB;IACrB,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,iBAAiB;IACpB,EAAE,EAAE,i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C,IAAU,EAAE,QAAgB,EAAE,EAAE;IAClE,OAAO,IAAI;SACR,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CACpB,OAAO,CAAC,GAAG,CACT,OAAO,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC/D,CACF,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { expect } from '@playwright/experimental-ct-react';\nimport { type Page } from '@playwright/test';\nimport { type ComponentProps } from 'react';\n\nimport { ChartWrapperWithTooltipFormatter } from './ChartWrapperWithTooltipFormatter';\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex - Color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nconst convertHexToRGB = (hex: string) => {\n const normalizedHex = hex.replace(/^#/, '');\n\n const red = parseInt(normalizedHex.substring(0, 2), 16);\n const green = parseInt(normalizedHex.substring(2, 4), 16);\n const blue = parseInt(normalizedHex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const chartColorsAfterHighlighting: Record<number, string> = {\n 1: 'rgb(93,207,216)',\n 2: 'rgb(84,80,223)',\n 3: 'rgb(242,152,62)',\n 4: 'rgb(221,75,155)',\n 5: 'rgb(156,154,255)',\n 6: 'rgb(132,244,136)',\n 7: 'rgb(69,140,249)',\n 8: 'rgb(113,69,188)',\n 9: 'rgb(240,210,70)',\n 10: 'rgb(210,126,49)',\n 11: 'rgb(78,151,121)',\n 12: 'rgb(190,255,117)',\n};\n\nexport const pieChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: [\n {\n source: [\n ['product', '2012'],\n [seriesName, value],\n ],\n },\n ],\n legend: {\n show: true,\n },\n series: [\n {\n center: ['50%', '50%'],\n encode: {\n itemName: 'product',\n value: '2012',\n },\n itemStyle: {\n color: rgbSeriesColor,\n },\n radius: '90%',\n type: 'pie' as const,\n },\n ],\n});\n\nexport const barChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: {\n dimensions: ['Country', 'Sales'],\n source: [['Finland', value]],\n },\n legend: {\n show: true,\n },\n series: [\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'Country', y: 'Sales' },\n itemStyle: {\n color: rgbSeriesColor,\n },\n name: seriesName,\n type: 'bar' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n});\n\nexport const multiSeriesChartProps = {\n dataset: {\n dimensions: ['day', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth'],\n source: [\n ['Monday', 20, 40, 60, 80, 100, 120],\n ['Tuesday', 30, 50, 70, 90, 110, 130],\n ['Wednesday', 25, 45, 65, 85, 105, 125],\n ['Thursday', 35, 55, 75, 95, 115, 135],\n ['Friday', 40, 60, 80, 100, 120, 140],\n ],\n },\n legend: {\n show: true,\n },\n option: {},\n series: [\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'first' },\n name: 'First Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'second' },\n name: 'Second Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'third' },\n name: 'Third Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'fourth' },\n name: 'Fourth Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'fifth' },\n name: 'Fifth Series',\n type: 'line' as const,\n },\n {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n encode: { x: 'day', y: 'sixth' },\n name: 'Sixth Series',\n type: 'line' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n};\n\nexport const multiSeriesChart = ({\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n}) => (\n <div style={{ height, width }} className=\"ndl-chart\">\n <Chart {...multiSeriesChartProps} {...chartProps} />\n </div>\n);\n\nexport const pieChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...pieChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChart = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <Chart\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg').first()).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nexport const startLegendMeasuringObserver = async (\n page: Page,\n options: { chartLayoutSelector?: string } = {},\n) => {\n await page.evaluate(({ chartLayoutSelector }) => {\n const windowWithLegendObserver = window as Window & {\n __chartHeightDuringLegendMeasurement?: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n __legendMeasuringClassWasAdded?: boolean;\n __legendMeasuringObserver?: MutationObserver;\n };\n const legendElement = document.querySelector('.ndl-chart-legend');\n const chartLayout = chartLayoutSelector\n ? document.querySelector(chartLayoutSelector)\n : undefined;\n\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement = undefined;\n windowWithLegendObserver.__legendMeasuringClassWasAdded = false;\n windowWithLegendObserver.__legendMeasuringObserver?.disconnect();\n\n if (!legendElement) {\n return;\n }\n\n const observer = new MutationObserver(() => {\n if (!legendElement.classList.contains('ndl-chart-legend-calculating')) {\n return;\n }\n\n windowWithLegendObserver.__legendMeasuringClassWasAdded = true;\n\n if (\n chartLayout &&\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement ===\n undefined\n ) {\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement =\n chartLayout.getBoundingClientRect().height;\n }\n });\n\n observer.observe(legendElement, {\n attributeFilter: ['class'],\n attributes: true,\n });\n windowWithLegendObserver.__legendMeasuringObserver = observer;\n }, options);\n};\n\nexport const getLegendMeasuringObserverResult = async (page: Page) =>\n page.evaluate(() => {\n const windowWithLegendObserver = window as Window & {\n __chartHeightDuringLegendMeasurement?: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n __legendMeasuringClassWasAdded?: boolean;\n __legendMeasuringObserver?: MutationObserver;\n };\n\n windowWithLegendObserver.__legendMeasuringObserver?.disconnect();\n\n return {\n chartHeightDuringMeasurement:\n windowWithLegendObserver.__chartHeightDuringLegendMeasurement,\n didAddMeasuringClass:\n windowWithLegendObserver.__legendMeasuringClassWasAdded ?? false,\n };\n });\n\nconst SELECTORS = {\n CHECKMARK:\n '.ndl-chart-legend > .ndl-chart-legend-item .ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend > .ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `.ndl-chart-legend > [data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `.ndl-chart-legend > [data-labelname=\"${name}\"].ndl-chart-legend-item-deselected`,\n} as const;\n\nconst getGraphPaletteColorFromSeriesIndex = (index: string): string => {\n const hexColor = tokens.categorical[index as keyof typeof tokens.categorical];\n if (!hexColor) {\n throw new Error(`Categorical palette index ${index} not found`);\n }\n\n return hexColor;\n};\n\n/**\n * Checks so a single series is not blurred.\n */\nexport const expectSingleSeriesNotToBeBlurred = async (\n page: Page,\n seriesName: string,\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n const seriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === seriesName) +\n 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[seriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n seriesIndex.toString(),\n );\n\n // More flexible color matching - try both with and without spaces\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n // Wait for the element to be attached to the DOM before checking its attributes\n await expect(pathLocator).toBeAttached({ timeout: 10000 });\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n};\n\n/**\n * Checks so that the seriesNamesToBeHighlighted are visible in the chart and that other series are blurred.\n */\nexport const expectLegendSeriesToBeHighlightedInChart = async (\n page: Page,\n seriesNamesToBeHighlighted: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n for (const name of seriesNamesToBeHighlighted) {\n const highlightedSeriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[highlightedSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n highlightedSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n }\n\n const seriesToBeBlurred = allChartSeries.filter(\n (series) => !seriesNamesToBeHighlighted.includes(series.name),\n );\n\n for (const series of seriesToBeBlurred) {\n const blurredSeriesIndex =\n allChartSeries.findIndex(\n (seriesItem) => seriesItem.name === series.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[blurredSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n blurredSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).toHaveAttribute('stroke-opacity');\n }\n};\n\n/**\n * Identifies if the series are visible / not visible in the chart by checking\n * component-owned legend state. ECharts rewrites generated SVG paths during\n * legend updates, which makes exact path color selectors flaky in Firefox.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n await expect(page.locator('svg path').first()).toBeAttached();\n\n for (const name of seriesNamesToBeVisible) {\n const visibleLegendItem = page.locator(\n `.ndl-chart-legend > [data-labelname=\"${name}\"]`,\n );\n\n if ((await visibleLegendItem.count()) > 0) {\n await expect(visibleLegendItem).not.toHaveClass(\n /ndl-chart-legend-item-deselected/,\n );\n }\n }\n\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenLegendItem = page.locator(\n SELECTORS.seriesDeselected(hiddenSeriesItem.name),\n );\n\n if ((await hiddenLegendItem.count()) > 0) {\n await expect(hiddenLegendItem).toBeVisible();\n }\n }\n};\n\n// Check so legends are selected -> has checkmark and no strike-through classes\nexport const expectLegendsSelected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesCheckmark(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesDeselected(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are deselected -> has strike-through and no checkmark classes\nexport const expectLegendsDeselected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesDeselected(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesCheckmark(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so all legends are neutral -> no checkmark and no strike-through classes\nexport const expectAllLegendsNeutral = async (page: Page) => {\n await expect(page.locator(SELECTORS.CHECKMARK)).not.toBeVisible();\n await expect(page.locator(SELECTORS.DESELECTED)).not.toBeVisible();\n};\n\n/**\n * Clicks the series legend item and hover the chart to make sure no blur effect exists on other series in the chart.\n * This is needed to make sure the series has the correct color when looking for them in the chart in later steps.\n */\nexport const clickSeries = async (page: Page, seriesName: string) => {\n await page\n .locator(`.ndl-chart-legend > [data-labelname=\"${seriesName}\"]`)\n .click();\n await page.hover('.ndl-chart');\n};\n\nexport const expectFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n await expect(\n page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`)),\n ).toBeVisible();\n await page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`))\n .hover();\n const tooltip = page.getByText(`${seriesName}formatted ${value}`);\n await expect(tooltip).toBeVisible();\n};\n\nexport const expectDefaultFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n const chartElement = page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[fill=\"${rgbWithSpaces}\"]`));\n\n await expect(chartElement).toBeVisible();\n await chartElement.hover();\n\n const tooltip = page.locator('.ndl-charts-chart-tooltip');\n await expect(tooltip).toContainText(seriesName);\n await expect(tooltip).toContainText(\n new Intl.NumberFormat('en-US').format(value),\n );\n};\n\nexport const waitForAnimationEnd = (page: Page, selector: string) => {\n return page\n .locator(selector)\n .evaluate((element) =>\n Promise.all(\n element.getAnimations().map((animation) => animation.finished),\n ),\n );\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ndlEchartsTheme = void 0;
4
- /**
4
+ /*!
5
5
  *
6
6
  * Copyright (c) "Neo4j"
7
7
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2BAA2B;AAC3B,0CAAyC;AAIzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE;QACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACpD,UAAU,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;QACtD,QAAQ,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ;KACnD;IACD,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,IAAI;IACrB,aAA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E,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,eAAe,mBA6G1B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n// oxlint-disable sort-keys\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type HexColor } from '../utils/chart-types';\n\nconst axisCommon = (theme: 'light' | 'dark') => ({\n axisLabel: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n fontFamily: tokens.typography['body-small'].fontFamily,\n fontSize: tokens.typography['body-small'].fontSize,\n },\n nameGap: 8,\n nameMoveOverlap: true,\n nameTextStyle: {\n color: tokens.theme[theme].color.neutral.text.default,\n fontFamily: tokens.typography['body-medium'].fontFamily,\n fontSize: tokens.typography['body-medium'].fontSize,\n fontWeight: tokens.typography['body-medium'].fontWeight,\n lineHeight: tokens.typography['body-medium'].lineHeight,\n },\n axisLine: {\n lineStyle: {\n cap: 'square',\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 2,\n },\n },\n axisTick: {\n length: 8,\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 1,\n },\n show: true,\n },\n minorSplitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n splitArea: {\n areaStyle: {\n color: [tokens.theme[theme].color.neutral.hover, 'transparent'],\n },\n },\n splitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n});\n\nexport const ndlEchartsTheme = (\n theme: 'light' | 'dark',\n palette?: HexColor[],\n) => {\n return {\n darkMode: theme === 'dark',\n color: palette ?? Object.values(tokens.categorical),\n backgroundColor: 'transparent',\n\n axisPointer: {\n crossStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n label: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n },\n // We use a custom legend so this does not affect anything\n legend: {},\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n // We are not using the echarts title so this does not affect anything\n title: {},\n toolbox: {},\n\n dataZoom: {\n backgroundColor: 'transparent',\n borderColor: tokens.theme[theme].color.neutral.border.weak,\n borderRadius: parseInt(tokens.borderRadius.sm.replace('px', '')),\n dataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg.default,\n opacity: 1,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n opacity: 1,\n width: 1,\n },\n },\n emphasis: {\n handleLabel: {},\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1,\n },\n moveHandleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n },\n },\n fillerColor: `rgb( from ${tokens.theme[theme].color.neutral.hover} r g b / 0.1)`,\n handleIcon:\n 'M2 0.5h4s1.5 0 1.5 1.5v16s0 1.5 -1.5 1.5h-4s-1.5 0 -1.5 -1.5v-16s0 -1.5 1.5 -1.5',\n handleSize: '80%',\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.weak,\n\n // borderRadius: 0, // Doesn't work\n },\n moveHandleSize: 6,\n moveHandleStyle: {\n backgroundColor: tokens.theme[theme].color.neutral.bg.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1, // 0.3,\n },\n selectedDataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg['on-bg-weak'],\n opacity: 1,\n shadowBlur: 0,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n width: 1,\n },\n },\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n },\n // Not implemented\n visualMap: {},\n // Not implemented\n timeline: {},\n // Not implemented\n calendar: {},\n timeAxis: axisCommon(theme),\n logAxis: axisCommon(theme),\n valueAxis: axisCommon(theme),\n categoryAxis: axisCommon(theme),\n line: {\n symbol: 'circle',\n },\n // Not implemented\n graph: {},\n // Not implemented\n gauge: {},\n // Not implemented\n candlestick: {},\n };\n};\n"]}
1
+ {"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2BAA2B;AAC3B,0CAAyC;AAIzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE;QACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACpD,UAAU,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;QACtD,QAAQ,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ;KACnD;IACD,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE;QACb,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;QACrD,UAAU,EAAE,aAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU;QACvD,QAAQ,EAAE,aAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,QAAQ;QACnD,UAAU,EAAE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AE,OAAO;aACpB;YACD,sBAAsB,EAAE;gBACtB,SAAS,EAAE;oBACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;oBACzD,OAAO,EAAE,CAAC;oBACV,UAAU,EAAE,CAAC;iBACd;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;oBACtD,OAAO,EAAE,CAAC;oBACV,KAAK,EAAE,CAAC;iBACT;aACF;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;aACrD;SACF;QACD,kBAAkB;QAClB,SAAS,EAAE,EAAE;QACb,kBAAkB;QAClB,QAAQ,EAAE,EAAE;QACZ,kBAAkB;QAClB,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC;QAC3B,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;QAC1B,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC;QAC/B,IAAI,EAAE;YACJ,MAAM,EAAE,QAAQ;SACjB;QACD,kBAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,eAAe,mBA6G1B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n// oxlint-disable sort-keys\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type HexColor } from '../utils/chart-types';\n\nconst axisCommon = (theme: 'light' | 'dark') => ({\n axisLabel: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n fontFamily: tokens.typography['body-small'].fontFamily,\n fontSize: tokens.typography['body-small'].fontSize,\n },\n nameGap: 8,\n nameMoveOverlap: true,\n nameTextStyle: {\n color: tokens.theme[theme].color.neutral.text.default,\n fontFamily: tokens.typography['body-medium'].fontFamily,\n fontSize: tokens.typography['body-medium'].fontSize,\n fontWeight: tokens.typography['body-medium'].fontWeight,\n lineHeight: tokens.typography['body-medium'].lineHeight,\n },\n axisLine: {\n lineStyle: {\n cap: 'square',\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 2,\n },\n },\n axisTick: {\n length: 8,\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 1,\n },\n show: true,\n },\n minorSplitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n splitArea: {\n areaStyle: {\n color: [tokens.theme[theme].color.neutral.hover, 'transparent'],\n },\n },\n splitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n});\n\nexport const ndlEchartsTheme = (\n theme: 'light' | 'dark',\n palette?: HexColor[],\n) => {\n return {\n darkMode: theme === 'dark',\n color: palette ?? Object.values(tokens.categorical),\n backgroundColor: 'transparent',\n\n axisPointer: {\n crossStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n label: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n },\n // We use a custom legend so this does not affect anything\n legend: {},\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n // We are not using the echarts title so this does not affect anything\n title: {},\n toolbox: {},\n\n dataZoom: {\n backgroundColor: 'transparent',\n borderColor: tokens.theme[theme].color.neutral.border.weak,\n borderRadius: parseInt(tokens.borderRadius.sm.replace('px', '')),\n dataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg.default,\n opacity: 1,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n opacity: 1,\n width: 1,\n },\n },\n emphasis: {\n handleLabel: {},\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1,\n },\n moveHandleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n },\n },\n fillerColor: `rgb( from ${tokens.theme[theme].color.neutral.hover} r g b / 0.1)`,\n handleIcon:\n 'M2 0.5h4s1.5 0 1.5 1.5v16s0 1.5 -1.5 1.5h-4s-1.5 0 -1.5 -1.5v-16s0 -1.5 1.5 -1.5',\n handleSize: '80%',\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.weak,\n\n // borderRadius: 0, // Doesn't work\n },\n moveHandleSize: 6,\n moveHandleStyle: {\n backgroundColor: tokens.theme[theme].color.neutral.bg.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1, // 0.3,\n },\n selectedDataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg['on-bg-weak'],\n opacity: 1,\n shadowBlur: 0,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n width: 1,\n },\n },\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n },\n // Not implemented\n visualMap: {},\n // Not implemented\n timeline: {},\n // Not implemented\n calendar: {},\n timeAxis: axisCommon(theme),\n logAxis: axisCommon(theme),\n valueAxis: axisCommon(theme),\n categoryAxis: axisCommon(theme),\n line: {\n symbol: 'circle',\n },\n // Not implemented\n graph: {},\n // Not implemented\n gauge: {},\n // Not implemented\n candlestick: {},\n };\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /**
2
+ /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
5
5
  * Neo4j Sweden AB [http://neo4j.com]