@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,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
2
+ /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
5
5
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"PieChartWithRerender.js","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQzC,MAAM,UAAU,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACM;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,MAAM,CAAC,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,0BACE,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAC/D,iBACE,IAAI,EAAC,QAAQ,iBACD,iBAAiB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,0BAG5C,EACT,iBACE,IAAI,EAAC,QAAQ,iBACD,0BAA0B,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,kCAGpD,EACT,8BAAkB,cAAc,YAAE,gBAAgB,CAAC,OAAO,GAAQ,IAC9D,EACN,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5C,KAAC,KAAK,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"]}
1
+ {"version":3,"file":"PieChartWithRerender.js","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQzC,MAAM,UAAU,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACM;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,MAAM,CAAC,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,0BACE,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAC/D,iBACE,IAAI,EAAC,QAAQ,iBACD,iBAAiB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,0BAG5C,EACT,iBACE,IAAI,EAAC,QAAQ,iBACD,0BAA0B,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,kCAGpD,EACT,8BAAkB,cAAc,YAAE,gBAAgB,CAAC,OAAO,GAAQ,IAC9D,EACN,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5C,KAAC,KAAK,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"]}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- /**
11
+ /*!
12
12
  *
13
13
  * Copyright (c) "Neo4j"
14
14
  * 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":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAI3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;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;AAEF,MAAM,CAAC,MAAM,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,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CAAC,WAAW,EAAE,CAAC;AACtC,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CACtD,IAAU,EACV,UAAkB,EAClB,KAAa,EACb,cAAsB,EACtB,EAAE;IACF,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,IAAI;SACtB,OAAO,CAAC,cAAc,cAAc,IAAI,CAAC;SACzC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,aAAa,IAAI,CAAC,CAAC,CAAC;IAErD,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IACzC,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;IAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1D,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAChD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CACjC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7C,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,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","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,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAI3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;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;AAEF,MAAM,CAAC,MAAM,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,iBAA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AAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CACtD,IAAU,EACV,UAAkB,EAClB,KAAa,EACb,cAAsB,EACtB,EAAE;IACF,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,IAAI;SACtB,OAAO,CAAC,cAAc,cAAc,IAAI,CAAC;SACzC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,aAAa,IAAI,CAAC,CAAC,CAAC;IAErD,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IACzC,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;IAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1D,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAChD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CACjC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7C,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,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","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,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * 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,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACpD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;QACtD,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ;KACnD;IACD,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;QACrD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU;QACvD,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,QAAQ;QACnD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU;QACvD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU;KACxD;IACD,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CA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EAAE,MAAM,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,MAAM,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","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;;;;;;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,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","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,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"aria-description.js","sourceRoot":"","sources":["../../../../src/charts/utils/aria-description.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,aAAa,CAAC;A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,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,iBAAiB,SAAS,CAAC,UAAU,8BAA8B,aAAa,IAAI,SAAS,CAAC,UAAU,GAAG,CAC9K,CAAC;IACJ,CAAC;IAED,iDAAiD;IACjD,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QAED,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,kEAAkE;YAClE,kEAAkE;YAClE,IAAI,SAAS,CAAC,kBAAkB,EAAE,CAAC;gBACjC,SAAS;YACX,CAAC;YAED,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,CAAC,KAAK,EAAE,EAAE,CACR,0BAA0B,CACxB,KAAK,EACL,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,UAAU,CACrB,CAAC,cAAc,CACnB,CAAC;YAEF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC;gBACrC,KAAK,CAAC,IAAI,CACR,GAAG,IAAI,QAAQ,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,wBAAwB,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,SAAS,CAAC,gBAAgB,iBAAiB,SAAS,CAAC,UAAU,GAAG,CAC7K,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,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 { EChartsOption, SeriesOption } from 'echarts';\n\nimport type {\n Condition,\n NeedleSeries,\n NotificationType,\n ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport {\n evaluateThresholdCondition,\n thresholdConditionToText,\n} from './threshold';\n\ninterface ResolvedDataSeries {\n name: string;\n type: string;\n values: number[];\n}\n\ninterface ResolvedThreshold {\n notificationType: NotificationType;\n yAxisValue: number;\n condition: Condition;\n hasCustomCondition: boolean;\n customConditionText?: string;\n}\n\n/**\n * Extract numeric y-values from inline series data.\n * Handles formats: [x, y], [x, y, ...], or single number.\n */\nfunction extractInlineValues(\n data: SeriesOption['data'],\n encode?: {\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 x?: string | number;\n // oxlint-disable-next-line id-length\n y?: string | number;\n },\n): number[] {\n if (!Array.isArray(data)) {\n return [];\n }\n\n const yIndex =\n encode?.y !== undefined && typeof encode.y === 'number' ? encode.y : 1;\n\n const values: number[] = [];\n for (const point of data) {\n if (point === null || point === undefined) {\n continue;\n }\n if (Array.isArray(point)) {\n const val = point[yIndex];\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n }\n } else if (typeof point === 'number' && !isNaN(point)) {\n values.push(point);\n } else if (typeof point === 'object' && 'value' in point) {\n const val = point.value;\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n } else if (Array.isArray(val)) {\n const yValue = val[yIndex];\n if (typeof yValue === 'number' && !isNaN(yValue)) {\n values.push(yValue);\n }\n }\n }\n }\n return values;\n}\n\n/**\n * Extract numeric y-values from a dataset source for a given series.\n */\nfunction extractDatasetValues(\n dataset: EChartsOption['dataset'],\n series: SeriesOption,\n): number[] {\n if (!dataset) {\n return [];\n }\n\n const datasets = Array.isArray(dataset) ? dataset : [dataset];\n const datasetIndex =\n 'datasetIndex' in series && typeof series.datasetIndex === 'number'\n ? series.datasetIndex\n : 0;\n const currentDataset = datasets[datasetIndex];\n\n if (!currentDataset || !Array.isArray(currentDataset.source)) {\n return [];\n }\n\n const source = currentDataset.source as (string | number)[][];\n if (source.length < 1) {\n return [];\n }\n\n // Determine column names and data start index.\n // When `dimensions` is provided, column names come from there and all\n // rows in `source` are data. Otherwise the first row is a header.\n const dimensions = currentDataset.dimensions as\n | (string | { name: string })[]\n | undefined;\n let columnNames: (string | number)[];\n let dataStartIndex: number;\n\n if (Array.isArray(dimensions) && dimensions.length > 0) {\n columnNames = dimensions.map((dimension) =>\n typeof dimension === 'string' ? dimension : dimension.name,\n );\n dataStartIndex = 0;\n } else {\n const headerRow = source[0];\n if (!Array.isArray(headerRow) || source.length < 2) {\n return [];\n }\n columnNames = headerRow;\n dataStartIndex = 1;\n }\n\n // Determine which column contains the y-values\n const encode =\n 'encode' in series ? (series.encode as Record<string, unknown>) : undefined;\n let yColumnIndex = -1;\n\n if (encode?.y !== undefined) {\n if (typeof encode.y === 'number') {\n yColumnIndex = encode.y;\n } else if (typeof encode.y === 'string') {\n yColumnIndex = columnNames.indexOf(encode.y);\n }\n }\n\n if (yColumnIndex === -1) {\n // Avoid guessing a data column for aria descriptions.\n // If we cannot resolve a value column explicitly, return no values.\n return [];\n }\n\n const values: number[] = [];\n for (let rowIndex = dataStartIndex; rowIndex < source.length; rowIndex++) {\n const row = source[rowIndex];\n if (!Array.isArray(row)) {\n continue;\n }\n const val = row[yColumnIndex];\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n }\n }\n\n return values;\n}\n\nfunction pluralize(count: number, singular: string, plural?: string): string {\n return count === 1 ? singular : (plural ?? `${singular}s`);\n}\n\n/**\n * Resolves y-values for a series from either inline data or a dataset.\n */\nfunction resolveSeriesValues(\n series: SeriesOption,\n dataset: EChartsOption['dataset'],\n): number[] {\n if ('data' in series && series.data) {\n const encode =\n 'encode' in series\n ? (series.encode as Record<string, unknown> | undefined)\n : undefined;\n return extractInlineValues(series.data, encode);\n }\n return extractDatasetValues(dataset, series);\n}\n\n/**\n * Generates a human-readable aria-label description for the chart\n * that includes meaningful threshold context and data relationships.\n */\nexport function generateThresholdAriaDescription(\n propsSeries: NeedleSeries,\n dataset: EChartsOption['dataset'],\n): string | undefined {\n const seriesArray = Array.isArray(propsSeries) ? propsSeries : [propsSeries];\n\n // Separate threshold lines from data series\n const thresholds: ResolvedThreshold[] = [];\n const dataSeries: ResolvedDataSeries[] = [];\n\n for (const series of seriesArray) {\n if (series.type === 'thresholdLine') {\n const threshold = series as ThresholdLineSeriesOption<NotificationType>;\n thresholds.push({\n condition:\n threshold.condition ?? defaultThresholdLineSeriesOption.condition,\n customConditionText: threshold.customConditionText,\n hasCustomCondition: typeof threshold.customCondition === 'function',\n notificationType: threshold.notificationType,\n yAxisValue: threshold.yAxis,\n });\n } else {\n const echartsSeriesOption = series as SeriesOption;\n const name =\n typeof echartsSeriesOption.name === 'string'\n ? echartsSeriesOption.name\n : `Series ${dataSeries.length + 1}`;\n\n const values = resolveSeriesValues(echartsSeriesOption, dataset);\n\n dataSeries.push({\n name,\n type: echartsSeriesOption.type ?? 'line',\n values,\n });\n }\n }\n\n if (thresholds.length === 0) {\n return undefined;\n }\n\n const parts: string[] = [];\n\n // 1. Overview\n const dataSeriesCountText =\n dataSeries.length === 1\n ? '1 data series'\n : `${dataSeries.length} data series`;\n const thresholdCountText =\n thresholds.length === 1\n ? '1 threshold line'\n : `${thresholds.length} threshold lines`;\n parts.push(\n `This chart has ${dataSeriesCountText} and ${thresholdCountText}.`,\n );\n\n // 2. Describe each data series\n for (const series of dataSeries) {\n const { name, type, values } = series;\n if (values.length > 0) {\n const min = Math.min(...values);\n const max = Math.max(...values);\n parts.push(\n `${name} is a ${type} chart with ${values.length} ${pluralize(values.length, 'data point')} ranging from ${min} to ${max}.`,\n );\n } else {\n parts.push(`${name} is a ${type} chart with no resolved data.`);\n }\n }\n\n // 3. Describe threshold lines\n for (const threshold of thresholds) {\n const conditionText = threshold.hasCustomCondition\n ? (threshold.customConditionText ?? 'custom condition')\n : thresholdConditionToText(threshold.condition);\n\n parts.push(\n `${threshold.notificationType === 'warning' ? 'Warning' : 'Danger'} threshold at ${threshold.yAxisValue}: triggers when values are ${conditionText} ${threshold.yAxisValue}.`,\n );\n }\n\n // 4. Report threshold violations per data series\n for (const series of dataSeries) {\n const { name, values } = series;\n if (values.length === 0) {\n continue;\n }\n\n for (const threshold of thresholds) {\n // Custom conditions use runtime callbacks that we cannot evaluate\n // at description-generation time, so we skip violation reporting.\n if (threshold.hasCustomCondition) {\n continue;\n }\n\n const violatingValues = values.filter(\n (value) =>\n evaluateThresholdCondition(\n value,\n threshold.condition,\n threshold.yAxisValue,\n ).isConditionMet,\n );\n\n if (violatingValues.length > 0) {\n const count = violatingValues.length;\n parts.push(\n `${name} has ${count} ${pluralize(count, 'value')} ${thresholdConditionToText(threshold.condition)} the ${threshold.notificationType} threshold of ${threshold.yAxisValue}.`,\n );\n }\n }\n }\n\n return parts.join(' ');\n}\n"]}
1
+ {"version":3,"file":"aria-description.js","sourceRoot":"","sources":["../../../../src/charts/utils/aria-description.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAgBrB;;;GAGG;AACH,SAAS,mBAAmB,CAC1B,IAA0B,EAC1B,MAMC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAA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CAAC;IACJ,CAAC;IAED,iDAAiD;IACjD,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QAED,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,kEAAkE;YAClE,kEAAkE;YAClE,IAAI,SAAS,CAAC,kBAAkB,EAAE,CAAC;gBACjC,SAAS;YACX,CAAC;YAED,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,CAAC,KAAK,EAAE,EAAE,CACR,0BAA0B,CACxB,KAAK,EACL,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,UAAU,CACrB,CAAC,cAAc,CACnB,CAAC;YAEF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC;gBACrC,KAAK,CAAC,IAAI,CACR,GAAG,IAAI,QAAQ,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,wBAAwB,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,SAAS,CAAC,gBAAgB,iBAAiB,SAAS,CAAC,UAAU,GAAG,CAC7K,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,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 { EChartsOption, SeriesOption } from 'echarts';\n\nimport type {\n Condition,\n NeedleSeries,\n NotificationType,\n ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport {\n evaluateThresholdCondition,\n thresholdConditionToText,\n} from './threshold';\n\ninterface ResolvedDataSeries {\n name: string;\n type: string;\n values: number[];\n}\n\ninterface ResolvedThreshold {\n notificationType: NotificationType;\n yAxisValue: number;\n condition: Condition;\n hasCustomCondition: boolean;\n customConditionText?: string;\n}\n\n/**\n * Extract numeric y-values from inline series data.\n * Handles formats: [x, y], [x, y, ...], or single number.\n */\nfunction extractInlineValues(\n data: SeriesOption['data'],\n encode?: {\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 x?: string | number;\n // oxlint-disable-next-line id-length\n y?: string | number;\n },\n): number[] {\n if (!Array.isArray(data)) {\n return [];\n }\n\n const yIndex =\n encode?.y !== undefined && typeof encode.y === 'number' ? encode.y : 1;\n\n const values: number[] = [];\n for (const point of data) {\n if (point === null || point === undefined) {\n continue;\n }\n if (Array.isArray(point)) {\n const val = point[yIndex];\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n }\n } else if (typeof point === 'number' && !isNaN(point)) {\n values.push(point);\n } else if (typeof point === 'object' && 'value' in point) {\n const val = point.value;\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n } else if (Array.isArray(val)) {\n const yValue = val[yIndex];\n if (typeof yValue === 'number' && !isNaN(yValue)) {\n values.push(yValue);\n }\n }\n }\n }\n return values;\n}\n\n/**\n * Extract numeric y-values from a dataset source for a given series.\n */\nfunction extractDatasetValues(\n dataset: EChartsOption['dataset'],\n series: SeriesOption,\n): number[] {\n if (!dataset) {\n return [];\n }\n\n const datasets = Array.isArray(dataset) ? dataset : [dataset];\n const datasetIndex =\n 'datasetIndex' in series && typeof series.datasetIndex === 'number'\n ? series.datasetIndex\n : 0;\n const currentDataset = datasets[datasetIndex];\n\n if (!currentDataset || !Array.isArray(currentDataset.source)) {\n return [];\n }\n\n const source = currentDataset.source as (string | number)[][];\n if (source.length < 1) {\n return [];\n }\n\n // Determine column names and data start index.\n // When `dimensions` is provided, column names come from there and all\n // rows in `source` are data. Otherwise the first row is a header.\n const dimensions = currentDataset.dimensions as\n | (string | { name: string })[]\n | undefined;\n let columnNames: (string | number)[];\n let dataStartIndex: number;\n\n if (Array.isArray(dimensions) && dimensions.length > 0) {\n columnNames = dimensions.map((dimension) =>\n typeof dimension === 'string' ? dimension : dimension.name,\n );\n dataStartIndex = 0;\n } else {\n const headerRow = source[0];\n if (!Array.isArray(headerRow) || source.length < 2) {\n return [];\n }\n columnNames = headerRow;\n dataStartIndex = 1;\n }\n\n // Determine which column contains the y-values\n const encode =\n 'encode' in series ? (series.encode as Record<string, unknown>) : undefined;\n let yColumnIndex = -1;\n\n if (encode?.y !== undefined) {\n if (typeof encode.y === 'number') {\n yColumnIndex = encode.y;\n } else if (typeof encode.y === 'string') {\n yColumnIndex = columnNames.indexOf(encode.y);\n }\n }\n\n if (yColumnIndex === -1) {\n // Avoid guessing a data column for aria descriptions.\n // If we cannot resolve a value column explicitly, return no values.\n return [];\n }\n\n const values: number[] = [];\n for (let rowIndex = dataStartIndex; rowIndex < source.length; rowIndex++) {\n const row = source[rowIndex];\n if (!Array.isArray(row)) {\n continue;\n }\n const val = row[yColumnIndex];\n if (typeof val === 'number' && !isNaN(val)) {\n values.push(val);\n }\n }\n\n return values;\n}\n\nfunction pluralize(count: number, singular: string, plural?: string): string {\n return count === 1 ? singular : (plural ?? `${singular}s`);\n}\n\n/**\n * Resolves y-values for a series from either inline data or a dataset.\n */\nfunction resolveSeriesValues(\n series: SeriesOption,\n dataset: EChartsOption['dataset'],\n): number[] {\n if ('data' in series && series.data) {\n const encode =\n 'encode' in series\n ? (series.encode as Record<string, unknown> | undefined)\n : undefined;\n return extractInlineValues(series.data, encode);\n }\n return extractDatasetValues(dataset, series);\n}\n\n/**\n * Generates a human-readable aria-label description for the chart\n * that includes meaningful threshold context and data relationships.\n */\nexport function generateThresholdAriaDescription(\n propsSeries: NeedleSeries,\n dataset: EChartsOption['dataset'],\n): string | undefined {\n const seriesArray = Array.isArray(propsSeries) ? propsSeries : [propsSeries];\n\n // Separate threshold lines from data series\n const thresholds: ResolvedThreshold[] = [];\n const dataSeries: ResolvedDataSeries[] = [];\n\n for (const series of seriesArray) {\n if (series.type === 'thresholdLine') {\n const threshold = series as ThresholdLineSeriesOption<NotificationType>;\n thresholds.push({\n condition:\n threshold.condition ?? defaultThresholdLineSeriesOption.condition,\n customConditionText: threshold.customConditionText,\n hasCustomCondition: typeof threshold.customCondition === 'function',\n notificationType: threshold.notificationType,\n yAxisValue: threshold.yAxis,\n });\n } else {\n const echartsSeriesOption = series as SeriesOption;\n const name =\n typeof echartsSeriesOption.name === 'string'\n ? echartsSeriesOption.name\n : `Series ${dataSeries.length + 1}`;\n\n const values = resolveSeriesValues(echartsSeriesOption, dataset);\n\n dataSeries.push({\n name,\n type: echartsSeriesOption.type ?? 'line',\n values,\n });\n }\n }\n\n if (thresholds.length === 0) {\n return undefined;\n }\n\n const parts: string[] = [];\n\n // 1. Overview\n const dataSeriesCountText =\n dataSeries.length === 1\n ? '1 data series'\n : `${dataSeries.length} data series`;\n const thresholdCountText =\n thresholds.length === 1\n ? '1 threshold line'\n : `${thresholds.length} threshold lines`;\n parts.push(\n `This chart has ${dataSeriesCountText} and ${thresholdCountText}.`,\n );\n\n // 2. Describe each data series\n for (const series of dataSeries) {\n const { name, type, values } = series;\n if (values.length > 0) {\n const min = Math.min(...values);\n const max = Math.max(...values);\n parts.push(\n `${name} is a ${type} chart with ${values.length} ${pluralize(values.length, 'data point')} ranging from ${min} to ${max}.`,\n );\n } else {\n parts.push(`${name} is a ${type} chart with no resolved data.`);\n }\n }\n\n // 3. Describe threshold lines\n for (const threshold of thresholds) {\n const conditionText = threshold.hasCustomCondition\n ? (threshold.customConditionText ?? 'custom condition')\n : thresholdConditionToText(threshold.condition);\n\n parts.push(\n `${threshold.notificationType === 'warning' ? 'Warning' : 'Danger'} threshold at ${threshold.yAxisValue}: triggers when values are ${conditionText} ${threshold.yAxisValue}.`,\n );\n }\n\n // 4. Report threshold violations per data series\n for (const series of dataSeries) {\n const { name, values } = series;\n if (values.length === 0) {\n continue;\n }\n\n for (const threshold of thresholds) {\n // Custom conditions use runtime callbacks that we cannot evaluate\n // at description-generation time, so we skip violation reporting.\n if (threshold.hasCustomCondition) {\n continue;\n }\n\n const violatingValues = values.filter(\n (value) =>\n evaluateThresholdCondition(\n value,\n threshold.condition,\n threshold.yAxisValue,\n ).isConditionMet,\n );\n\n if (violatingValues.length > 0) {\n const count = violatingValues.length;\n parts.push(\n `${name} has ${count} ${pluralize(count, 'value')} ${thresholdConditionToText(threshold.condition)} the ${threshold.notificationType} threshold of ${threshold.yAxisValue}.`,\n );\n }\n }\n }\n\n return parts.join(' ');\n}\n"]}
@@ -1,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"build-chart-option.js","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAiBvC,MAAM,eAAe,GAAG,CAAC,QAAmC,EAAE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,EACjE,OAAO,EAAE;YACP,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,kDAAkD;YAChE,SAAS,EAAE,0BAA0B,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;YACrE,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,MAAM;SAChB,EACD,KAAK;QACL,KAAK,IACL;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 type { DataZoomComponentOption, EChartsOption } from 'echarts';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport { createAxisTooltipFormatter } from './chart-tooltip-formatter';\nimport type { ChartProps, EchartsSeries } from './chart-types';\nimport type { NormalizedThresholdLine } from './threshold';\nimport { isVerticalSlider, mergeToolbox } from './user-option-utils';\n\nconst SLIDER_OUTER_BOUND_GAP = 8;\nconst SLIDER_OUTER_BOUND_FALLBACK = 60;\n\ntype BuildChartOptionParams = {\n dataZoom: EChartsOption['dataZoom'];\n dataset: ChartProps['dataset'];\n hasCategoryXAxis: boolean;\n legendSelected: Record<string, boolean>;\n propsSeries: ChartProps['series'];\n series: EchartsSeries;\n thresholdLines: NormalizedThresholdLine[];\n toolboxOptions: EChartsOption['toolbox'];\n userOption: ChartProps['option'];\n xAxis: EChartsOption['xAxis'];\n yAxis: EChartsOption['yAxis'];\n hasMarkArea: boolean;\n};\n\nconst toDataZoomArray = (dataZoom: EChartsOption['dataZoom']) =>\n Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n\n/**\n * Horizontal slider zoom needs extra bottom grid space for ECharts' slider\n * control.\n */\nexport function hasHorizontalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n dataZoomOption?.type === 'slider' && !isVerticalSlider(dataZoomOption),\n );\n}\n\n/**\n * Vertical slider zoom needs extra right grid space for ECharts' slider\n * control.\n */\nexport function hasVerticalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n isVerticalSlider(dataZoomOption),\n );\n}\n\ntype SliderDataZoomLayout = DataZoomComponentOption & {\n bottom?: number | string;\n height?: number | string;\n orient?: 'horizontal' | 'vertical';\n right?: number | string;\n width?: number | string;\n};\n\nconst getPixelValue = (value: number | string | undefined) => {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value !== 'string' || !/^-?\\d+(?:\\.\\d+)?px$/.test(value)) {\n return undefined;\n }\n\n return Number.parseFloat(value);\n};\n\n/**\n * Reserves the area occupied by bottom-positioned horizontal slider controls.\n *\n * ECharts lays data zoom controls outside the Cartesian grid, so its automatic\n * axis outer bounds do not account for them. Normalized sliders use pixel\n * values; custom percentage-based layouts fall back to the previous 60px\n * reserve because they cannot be resolved without the rendered chart size.\n */\nexport function getSliderBottomOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (slider?.type !== 'slider' || isVerticalSlider(slider)) {\n return [];\n }\n\n const bottom = getPixelValue(slider.bottom);\n const height = getPixelValue(slider.height);\n if (bottom === undefined || height === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [bottom + height + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Reserves the area occupied by right-positioned vertical slider controls,\n * mirroring `getSliderBottomOuterBound` for horizontal ones. Normalized\n * sliders use pixel values; custom percentage-based layouts fall back to the\n * 60px reserve because they cannot be resolved without the rendered chart\n * size.\n */\nexport function getSliderRightOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (!isVerticalSlider(slider)) {\n return [];\n }\n\n const right = getPixelValue(slider?.right);\n const width = getPixelValue(slider?.width);\n if (right === undefined || width === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [right + width + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Mark area needs extra top grid space to fit inside the chart.\n */\nexport const hasMarkAreaInSeries = (series: EchartsSeries) =>\n Array.isArray(series)\n ? series.some((option) => !!option.markArea)\n : !!series.markArea;\n\n/**\n * Category x-axes use slightly wider grid padding to avoid clipped labels.\n */\nexport function hasCategoryXAxis(xAxis: EChartsOption['xAxis']): boolean {\n return Array.isArray(xAxis)\n ? xAxis.some((axis) => axis.type === 'category')\n : xAxis?.type === 'category';\n}\n\n/**\n * Builds the ECharts option object from Needle chart props and derived values.\n * Applying the option to an ECharts instance happens in `useChartOption`.\n */\nexport function buildChartOption({\n dataZoom,\n dataset,\n hasCategoryXAxis,\n legendSelected,\n propsSeries,\n series,\n thresholdLines,\n toolboxOptions,\n userOption,\n xAxis,\n yAxis,\n hasMarkArea,\n}: BuildChartOptionParams): EChartsOption {\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n const sliderBottomOuterBound = getSliderBottomOuterBound(dataZoom);\n const sliderRightOuterBound = getSliderRightOuterBound(dataZoom);\n const gridBottom = hasHorizontalSliderZoom(dataZoom) ? 60 : 10;\n const gridHorizontalInset = hasCategoryXAxis ? 15 : 10;\n const gridRight = hasVerticalSliderZoom(dataZoom) ? 60 : gridHorizontalInset;\n const gridTop = hasMarkArea ? 20 : 10;\n\n return {\n ...userOption,\n aria: {\n decal: {\n show: false,\n },\n enabled: true,\n ...(customAriaDescription !== undefined && {\n label: { description: customAriaDescription },\n }),\n ...(userOption?.aria as EChartsOption['aria']),\n },\n dataZoom,\n dataset,\n grid: {\n bottom: `${gridBottom}px`,\n left: `${gridHorizontalInset}px`,\n outerBounds: {\n bottom: sliderBottomOuterBound ?? gridBottom,\n left: gridHorizontalInset,\n right: sliderRightOuterBound ?? gridRight,\n top: gridTop,\n },\n outerBoundsContain: 'all',\n right: `${gridRight}px`,\n top: `${gridTop}px`,\n type: 'solid',\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // ECharts mutates option.legend.selected internally; callers pass a\n // copied object so the React ref remains the source of truth.\n selected: { ...legendSelected },\n show: false,\n },\n series,\n toolbox: mergeToolbox(toolboxOptions, { dataZoom, xAxis, yAxis }),\n tooltip: {\n borderRadius: 0,\n borderWidth: 0,\n confine: true,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: createAxisTooltipFormatter({ thresholdLines, userOption }),\n padding: 0,\n trigger: 'axis',\n },\n xAxis,\n yAxis,\n };\n}\n"]}
1
+ {"version":3,"file":"build-chart-option.js","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM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YAAY,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EACjE,OAAO,EAAE;YACP,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,kDAAkD;YAChE,SAAS,EAAE,0BAA0B,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;YACrE,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,MAAM;SAChB,EACD,KAAK;QACL,KAAK,IACL;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 type { DataZoomComponentOption, EChartsOption } from 'echarts';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport { createAxisTooltipFormatter } from './chart-tooltip-formatter';\nimport type { ChartProps, EchartsSeries } from './chart-types';\nimport type { NormalizedThresholdLine } from './threshold';\nimport { isVerticalSlider, mergeToolbox } from './user-option-utils';\n\nconst SLIDER_OUTER_BOUND_GAP = 8;\nconst SLIDER_OUTER_BOUND_FALLBACK = 60;\n\ntype BuildChartOptionParams = {\n dataZoom: EChartsOption['dataZoom'];\n dataset: ChartProps['dataset'];\n hasCategoryXAxis: boolean;\n legendSelected: Record<string, boolean>;\n propsSeries: ChartProps['series'];\n series: EchartsSeries;\n thresholdLines: NormalizedThresholdLine[];\n toolboxOptions: EChartsOption['toolbox'];\n userOption: ChartProps['option'];\n xAxis: EChartsOption['xAxis'];\n yAxis: EChartsOption['yAxis'];\n hasMarkArea: boolean;\n};\n\nconst toDataZoomArray = (dataZoom: EChartsOption['dataZoom']) =>\n Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n\n/**\n * Horizontal slider zoom needs extra bottom grid space for ECharts' slider\n * control.\n */\nexport function hasHorizontalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n dataZoomOption?.type === 'slider' && !isVerticalSlider(dataZoomOption),\n );\n}\n\n/**\n * Vertical slider zoom needs extra right grid space for ECharts' slider\n * control.\n */\nexport function hasVerticalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n isVerticalSlider(dataZoomOption),\n );\n}\n\ntype SliderDataZoomLayout = DataZoomComponentOption & {\n bottom?: number | string;\n height?: number | string;\n orient?: 'horizontal' | 'vertical';\n right?: number | string;\n width?: number | string;\n};\n\nconst getPixelValue = (value: number | string | undefined) => {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value !== 'string' || !/^-?\\d+(?:\\.\\d+)?px$/.test(value)) {\n return undefined;\n }\n\n return Number.parseFloat(value);\n};\n\n/**\n * Reserves the area occupied by bottom-positioned horizontal slider controls.\n *\n * ECharts lays data zoom controls outside the Cartesian grid, so its automatic\n * axis outer bounds do not account for them. Normalized sliders use pixel\n * values; custom percentage-based layouts fall back to the previous 60px\n * reserve because they cannot be resolved without the rendered chart size.\n */\nexport function getSliderBottomOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (slider?.type !== 'slider' || isVerticalSlider(slider)) {\n return [];\n }\n\n const bottom = getPixelValue(slider.bottom);\n const height = getPixelValue(slider.height);\n if (bottom === undefined || height === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [bottom + height + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Reserves the area occupied by right-positioned vertical slider controls,\n * mirroring `getSliderBottomOuterBound` for horizontal ones. Normalized\n * sliders use pixel values; custom percentage-based layouts fall back to the\n * 60px reserve because they cannot be resolved without the rendered chart\n * size.\n */\nexport function getSliderRightOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (!isVerticalSlider(slider)) {\n return [];\n }\n\n const right = getPixelValue(slider?.right);\n const width = getPixelValue(slider?.width);\n if (right === undefined || width === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [right + width + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Mark area needs extra top grid space to fit inside the chart.\n */\nexport const hasMarkAreaInSeries = (series: EchartsSeries) =>\n Array.isArray(series)\n ? series.some((option) => !!option.markArea)\n : !!series.markArea;\n\n/**\n * Category x-axes use slightly wider grid padding to avoid clipped labels.\n */\nexport function hasCategoryXAxis(xAxis: EChartsOption['xAxis']): boolean {\n return Array.isArray(xAxis)\n ? xAxis.some((axis) => axis.type === 'category')\n : xAxis?.type === 'category';\n}\n\n/**\n * Builds the ECharts option object from Needle chart props and derived values.\n * Applying the option to an ECharts instance happens in `useChartOption`.\n */\nexport function buildChartOption({\n dataZoom,\n dataset,\n hasCategoryXAxis,\n legendSelected,\n propsSeries,\n series,\n thresholdLines,\n toolboxOptions,\n userOption,\n xAxis,\n yAxis,\n hasMarkArea,\n}: BuildChartOptionParams): EChartsOption {\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n const sliderBottomOuterBound = getSliderBottomOuterBound(dataZoom);\n const sliderRightOuterBound = getSliderRightOuterBound(dataZoom);\n const gridBottom = hasHorizontalSliderZoom(dataZoom) ? 60 : 10;\n const gridHorizontalInset = hasCategoryXAxis ? 15 : 10;\n const gridRight = hasVerticalSliderZoom(dataZoom) ? 60 : gridHorizontalInset;\n const gridTop = hasMarkArea ? 20 : 10;\n\n return {\n ...userOption,\n aria: {\n decal: {\n show: false,\n },\n enabled: true,\n ...(customAriaDescription !== undefined && {\n label: { description: customAriaDescription },\n }),\n ...(userOption?.aria as EChartsOption['aria']),\n },\n dataZoom,\n dataset,\n grid: {\n bottom: `${gridBottom}px`,\n left: `${gridHorizontalInset}px`,\n outerBounds: {\n bottom: sliderBottomOuterBound ?? gridBottom,\n left: gridHorizontalInset,\n right: sliderRightOuterBound ?? gridRight,\n top: gridTop,\n },\n outerBoundsContain: 'all',\n right: `${gridRight}px`,\n top: `${gridTop}px`,\n type: 'solid',\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // ECharts mutates option.legend.selected internally; callers pass a\n // copied object so the React ref remains the source of truth.\n selected: { ...legendSelected },\n show: false,\n },\n series,\n toolbox: mergeToolbox(toolboxOptions, { dataZoom, xAxis, yAxis }),\n tooltip: {\n borderRadius: 0,\n borderWidth: 0,\n confine: true,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: createAxisTooltipFormatter({ thresholdLines, userOption }),\n padding: 0,\n trigger: 'axis',\n },\n xAxis,\n yAxis,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"chart-tooltip-formatter.js","sourceRoot":"","sources":["../../../../src/charts/utils/chart-tooltip-formatter.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAg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,iBAAiB,EAAE,MAAM,CAAC,KAAK,EAC/B,aAAa,EAAE,aAAa,IAVvB,MAAM,CAAC,UAAU,CAWtB,CACH,CAAC;gBACJ,CAAC,CAAC,IACG,CACR,EAAE,CAAC;IACN,CAAC,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 type React from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { ChartTooltip } from '../ChartTooltip';\nimport type { ChartProps } from './chart-types';\nimport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n} from './format-utils';\nimport { evaluateThresholdCondition } from './threshold';\nimport {\n getThresholdLineDisplayName,\n isThresholdLine,\n type NormalizedThresholdLine,\n} from './threshold';\n\ntype TooltipValueFormatter = (value: unknown) => React.ReactNode;\n\nexport function getTooltipValueFormatter(\n userOption: ChartProps['option'],\n): TooltipValueFormatter {\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n return userOption.tooltip.valueFormatter as TooltipValueFormatter;\n }\n\n return formatNumberEnUS as TooltipValueFormatter;\n}\n\ntype CreateAxisTooltipFormatterParams = {\n thresholdLines: NormalizedThresholdLine[];\n userOption: ChartProps['option'];\n};\n\n/**\n * Builds the ECharts axis-tooltip formatter used by line-like charts.\n * It renders Needle tooltip markup and augments non-threshold series with\n * threshold notifications when their current value crosses a threshold line.\n */\nexport function createAxisTooltipFormatter({\n thresholdLines,\n userOption,\n}: CreateAxisTooltipFormatterParams) {\n const valueFormatter = getTooltipValueFormatter(userOption);\n\n return function axisTooltipFormatter(params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue = typeof value === 'number' ? value : Number(value);\n\n const isSeriesThresholdLine = isThresholdLine(series.seriesName);\n\n const notifications = thresholdLines.flatMap((threshold) => {\n if (isSeriesThresholdLine || Number.isNaN(seriesValue)) {\n return [];\n }\n\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n const conditionEvaluation = customCondition\n ? {\n conditionText: customConditionText,\n isConditionMet: customCondition(seriesValue, thresholdValue),\n }\n : evaluateThresholdCondition(\n seriesValue,\n condition,\n thresholdValue,\n );\n\n if (!conditionEvaluation.isConditionMet) {\n return [];\n }\n\n return [\n {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? conditionEvaluation.conditionText\n : `${conditionEvaluation.conditionText} threshold`,\n notificationType,\n trailingElement: valueFormatter(thresholdValue),\n },\n ];\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isSeriesThresholdLine\n ? `${capitalizeFirstLetter(\n getThresholdLineDisplayName(series.seriesName),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n };\n}\n"]}
1
+ {"version":3,"file":"chart-tooltip-formatter.js","sourceRoot":"","sources":["../../../../src/charts/utils/chart-tooltip-formatter.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,cAAc,EAAE,MAA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MAAM,CAAC,UAAU,CAAC,CAC/C,YAAY;4BACf,CAAC,CAAC,MAAM,CAAC,UAAU,EAEvB,eAAe,EAAE,cAAc,CAAC,KAAK,CAAC,EACtC,iBAAiB,EAAE,MAAM,CAAC,KAAK,EAC/B,aAAa,EAAE,aAAa,IAVvB,MAAM,CAAC,UAAU,CAWtB,CACH,CAAC;gBACJ,CAAC,CAAC,IACG,CACR,EAAE,CAAC;IACN,CAAC,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 type React from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { ChartTooltip } from '../ChartTooltip';\nimport type { ChartProps } from './chart-types';\nimport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n} from './format-utils';\nimport { evaluateThresholdCondition } from './threshold';\nimport {\n getThresholdLineDisplayName,\n isThresholdLine,\n type NormalizedThresholdLine,\n} from './threshold';\n\ntype TooltipValueFormatter = (value: unknown) => React.ReactNode;\n\nexport function getTooltipValueFormatter(\n userOption: ChartProps['option'],\n): TooltipValueFormatter {\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n return userOption.tooltip.valueFormatter as TooltipValueFormatter;\n }\n\n return formatNumberEnUS as TooltipValueFormatter;\n}\n\ntype CreateAxisTooltipFormatterParams = {\n thresholdLines: NormalizedThresholdLine[];\n userOption: ChartProps['option'];\n};\n\n/**\n * Builds the ECharts axis-tooltip formatter used by line-like charts.\n * It renders Needle tooltip markup and augments non-threshold series with\n * threshold notifications when their current value crosses a threshold line.\n */\nexport function createAxisTooltipFormatter({\n thresholdLines,\n userOption,\n}: CreateAxisTooltipFormatterParams) {\n const valueFormatter = getTooltipValueFormatter(userOption);\n\n return function axisTooltipFormatter(params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue = typeof value === 'number' ? value : Number(value);\n\n const isSeriesThresholdLine = isThresholdLine(series.seriesName);\n\n const notifications = thresholdLines.flatMap((threshold) => {\n if (isSeriesThresholdLine || Number.isNaN(seriesValue)) {\n return [];\n }\n\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n const conditionEvaluation = customCondition\n ? {\n conditionText: customConditionText,\n isConditionMet: customCondition(seriesValue, thresholdValue),\n }\n : evaluateThresholdCondition(\n seriesValue,\n condition,\n thresholdValue,\n );\n\n if (!conditionEvaluation.isConditionMet) {\n return [];\n }\n\n return [\n {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? conditionEvaluation.conditionText\n : `${conditionEvaluation.conditionText} threshold`,\n notificationType,\n trailingElement: valueFormatter(thresholdValue),\n },\n ];\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isSeriesThresholdLine\n ? `${capitalizeFirstLetter(\n getThresholdLineDisplayName(series.seriesName),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../../src/charts/utils/chart-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","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 {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type HexColor = `#${string}`;\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n show?: boolean;\n // TODO v5: remove this prop\n /** @deprecated No longer has any effect since wrapping is now automatic, will be removed in v 5 */\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /**\n * Settings for how ECharts should update the chart. Defaults to replacing the\n * components the chart owns (`series`, `dataset`, axes, and similar) while\n * merging the rest, which drops data that disappeared without discarding the\n * ECharts components behind zoom interactions. Passing `notMerge: true`\n * re-creates those components on every update and breaks drag-to-zoom.\n */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n /** Custom color palette that overrides the default categorical colors. */\n palette?: HexColor[];\n}\n\nexport interface ChartEmptyProps {\n /** A text displayed to the user when the chart is empty. */\n message?: React.ReactNode;\n /** The type of chart. This is used to render the appropriate icon. */\n type?: 'line' | 'pie' | 'bar';\n /** Optional element (preferably a TextButton) that should provide the user with an action. */\n action?: React.ReactNode;\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n selected?: boolean;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n series: {\n name: string;\n color: string;\n }[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport type HtmlAttributes<T extends React.ElementType> =\n React.ComponentPropsWithoutRef<T> & {\n [key: `data-${string}`]: string | undefined;\n };\n\ntype BaseProps<T extends React.ElementType> = {\n /**\n * Additional classnames will be applied to the root element.\n */\n className?: string;\n /**\n * Additional css styling. Will be applied to the root element.\n */\n style?: React.CSSProperties;\n\n /**\n * Html attributes to apply to the root element. This will override any default html attributes, use with caution.\n */\n htmlAttributes?: HtmlAttributes<T>;\n\n /**\n * A ref to apply to the root element.\n */\n ref?: React.ComponentPropsWithRef<T>['ref'];\n};\n\nexport type CommonProps<T extends React.ElementType, P> = P & BaseProps<T>;\n"]}
1
+ {"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../../src/charts/utils/chart-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","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 {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type HexColor = `#${string}`;\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n show?: boolean;\n // TODO v5: remove this prop\n /** @deprecated No longer has any effect since wrapping is now automatic, will be removed in v 5 */\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /**\n * Settings for how ECharts should update the chart. Defaults to replacing the\n * components the chart owns (`series`, `dataset`, axes, and similar) while\n * merging the rest, which drops data that disappeared without discarding the\n * ECharts components behind zoom interactions. Passing `notMerge: true`\n * re-creates those components on every update and breaks drag-to-zoom.\n */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n /** Custom color palette that overrides the default categorical colors. */\n palette?: HexColor[];\n}\n\nexport interface ChartEmptyProps {\n /** A text displayed to the user when the chart is empty. */\n message?: React.ReactNode;\n /** The type of chart. This is used to render the appropriate icon. */\n type?: 'line' | 'pie' | 'bar';\n /** Optional element (preferably a TextButton) that should provide the user with an action. */\n action?: React.ReactNode;\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n selected?: boolean;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n series: {\n name: string;\n color: string;\n }[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport type HtmlAttributes<T extends React.ElementType> =\n React.ComponentPropsWithoutRef<T> & {\n [key: `data-${string}`]: string | undefined;\n };\n\ntype BaseProps<T extends React.ElementType> = {\n /**\n * Additional classnames will be applied to the root element.\n */\n className?: string;\n /**\n * Additional css styling. Will be applied to the root element.\n */\n style?: React.CSSProperties;\n\n /**\n * Html attributes to apply to the root element. This will override any default html attributes, use with caution.\n */\n htmlAttributes?: HtmlAttributes<T>;\n\n /**\n * A ref to apply to the root element.\n */\n ref?: React.ComponentPropsWithRef<T>['ref'];\n};\n\nexport type CommonProps<T extends React.ElementType, P> = P & BaseProps<T>;\n"]}
@@ -1,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../src/charts/utils/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,gCAAgC,GAElC;IACF,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;CACR,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAwC;IAChE,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,qBAAqB;IACnC,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,qBAAqB,GACtB,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 { ChartProps, Condition } from './chart-types';\n\nconst defaultThresholdLineSeriesOption: {\n condition: Condition;\n} = {\n condition: 'greater',\n};\n\n/**\n * ECharts component main types that `buildChartOption` always writes in full,\n * so replacing them gives the same \"drop what disappeared\" behavior as\n * `notMerge`. Every entry has to be a registered component main type, which is\n * only asserted by ECharts in development builds.\n *\n * `toolbox` is deliberately absent: it has to keep its view instance across\n * updates, see `defaultChartSettings`.\n */\nconst needleOwnedComponents = [\n 'dataZoom',\n 'dataset',\n 'grid',\n 'legend',\n 'series',\n 'tooltip',\n 'xAxis',\n 'yAxis',\n];\n\n/**\n * `notMerge` rebuilds every component view on each `setOption`. That makes\n * ECharts mount a fresh toolbox brush controller while the previous one stays\n * attached to the renderer, because `ToolboxView.dispose` iterates its feature\n * map with `zrUtil.each` and so never disposes anything. Every leftover\n * controller then re-applies the same drag, each time against an axis the\n * previous one already zoomed, which shrinks the selected range.\n */\nconst defaultChartSettings: NonNullable<ChartProps['settings']> = {\n lazyUpdate: false,\n notMerge: false,\n replaceMerge: needleOwnedComponents,\n silent: false,\n};\n\nexport {\n defaultChartSettings,\n defaultThresholdLineSeriesOption,\n needleOwnedComponents,\n};\n"]}
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../src/charts/utils/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,gCAAgC,GAElC;IACF,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;CACR,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAwC;IAChE,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,qBAAqB;IACnC,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,qBAAqB,GACtB,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 { ChartProps, Condition } from './chart-types';\n\nconst defaultThresholdLineSeriesOption: {\n condition: Condition;\n} = {\n condition: 'greater',\n};\n\n/**\n * ECharts component main types that `buildChartOption` always writes in full,\n * so replacing them gives the same \"drop what disappeared\" behavior as\n * `notMerge`. Every entry has to be a registered component main type, which is\n * only asserted by ECharts in development builds.\n *\n * `toolbox` is deliberately absent: it has to keep its view instance across\n * updates, see `defaultChartSettings`.\n */\nconst needleOwnedComponents = [\n 'dataZoom',\n 'dataset',\n 'grid',\n 'legend',\n 'series',\n 'tooltip',\n 'xAxis',\n 'yAxis',\n];\n\n/**\n * `notMerge` rebuilds every component view on each `setOption`. That makes\n * ECharts mount a fresh toolbox brush controller while the previous one stays\n * attached to the renderer, because `ToolboxView.dispose` iterates its feature\n * map with `zrUtil.each` and so never disposes anything. Every leftover\n * controller then re-applies the same drag, each time against an axis the\n * previous one already zoomed, which shrinks the selected range.\n */\nconst defaultChartSettings: NonNullable<ChartProps['settings']> = {\n lazyUpdate: false,\n notMerge: false,\n replaceMerge: needleOwnedComponents,\n silent: false,\n};\n\nexport {\n defaultChartSettings,\n defaultThresholdLineSeriesOption,\n needleOwnedComponents,\n};\n"]}
@@ -1,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]
@@ -1 +1 @@
1
- {"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/format-utils.ts"],"names":[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;QACtB,CAAC,CAAC,iBAAiB,CAAC;IAEtB,OAAO,MAAA,KAAK,CAAC,cAAc,CAAC,mCAAI,KAAK,CAAC;AACxC,CAAC,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,GACjB,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\nconst capitalizeFirstLetter = (str: string) => {\n if (!str) {\n return str;\n }\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nconst enUSNumberFormatter = new Intl.NumberFormat('en-US');\n\n/**\n * Formats finite number values with en-US separators and returns all other\n * values unchanged.\n */\nconst formatNumberEnUS = <T>(value: T): string | T => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;\n }\n\n return value;\n};\n\n/**\n * Extract the tooltip value from the series depending on the axisDim and encode properties\n * If the value is a single value, return it as it is\n * If the encode property does not exist fallback to 1\n */\nconst extractValueFromTooltipSeries = (\n value: string | number | (number | string)[],\n encode: {\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 x: number | number[];\n // oxlint-disable-next-line id-length\n y: number | number[];\n },\n // We currently only support x and y axes\n axisDim: 'x' | 'y' | 'angle' | 'radius' | 'single' = 'x',\n) => {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // The axisDim is the axis that the tooltip was triggered on,\n // if it was triggered on the x axis the value should be read from the y axis and vice versa\n const encodeValueToRead = axisDim === 'x' ? encode?.y : (encode?.x ?? 1);\n\n const seriesValueIdx = Array.isArray(encodeValueToRead)\n ? encodeValueToRead[0]\n : encodeValueToRead;\n\n return value[seriesValueIdx] ?? value;\n};\n\nexport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n};\n"]}
1
+ {"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/format-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC5C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAI,KAAQ,EAAc,EAAE;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CACpC,KAA4C,EAC5C,MAMC;AACD,yCAAyC;AACzC,UAAqD,GAAG,EACxD,EAAE;;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6DAA6D;IAC7D,4FAA4F;IAC5F,MAAM,iBAAiB,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,CAAC,mCAAI,CAAC,CAAC,CAAC;IAEzE,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACrD,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACtB,CAAC,CAAC,iBAAiB,CAAC;IAEtB,OAAO,MAAA,KAAK,CAAC,cAAc,CAAC,mCAAI,KAAK,CAAC;AACxC,CAAC,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,GACjB,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\nconst capitalizeFirstLetter = (str: string) => {\n if (!str) {\n return str;\n }\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nconst enUSNumberFormatter = new Intl.NumberFormat('en-US');\n\n/**\n * Formats finite number values with en-US separators and returns all other\n * values unchanged.\n */\nconst formatNumberEnUS = <T>(value: T): string | T => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;\n }\n\n return value;\n};\n\n/**\n * Extract the tooltip value from the series depending on the axisDim and encode properties\n * If the value is a single value, return it as it is\n * If the encode property does not exist fallback to 1\n */\nconst extractValueFromTooltipSeries = (\n value: string | number | (number | string)[],\n encode: {\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 x: number | number[];\n // oxlint-disable-next-line id-length\n y: number | number[];\n },\n // We currently only support x and y axes\n axisDim: 'x' | 'y' | 'angle' | 'radius' | 'single' = 'x',\n) => {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // The axisDim is the axis that the tooltip was triggered on,\n // if it was triggered on the x axis the value should be read from the y axis and vice versa\n const encodeValueToRead = axisDim === 'x' ? encode?.y : (encode?.x ?? 1);\n\n const seriesValueIdx = Array.isArray(encodeValueToRead)\n ? encodeValueToRead[0]\n : encodeValueToRead;\n\n return value[seriesValueIdx] ?? value;\n};\n\nexport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n};\n"]}
@@ -1,4 +1,4 @@
1
- /**
1
+ /*!
2
2
  *
3
3
  * Copyright (c) "Neo4j"
4
4
  * Neo4j Sweden AB [http://neo4j.com]