@neo4j-ndl/react-charts 1.0.54 → 1.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/charts/Chart.js +18 -18
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/Legend.js +1 -1
- package/lib/cjs/charts/Legend.js.map +1 -1
- package/lib/cjs/charts/legend-utils.js +2 -2
- package/lib/cjs/charts/legend-utils.js.map +1 -1
- package/lib/cjs/charts/tests/chart-test-utils.js +18 -18
- package/lib/cjs/charts/tests/chart-test-utils.js.map +1 -1
- package/lib/cjs/charts/themes/ndl-echarts-theme.js +41 -41
- package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/cjs/charts/user-option-utils.js +3 -3
- package/lib/cjs/charts/user-option-utils.js.map +1 -1
- package/lib/cjs/charts/utils.js +2 -2
- package/lib/cjs/charts/utils.js.map +1 -1
- package/lib/esm/charts/Chart.js +18 -18
- package/lib/esm/charts/Chart.js.map +1 -1
- package/lib/esm/charts/Legend.js +1 -1
- package/lib/esm/charts/Legend.js.map +1 -1
- package/lib/esm/charts/legend-utils.js +2 -2
- package/lib/esm/charts/legend-utils.js.map +1 -1
- package/lib/esm/charts/tests/chart-test-utils.js +18 -18
- package/lib/esm/charts/tests/chart-test-utils.js.map +1 -1
- package/lib/esm/charts/themes/ndl-echarts-theme.js +41 -41
- package/lib/esm/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/esm/charts/user-option-utils.js +3 -3
- package/lib/esm/charts/user-option-utils.js.map +1 -1
- package/lib/esm/charts/utils.js +2 -2
- package/lib/esm/charts/utils.js.map +1 -1
- package/lib/types/charts/tests/chart-test-utils.d.ts +11 -11
- package/lib/types/charts/themes/ndl-echarts-theme.d.ts +63 -63
- package/package.json +3 -3
|
@@ -49,6 +49,9 @@ const convertHexToRGB = (hex) => {
|
|
|
49
49
|
};
|
|
50
50
|
exports.chartColorsAfterHighlighting = {
|
|
51
51
|
1: 'rgb(93,207,216)',
|
|
52
|
+
10: 'rgb(210,126,49)',
|
|
53
|
+
11: 'rgb(78,151,121)',
|
|
54
|
+
12: 'rgb(190,255,117)',
|
|
52
55
|
2: 'rgb(84,80,223)',
|
|
53
56
|
3: 'rgb(242,152,62)',
|
|
54
57
|
4: 'rgb(221,75,155)',
|
|
@@ -57,9 +60,6 @@ exports.chartColorsAfterHighlighting = {
|
|
|
57
60
|
7: 'rgb(69,140,249)',
|
|
58
61
|
8: 'rgb(113,69,188)',
|
|
59
62
|
9: 'rgb(240,210,70)',
|
|
60
|
-
10: 'rgb(210,126,49)',
|
|
61
|
-
11: 'rgb(78,151,121)',
|
|
62
|
-
12: 'rgb(190,255,117)',
|
|
63
63
|
};
|
|
64
64
|
exports.multiSeriesChartProps = {
|
|
65
65
|
dataset: {
|
|
@@ -72,49 +72,49 @@ exports.multiSeriesChartProps = {
|
|
|
72
72
|
['Friday', 40, 60, 80, 100, 120, 140],
|
|
73
73
|
],
|
|
74
74
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
yAxis: {
|
|
79
|
-
type: 'value',
|
|
75
|
+
legend: {
|
|
76
|
+
show: true,
|
|
77
|
+
wrappingType: 'wrapping',
|
|
80
78
|
},
|
|
79
|
+
option: {},
|
|
81
80
|
series: [
|
|
82
81
|
{
|
|
82
|
+
encode: { x: 'day', y: 'first' },
|
|
83
83
|
name: 'First Series',
|
|
84
84
|
type: 'line',
|
|
85
|
-
encode: { x: 'day', y: 'first' },
|
|
86
85
|
},
|
|
87
86
|
{
|
|
87
|
+
encode: { x: 'day', y: 'second' },
|
|
88
88
|
name: 'Second Series',
|
|
89
89
|
type: 'line',
|
|
90
|
-
encode: { x: 'day', y: 'second' },
|
|
91
90
|
},
|
|
92
91
|
{
|
|
92
|
+
encode: { x: 'day', y: 'third' },
|
|
93
93
|
name: 'Third Series',
|
|
94
94
|
type: 'line',
|
|
95
|
-
encode: { x: 'day', y: 'third' },
|
|
96
95
|
},
|
|
97
96
|
{
|
|
97
|
+
encode: { x: 'day', y: 'fourth' },
|
|
98
98
|
name: 'Fourth Series',
|
|
99
99
|
type: 'line',
|
|
100
|
-
encode: { x: 'day', y: 'fourth' },
|
|
101
100
|
},
|
|
102
101
|
{
|
|
102
|
+
encode: { x: 'day', y: 'fifth' },
|
|
103
103
|
name: 'Fifth Series',
|
|
104
104
|
type: 'line',
|
|
105
|
-
encode: { x: 'day', y: 'fifth' },
|
|
106
105
|
},
|
|
107
106
|
{
|
|
107
|
+
encode: { x: 'day', y: 'sixth' },
|
|
108
108
|
name: 'Sixth Series',
|
|
109
109
|
type: 'line',
|
|
110
|
-
encode: { x: 'day', y: 'sixth' },
|
|
111
110
|
},
|
|
112
111
|
],
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
xAxis: {
|
|
113
|
+
type: 'category',
|
|
114
|
+
},
|
|
115
|
+
yAxis: {
|
|
116
|
+
type: 'value',
|
|
116
117
|
},
|
|
117
|
-
option: {},
|
|
118
118
|
};
|
|
119
119
|
const multiSeriesChart = ({ chartProps, width = '100%', height = '400px', }) => ((0, jsx_runtime_1.jsx)("div", { style: { height, width }, className: "ndl-chart", children: (0, jsx_runtime_1.jsx)(react_charts_1.Chart, Object.assign({}, exports.multiSeriesChartProps, chartProps)) }));
|
|
120
120
|
exports.multiSeriesChart = multiSeriesChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,0DAAgD;AAChD,6EAA2D;AAI3D;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;IACtC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE5B,MAAM,GAA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EAAE,CAAC;IAC/D,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC;AAHW,QAAA,WAAW,eAGtB","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\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 hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.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 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 xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n series: [\n {\n name: 'First Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'first' },\n },\n {\n name: 'Second Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'second' },\n },\n {\n name: 'Third Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'third' },\n },\n {\n name: 'Fourth Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'fourth' },\n },\n {\n name: 'Fifth Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'fifth' },\n },\n {\n name: 'Sixth Series',\n type: 'line' as const,\n encode: { x: 'day', y: 'sixth' },\n },\n ],\n legend: {\n show: true,\n wrappingType: 'wrapping' as const,\n },\n option: {},\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 expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg')).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nconst SELECTORS = {\n CHECKMARK: '.ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `[data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `[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 for a path with the series color (lacks other unique identifiers)\n * Apache Echarts displays the path color in both hex, rgb and a slightly adjusted rgb when highlighted, therefor we need to check for all three when looking for the series in the chart.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n // Check so that the series that should be visible are present in the chart\n for (const name of seriesNamesToBeVisible) {\n const visibleSeriesIndex =\n allChartSeries.findIndex((series) => series.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[visibleSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n visibleSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n 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 ).toBeVisible({ timeout: 10000 });\n }\n\n // Check so that the other series are not present in the chart\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenSeriesIndex =\n allChartSeries.findIndex(\n (allChartSeriesItem) =>\n hiddenSeriesItem.name === allChartSeriesItem.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[hiddenSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n hiddenSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n 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 ).not.toBeVisible();\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.locator(`[data-labelname=\"${seriesName}\"]`).click();\n await page.hover('.ndl-chart');\n};\n"]}
|
|
1
|
+
{"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,0DAAgD;AAChD,6EAA2D;AAI3D;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;IACtC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CA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,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC;AAHW,QAAA,WAAW,eAGtB","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\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 hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.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 10: 'rgb(210,126,49)',\n 11: 'rgb(78,151,121)',\n 12: 'rgb(190,255,117)',\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};\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 wrappingType: 'wrapping' as const,\n },\n option: {},\n series: [\n {\n encode: { x: 'day', y: 'first' },\n name: 'First Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'second' },\n name: 'Second Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'third' },\n name: 'Third Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fourth' },\n name: 'Fourth Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fifth' },\n name: 'Fifth Series',\n type: 'line' as const,\n },\n {\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 expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg')).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nconst SELECTORS = {\n CHECKMARK: '.ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `[data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `[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 for a path with the series color (lacks other unique identifiers)\n * Apache Echarts displays the path color in both hex, rgb and a slightly adjusted rgb when highlighted, therefor we need to check for all three when looking for the series in the chart.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n // Check so that the series that should be visible are present in the chart\n for (const name of seriesNamesToBeVisible) {\n const visibleSeriesIndex =\n allChartSeries.findIndex((series) => series.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[visibleSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n visibleSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n 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 ).toBeVisible({ timeout: 10000 });\n }\n\n // Check so that the other series are not present in the chart\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenSeriesIndex =\n allChartSeries.findIndex(\n (allChartSeriesItem) =>\n hiddenSeriesItem.name === allChartSeriesItem.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[hiddenSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n hiddenSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n 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 ).not.toBeVisible();\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.locator(`[data-labelname=\"${seriesName}\"]`).click();\n await page.hover('.ndl-chart');\n};\n"]}
|
|
@@ -23,11 +23,16 @@ exports.ndlEchartsTheme = void 0;
|
|
|
23
23
|
*/
|
|
24
24
|
const base_1 = require("@neo4j-ndl/base");
|
|
25
25
|
const axisCommon = (theme) => ({
|
|
26
|
+
axisLabel: {
|
|
27
|
+
color: base_1.tokens.theme[theme].color.neutral.text.weaker,
|
|
28
|
+
fontFamily: base_1.tokens.typography['body-small'].fontFamily,
|
|
29
|
+
fontSize: base_1.tokens.typography['body-small'].fontSize,
|
|
30
|
+
},
|
|
26
31
|
axisLine: {
|
|
27
32
|
lineStyle: {
|
|
33
|
+
cap: 'square',
|
|
28
34
|
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
29
35
|
width: 2,
|
|
30
|
-
cap: 'square',
|
|
31
36
|
},
|
|
32
37
|
},
|
|
33
38
|
axisTick: {
|
|
@@ -38,12 +43,7 @@ const axisCommon = (theme) => ({
|
|
|
38
43
|
},
|
|
39
44
|
show: true,
|
|
40
45
|
},
|
|
41
|
-
|
|
42
|
-
fontFamily: base_1.tokens.typography['body-small'].fontFamily,
|
|
43
|
-
fontSize: base_1.tokens.typography['body-small'].fontSize,
|
|
44
|
-
color: base_1.tokens.theme[theme].color.neutral.text.weaker,
|
|
45
|
-
},
|
|
46
|
-
splitLine: {
|
|
46
|
+
minorSplitLine: {
|
|
47
47
|
lineStyle: {
|
|
48
48
|
color: base_1.tokens.theme[theme].color.neutral.border.weak,
|
|
49
49
|
},
|
|
@@ -53,7 +53,7 @@ const axisCommon = (theme) => ({
|
|
|
53
53
|
color: [base_1.tokens.theme[theme].color.neutral.hover, 'transparent'],
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
splitLine: {
|
|
57
57
|
lineStyle: {
|
|
58
58
|
color: base_1.tokens.theme[theme].color.neutral.border.weak,
|
|
59
59
|
},
|
|
@@ -65,15 +65,15 @@ const ndlEchartsTheme = (theme) => {
|
|
|
65
65
|
color: Object.values(base_1.tokens.categorical),
|
|
66
66
|
backgroundColor: 'transparent',
|
|
67
67
|
axisPointer: {
|
|
68
|
-
lineStyle: {
|
|
69
|
-
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
70
|
-
},
|
|
71
68
|
crossStyle: {
|
|
72
69
|
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
73
70
|
},
|
|
74
71
|
label: {
|
|
75
72
|
color: base_1.tokens.theme[theme].color.neutral.text.weaker,
|
|
76
73
|
},
|
|
74
|
+
lineStyle: {
|
|
75
|
+
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
76
|
+
},
|
|
77
77
|
},
|
|
78
78
|
// We use a custom legend so this does not affect anything
|
|
79
79
|
legend: {},
|
|
@@ -84,26 +84,9 @@ const ndlEchartsTheme = (theme) => {
|
|
|
84
84
|
title: {},
|
|
85
85
|
toolbox: {},
|
|
86
86
|
dataZoom: {
|
|
87
|
-
borderColor: base_1.tokens.theme[theme].color.neutral.border.weak,
|
|
88
87
|
backgroundColor: 'transparent',
|
|
89
|
-
|
|
88
|
+
borderColor: base_1.tokens.theme[theme].color.neutral.border.weak,
|
|
90
89
|
borderRadius: parseInt(base_1.tokens.borderRadius.sm.replace('px', '')),
|
|
91
|
-
textStyle: {
|
|
92
|
-
color: base_1.tokens.theme[theme].color.neutral.text.weaker,
|
|
93
|
-
},
|
|
94
|
-
handleStyle: {
|
|
95
|
-
color: base_1.tokens.theme[theme].color.neutral.bg.weak,
|
|
96
|
-
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
97
|
-
// borderRadius: 0, // Doesn't work
|
|
98
|
-
},
|
|
99
|
-
handleSize: '80%',
|
|
100
|
-
handleIcon: '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',
|
|
101
|
-
moveHandleSize: 6,
|
|
102
|
-
moveHandleStyle: {
|
|
103
|
-
color: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
104
|
-
backgroundColor: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
105
|
-
opacity: 1, // 0.3,
|
|
106
|
-
},
|
|
107
90
|
dataBackground: {
|
|
108
91
|
areaStyle: {
|
|
109
92
|
color: base_1.tokens.theme[theme].color.neutral.bg.default,
|
|
@@ -115,6 +98,33 @@ const ndlEchartsTheme = (theme) => {
|
|
|
115
98
|
width: 1,
|
|
116
99
|
},
|
|
117
100
|
},
|
|
101
|
+
emphasis: {
|
|
102
|
+
handleLabel: {},
|
|
103
|
+
handleStyle: {
|
|
104
|
+
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
105
|
+
color: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
106
|
+
opacity: 1,
|
|
107
|
+
},
|
|
108
|
+
moveHandleStyle: {
|
|
109
|
+
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
110
|
+
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
111
|
+
opacity: 1,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
fillerColor: `rgb( from ${base_1.tokens.theme[theme].color.neutral.hover} r g b / 0.1)`,
|
|
115
|
+
handleIcon: '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',
|
|
116
|
+
handleSize: '80%',
|
|
117
|
+
handleStyle: {
|
|
118
|
+
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
119
|
+
color: base_1.tokens.theme[theme].color.neutral.bg.weak,
|
|
120
|
+
// borderRadius: 0, // Doesn't work
|
|
121
|
+
},
|
|
122
|
+
moveHandleSize: 6,
|
|
123
|
+
moveHandleStyle: {
|
|
124
|
+
backgroundColor: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
125
|
+
color: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
126
|
+
opacity: 1, // 0.3,
|
|
127
|
+
},
|
|
118
128
|
selectedDataBackground: {
|
|
119
129
|
areaStyle: {
|
|
120
130
|
color: base_1.tokens.theme[theme].color.neutral.bg['on-bg-weak'],
|
|
@@ -127,18 +137,8 @@ const ndlEchartsTheme = (theme) => {
|
|
|
127
137
|
width: 1,
|
|
128
138
|
},
|
|
129
139
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
color: base_1.tokens.theme[theme].color.neutral.bg.strong,
|
|
133
|
-
opacity: 1,
|
|
134
|
-
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
135
|
-
},
|
|
136
|
-
moveHandleStyle: {
|
|
137
|
-
color: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
138
|
-
opacity: 1,
|
|
139
|
-
borderColor: base_1.tokens.theme[theme].color.neutral.border.strong,
|
|
140
|
-
},
|
|
141
|
-
handleLabel: {},
|
|
140
|
+
textStyle: {
|
|
141
|
+
color: base_1.tokens.theme[theme].color.neutral.text.weaker,
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
// Not implemented
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;AAEzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,
|
|
1
|
+
{"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;AAEzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE;QACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACpD,UAAU,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;QACtD,QAAQ,EAAE,aAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ;KACnD;IACD,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;YACtD,KAAK,EAAE,CAAC;SACT;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC;QACT,SAAS,EAAE;YACT,KAAK,EAAE,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAA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K,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;AA1GW,QAAA,eAAe,mBA0G1B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from '@neo4j-ndl/base';\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 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 = (theme: 'light' | 'dark') => {\n return {\n darkMode: theme === 'dark',\n color: 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"]}
|
|
@@ -76,8 +76,8 @@ const mergeSeries = (series, theme = 'light', userOption) => {
|
|
|
76
76
|
}
|
|
77
77
|
if (option.type === 'bar') {
|
|
78
78
|
return Object.assign(Object.assign({ barMaxWidth: 16 }, option), { blur: Object.assign({ itemStyle: Object.assign({ opacity: 0.3 }, (_e = option.blur) === null || _e === void 0 ? void 0 : _e.itemStyle) }, option.blur), emphasis: Object.assign({ disabled: true, focus: 'series' }, option.emphasis), itemStyle: Object.assign({ color, borderWidth: 20 }, option.itemStyle), markLine: {
|
|
79
|
-
lineStyle: Object.assign({ width: 20 }, (_f = option.markLine) === null || _f === void 0 ? void 0 : _f.lineStyle),
|
|
80
|
-
|
|
79
|
+
emphasis: Object.assign({ disabled: true, lineStyle: Object.assign({ width: 20 }, (_g = (_f = option.markLine) === null || _f === void 0 ? void 0 : _f.emphasis) === null || _g === void 0 ? void 0 : _g.lineStyle) }, (_h = option.markLine) === null || _h === void 0 ? void 0 : _h.emphasis),
|
|
80
|
+
lineStyle: Object.assign({ width: 20 }, (_j = option.markLine) === null || _j === void 0 ? void 0 : _j.lineStyle),
|
|
81
81
|
}, tooltip: Object.assign({ trigger: 'axis', confine: true,
|
|
82
82
|
// Reset the default tooltip css styling
|
|
83
83
|
padding: 0, borderRadius: 0, borderWidth: 0, extraCssText: 'box-shadow: none; background-color: transparent;', formatter: function (params) {
|
|
@@ -182,8 +182,8 @@ const mergeToolbox = (toolbox) => {
|
|
|
182
182
|
dataZoom: Object.assign(Object.assign({ yAxisIndex: false }, (_a = toolbox === null || toolbox === void 0 ? void 0 : toolbox.feature) === null || _a === void 0 ? void 0 : _a.dataZoom), { show: true, icon: {
|
|
183
183
|
// This hack removes the icons.
|
|
184
184
|
// Due to: https://github.com/apache/echarts/issues/10274
|
|
185
|
-
zoom: '-',
|
|
186
185
|
back: '-',
|
|
186
|
+
zoom: '-',
|
|
187
187
|
} }),
|
|
188
188
|
},
|
|
189
189
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AAEzC,6CAAkD;AAElD,mCAKiB;AACjB,iDAA8C;AAE9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,WAAW,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG,CACzB,MAAoB,EACpB,QAA0B,OAAO,EACjC,UAGC,EACc,EAAE;IACjB,OAAO,MAAM,CAAC,GAAG,CACf,CACE,MAGuC,EACvC,QAAgB,CAAC,EACH,EAAE;;QAChB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YACvC,CAAC,CAAC,MAAM,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,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,IAAA,oBAAY,EAAC,MAAM,CAAC,CACO,CAAC;IAChC,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,gCACN,UAAU,EAAE,KAAK,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB","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 { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n defaultThresholdLineSeriesOption,\n type EchartsSeries,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './Chart';\nimport { ChartTooltip } from './ChartTooltip';\n\nconst colors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n): EchartsSeries => {\n return series.map(\n (\n option:\n | SeriesOption\n | ThresholdLineSeriesOption<'warning'>\n | ThresholdLineSeriesOption<'danger'>,\n index: number = 0,\n ): SeriesOption => {\n if (option === undefined) {\n return {};\n }\n\n const color = Array.isArray(option.color)\n ? option.color[index]\n : (option.color ?? colors[index]);\n\n if (option.type === 'thresholdLine') {\n const { notificationType } = option;\n // Needed to differentiate between normal lines and threshold lines\n // as we are unable to inject custom properties into echarts series lines.\n const thresholdLineName = `thresholdLine-${notificationType}`;\n return {\n symbolSize: 9,\n symbol: 'none',\n condition: defaultThresholdLineSeriesOption.condition,\n ...option,\n lineStyle: {\n width: 2,\n type: 'dashed',\n ...option.lineStyle,\n },\n name: thresholdLineName,\n type: 'line',\n data: [\n [option.xAxis[0], option.yAxis],\n [option.xAxis[1], option.yAxis],\n ],\n };\n }\n\n if (option.type === 'line') {\n const shadow = tokens.theme[theme].boxShadow.raised;\n const shadowParts = shadow.split(/ (?=\\d+px|rgba?\\()/);\n\n return {\n type: 'line',\n symbolSize: 9,\n color,\n symbol: 'none',\n ...option,\n lineStyle: {\n width: 2,\n type: 'solid' as const,\n ...option.lineStyle,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n zoom: '-',\n back: '-',\n },\n },\n },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AAEz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ACR,KAAK,EAAE,EAAE,EACT,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,QAAQ,IACX,QAAQ,EACX;IACJ,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,uBACE,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,CAAC,CAAC,CAAC,EACf,gBAAgB,EAAE,KAAK,IACpB,QAAQ,EACX;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAhCW,QAAA,aAAa,iBAgCxB;AAEK,MAAM,YAAY,GAAG,CAC1B,OAAiC,EACP,EAAE;;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,IAAA,oBAAY,EAAC,MAAM,CAAC,CACO,CAAC;IAChC,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,gCACN,UAAU,EAAE,KAAK,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB","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 { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n defaultThresholdLineSeriesOption,\n type EchartsSeries,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './Chart';\nimport { ChartTooltip } from './ChartTooltip';\n\nconst colors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n): EchartsSeries => {\n return series.map(\n (\n option:\n | SeriesOption\n | ThresholdLineSeriesOption<'warning'>\n | ThresholdLineSeriesOption<'danger'>,\n index: number = 0,\n ): SeriesOption => {\n if (option === undefined) {\n return {};\n }\n\n const color = Array.isArray(option.color)\n ? option.color[index]\n : (option.color ?? colors[index]);\n\n if (option.type === 'thresholdLine') {\n const { notificationType } = option;\n // Needed to differentiate between normal lines and threshold lines\n // as we are unable to inject custom properties into echarts series lines.\n const thresholdLineName = `thresholdLine-${notificationType}`;\n return {\n symbolSize: 9,\n symbol: 'none',\n condition: defaultThresholdLineSeriesOption.condition,\n ...option,\n lineStyle: {\n width: 2,\n type: 'dashed',\n ...option.lineStyle,\n },\n name: thresholdLineName,\n type: 'line',\n data: [\n [option.xAxis[0], option.yAxis],\n [option.xAxis[1], option.yAxis],\n ],\n };\n }\n\n if (option.type === 'line') {\n const shadow = tokens.theme[theme].boxShadow.raised;\n const shadowParts = shadow.split(/ (?=\\d+px|rgba?\\()/);\n\n return {\n type: 'line',\n symbolSize: 9,\n color,\n symbol: 'none',\n ...option,\n lineStyle: {\n width: 2,\n type: 'solid' as const,\n ...option.lineStyle,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n },\n },\n };\n};\n"]}
|
package/lib/cjs/charts/utils.js
CHANGED
|
@@ -22,11 +22,11 @@ exports.extractValueFromTooltipSeries = exports.useThrottle = exports.capitalize
|
|
|
22
22
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
23
|
*/
|
|
24
24
|
const react_1 = require("react");
|
|
25
|
-
//
|
|
25
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
const useThrottle = (callback, limit) => {
|
|
27
27
|
const lastCallRef = (0, react_1.useRef)(0);
|
|
28
28
|
const throttledCallback = (0, react_1.useCallback)(
|
|
29
|
-
//
|
|
29
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
30
|
(...args) => {
|
|
31
31
|
const now = Date.now();
|
|
32
32
|
if (now - lastCallRef.current >= limit) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/charts/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iCAA4C;AAE5C,8DAA8D;AAC9D,MAAM,WAAW,GAAG,CAAC,QAAqC,EAAE,KAAa,EAAE,EAAE;IAC3E,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,iBAAiB,GAAG,IAAA,mBAAW;IACnC,8DAA8D;IAC9D,CAAC,GAAG,IAAW,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAA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2C,sEAA6B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useCallback, useRef } from 'react';\n\n//
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/charts/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iCAA4C;AAE5C,8DAA8D;AAC9D,MAAM,WAAW,GAAG,CAAC,QAAqC,EAAE,KAAa,EAAE,EAAE;IAC3E,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,iBAAiB,GAAG,IAAA,mBAAW;IACnC,8DAA8D;IAC9D,CAAC,GAAG,IAAW,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,GAAG,GAAG,WAAW,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;YACvC,WAAW,CAAC,OAAO,GAAG,GAAG,CAAC;YAC1B,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAsC8B,kCAAW;AApC3C,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;AA+BO,sDAAqB;AA7B9B;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CACpC,KAA4C,EAC5C,MAGC;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;AAE2C,sEAA6B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useCallback, useRef } from 'react';\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nconst useThrottle = (callback: (...args: any[]) => unknown, limit: number) => {\n const lastCallRef = useRef(0);\n const throttledCallback = useCallback(\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n (...args: any[]) => {\n const now = Date.now();\n if (now - lastCallRef.current >= limit) {\n lastCallRef.current = now;\n callback(...args);\n }\n },\n [callback, limit],\n );\n return throttledCallback;\n};\n\nconst capitalizeFirstLetter = (str: string) => {\n if (!str) {\n return str;\n }\n return str.charAt(0).toUpperCase() + str.substring(1);\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 x: number | number[];\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 { capitalizeFirstLetter, useThrottle, extractValueFromTooltipSeries };\n"]}
|