@neo4j-ndl/react-charts 1.3.1 → 1.3.2

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.
@@ -89,14 +89,14 @@ const highlightOrDownplayPieSlices = (chart, currentSeriesToDispatch, action, cu
89
89
  .map((_row, index) => index)
90
90
  .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));
91
91
  chart === null || chart === void 0 ? void 0 : chart.dispatchAction({
92
- seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0
93
92
  dataIndex: otherSeriesIndexes,
93
+ seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0
94
94
  type: 'downplay',
95
95
  });
96
96
  }
97
97
  chart === null || chart === void 0 ? void 0 : chart.dispatchAction({
98
- seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0
99
98
  dataIndex: currentDataSeriesIndexes,
99
+ seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0
100
100
  type: action,
101
101
  });
102
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"legend-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/legend-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qCAIiB;AAEV,MAAM,uBAAuB,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,MAAM,UAAU,GAAI,MAAM,CAAC,MAAgC,IAAI,EAAE,CAAC;IAElE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,WAAmB,EAAE,EAAE;QAClD,KAAK,CAAC,cAAc,CAAC;YACnB,WAAW;YACX,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAVW,QAAA,uBAAuB,2BAUlC;AAEF,MAAM,mCAAmC,GAAG,CAC1C,KAAkB,EAClB,uBAA0D,EAC1D,MAAg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AAC;IACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAE9C,MAAM,UAAU,GAAG,MAAA,MACjB,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MACtB,0CAAG,CAAC,CAAC,0CAAE,IAAI,CAAC;IAEb,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,4BAA4B,CAC1B,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mCAAmC,CACjC,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEO,8DAAyB","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 EChartsType,\n getInstanceByDom,\n} from 'echarts';\n\nexport const resetAllSeriesHighlight = (chart: EChartsType) => {\n const option = chart.getOption();\n const seriesList = (option.series as unknown[] | undefined) || [];\n\n seriesList.forEach((_series, seriesIndex: number) => {\n chart.dispatchAction({\n seriesIndex,\n type: 'downplay',\n });\n });\n};\n\nconst highlightOrDownplayLineAndBarSeries = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change emphasis state to add opacity on the non highlighted items\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n emphasis: {\n ...(seriesItem.emphasis as Record<string, unknown>),\n disabled: isDownplay,\n },\n }),\n ),\n });\n\n const seriesWithSeriesIndex = allChartOptionSeries\n // Since the series index does not exist in the data we extract it from the series index\n ?.map((seriesItem, index) => ({\n ...seriesItem,\n seriesIndex: index,\n }))\n // Select the series that are in the currentSeriesToDispatch array\n ?.filter((seriesItem: Record<string, unknown>) =>\n currentSeriesToDispatch.some((series) => series.name === seriesItem.name),\n );\n\n if (!seriesWithSeriesIndex.length) {\n return;\n }\n\n chart?.dispatchAction({\n seriesIndex: seriesWithSeriesIndex.map((series) => series.seriesIndex),\n type: action,\n });\n};\n\n/**\n * Highlight or downplay pie chart dataset item\n */\nconst highlightOrDownplayPieSlices = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change blur state to add opacity on the non highlighted items in the pie chart\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n blur: {\n itemStyle: {\n opacity: isDownplay ? 1 : 0.3,\n },\n label: {\n opacity: isDownplay ? 1 : 0.3,\n },\n },\n }),\n ),\n });\n\n // The dataIndex that we want to dispatch can be found in the dataset[0] source array, where the first item is the name of the series\n const chartOptionDataset =\n currentChartOptions?.dataset as EChartsOption['dataset'];\n const datasetArray = Array.isArray(chartOptionDataset)\n ? chartOptionDataset\n : [chartOptionDataset];\n const sourceArray = datasetArray?.[0]?.source as unknown[][];\n\n // Find the dataIndexes that we want to dispatch\n const currentDataSeriesIndexes = currentSeriesToDispatch.map((series) => {\n const index = sourceArray?.findIndex((item) => item[0] === series.name) - 1;\n return index;\n });\n\n if (action === 'highlight') {\n // Downplay other data indexes to make sure the other slices are not highlighted\n const otherSeriesIndexes = sourceArray\n .map((_row, index) => index)\n .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));\n\n chart?.dispatchAction({\n seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0\n dataIndex: otherSeriesIndexes,\n type: 'downplay',\n });\n }\n\n chart?.dispatchAction({\n seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0\n dataIndex: currentDataSeriesIndexes,\n type: action,\n });\n};\n\n/**\n * Highlight or downplay the series in the chart to toggle between emphasized and non-emphasized state\n */\nconst highlightOrDownplaySeries = (\n chartRef: React.RefObject<HTMLDivElement | null>,\n series: { name: string; color: string }[],\n currentSelectedSeries: Record<string, boolean>,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n) => {\n const hasOnlyOneSeries = series.length === 1;\n\n const isOnlyOneSeriesSelected =\n Object.values(currentSelectedSeries).filter(Boolean).length === 1;\n\n if (\n isOnlyOneSeriesSelected ||\n currentSeriesToDispatch.length === 0 ||\n chartRef.current === null ||\n hasOnlyOneSeries\n ) {\n return;\n }\n\n const chart = getInstanceByDom(chartRef.current);\n\n if (!chart) {\n return;\n }\n const currentChartOptions = chart.getOption();\n\n const seriesType = (\n currentChartOptions?.series as Record<string, unknown>[]\n )?.[0]?.type;\n\n if (seriesType === 'pie') {\n highlightOrDownplayPieSlices(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n } else {\n highlightOrDownplayLineAndBarSeries(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n }\n};\n\nexport { highlightOrDownplaySeries };\n"]}
1
+ {"version":3,"file":"legend-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/legend-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qC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ACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAE7C,MAAM,uBAAuB,GAC3B,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAEpE,IACE,uBAAuB;QACvB,uBAAuB,CAAC,MAAM,KAAK,CAAC;QACpC,QAAQ,CAAC,OAAO,KAAK,IAAI;QACzB,gBAAgB,EAChB,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAE9C,MAAM,UAAU,GAAG,MAAA,MACjB,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MACtB,0CAAG,CAAC,CAAC,0CAAE,IAAI,CAAC;IAEb,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,4BAA4B,CAC1B,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mCAAmC,CACjC,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEO,8DAAyB","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 EChartsType,\n getInstanceByDom,\n} from 'echarts';\n\nexport const resetAllSeriesHighlight = (chart: EChartsType) => {\n const option = chart.getOption();\n const seriesList = (option.series as unknown[] | undefined) || [];\n\n seriesList.forEach((_series, seriesIndex: number) => {\n chart.dispatchAction({\n seriesIndex,\n type: 'downplay',\n });\n });\n};\n\nconst highlightOrDownplayLineAndBarSeries = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change emphasis state to add opacity on the non highlighted items\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n emphasis: {\n ...(seriesItem.emphasis as Record<string, unknown>),\n disabled: isDownplay,\n },\n }),\n ),\n });\n\n const seriesWithSeriesIndex = allChartOptionSeries\n // Since the series index does not exist in the data we extract it from the series index\n ?.map((seriesItem, index) => ({\n ...seriesItem,\n seriesIndex: index,\n }))\n // Select the series that are in the currentSeriesToDispatch array\n ?.filter((seriesItem: Record<string, unknown>) =>\n currentSeriesToDispatch.some((series) => series.name === seriesItem.name),\n );\n\n if (!seriesWithSeriesIndex.length) {\n return;\n }\n\n chart?.dispatchAction({\n seriesIndex: seriesWithSeriesIndex.map((series) => series.seriesIndex),\n type: action,\n });\n};\n\n/**\n * Highlight or downplay pie chart dataset item\n */\nconst highlightOrDownplayPieSlices = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change blur state to add opacity on the non highlighted items in the pie chart\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n blur: {\n itemStyle: {\n opacity: isDownplay ? 1 : 0.3,\n },\n label: {\n opacity: isDownplay ? 1 : 0.3,\n },\n },\n }),\n ),\n });\n\n // The dataIndex that we want to dispatch can be found in the dataset[0] source array, where the first item is the name of the series\n const chartOptionDataset =\n currentChartOptions?.dataset as EChartsOption['dataset'];\n const datasetArray = Array.isArray(chartOptionDataset)\n ? chartOptionDataset\n : [chartOptionDataset];\n const sourceArray = datasetArray?.[0]?.source as unknown[][];\n\n // Find the dataIndexes that we want to dispatch\n const currentDataSeriesIndexes = currentSeriesToDispatch.map((series) => {\n const index = sourceArray?.findIndex((item) => item[0] === series.name) - 1;\n return index;\n });\n\n if (action === 'highlight') {\n // Downplay other data indexes to make sure the other slices are not highlighted\n const otherSeriesIndexes = sourceArray\n .map((_row, index) => index)\n .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));\n\n chart?.dispatchAction({\n dataIndex: otherSeriesIndexes,\n seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0\n type: 'downplay',\n });\n }\n\n chart?.dispatchAction({\n dataIndex: currentDataSeriesIndexes,\n seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0\n type: action,\n });\n};\n\n/**\n * Highlight or downplay the series in the chart to toggle between emphasized and non-emphasized state\n */\nconst highlightOrDownplaySeries = (\n chartRef: React.RefObject<HTMLDivElement | null>,\n series: { name: string; color: string }[],\n currentSelectedSeries: Record<string, boolean>,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n) => {\n const hasOnlyOneSeries = series.length === 1;\n\n const isOnlyOneSeriesSelected =\n Object.values(currentSelectedSeries).filter(Boolean).length === 1;\n\n if (\n isOnlyOneSeriesSelected ||\n currentSeriesToDispatch.length === 0 ||\n chartRef.current === null ||\n hasOnlyOneSeries\n ) {\n return;\n }\n\n const chart = getInstanceByDom(chartRef.current);\n\n if (!chart) {\n return;\n }\n const currentChartOptions = chart.getOption();\n\n const seriesType = (\n currentChartOptions?.series as Record<string, unknown>[]\n )?.[0]?.type;\n\n if (seriesType === 'pie') {\n highlightOrDownplayPieSlices(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n } else {\n highlightOrDownplayLineAndBarSeries(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n }\n};\n\nexport { highlightOrDownplaySeries };\n"]}
@@ -44,7 +44,7 @@ const mergeSeries = (series, theme = 'light', userOption, palette) => {
44
44
  // Needed to differentiate between normal lines and threshold lines
45
45
  // as we are unable to inject custom properties into echarts series lines.
46
46
  const thresholdLineName = `thresholdLine-${notificationType}`;
47
- return Object.assign(Object.assign({ symbolSize: 9, symbol: 'none', condition: defaults_1.defaultThresholdLineSeriesOption.condition }, option), { lineStyle: Object.assign({ width: 2, type: 'dashed' }, option.lineStyle), name: thresholdLineName, type: 'line', data: [
47
+ return Object.assign(Object.assign({ symbolSize: 9, symbol: 'none', condition: defaults_1.defaultThresholdLineSeriesOption.condition }, option), { lineStyle: Object.assign({ type: 'dashed', width: 2 }, option.lineStyle), name: thresholdLineName, type: 'line', data: [
48
48
  [option.xAxis[0], option.yAxis],
49
49
  [option.xAxis[1], option.yAxis],
50
50
  ] });
@@ -52,7 +52,7 @@ const mergeSeries = (series, theme = 'light', userOption, palette) => {
52
52
  if (option.type === 'line') {
53
53
  const shadow = base_1.tokens.theme[theme].boxShadow.raised;
54
54
  const shadowParts = shadow.split(/ (?=\d+px|rgba?\()/);
55
- return Object.assign(Object.assign({ type: 'line', symbolSize: 9, color, symbol: 'none' }, option), { lineStyle: Object.assign({ width: 2, type: 'solid' }, option.lineStyle), emphasis: Object.assign(Object.assign(Object.assign({ disabled: true, focus: 'series' }, option.emphasis), { itemStyle: Object.assign({ borderColor: base_1.tokens.theme[theme].color.neutral.bg.weak, shadowOffsetX: parseInt(shadowParts[0]), shadowOffsetY: parseInt(shadowParts[1]), shadowBlur: parseInt(shadowParts[2]), shadowColor: shadowParts[4] }, (_b = option.emphasis) === null || _b === void 0 ? void 0 : _b.itemStyle), label: { show: false } }), option.emphasis) });
55
+ return Object.assign(Object.assign({ type: 'line', symbolSize: 9, color, symbol: 'none' }, option), { lineStyle: Object.assign({ type: 'solid', width: 2 }, option.lineStyle), emphasis: Object.assign(Object.assign(Object.assign({ disabled: true, focus: 'series' }, option.emphasis), { itemStyle: Object.assign({ borderColor: base_1.tokens.theme[theme].color.neutral.bg.weak, shadowBlur: parseInt(shadowParts[2]), shadowColor: shadowParts[4], shadowOffsetX: parseInt(shadowParts[0]), shadowOffsetY: parseInt(shadowParts[1]) }, (_b = option.emphasis) === null || _b === void 0 ? void 0 : _b.itemStyle), label: { show: false } }), option.emphasis) });
56
56
  }
57
57
  if (option.type === 'pie') {
58
58
  const valueFormatter = (0, chart_tooltip_formatter_1.getTooltipValueFormatter)(userOption);
@@ -61,7 +61,7 @@ const mergeSeries = (series, theme = 'light', userOption, palette) => {
61
61
  // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)
62
62
  blur: Object.assign({ itemStyle: Object.assign({ opacity: 1 }, (_c = option.blur) === null || _c === void 0 ? void 0 : _c.itemStyle), label: Object.assign({ opacity: 1 }, (_d = option.blur) === null || _d === void 0 ? void 0 : _d.label) }, option.blur),
63
63
  // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.
64
- emphasis: Object.assign({ disabled: false, focus: 'self', scale: true, scaleSize: 5 }, option.emphasis), itemStyle: Object.assign({ borderColor: base_1.tokens.theme[theme].color.neutral.bg.weak, borderWidth: 1 }, option.itemStyle), label: Object.assign({ formatter: '{d}%', backgroundColor: 'transparent', color: base_1.tokens.theme[theme].color.neutral.text.weak }, option.label), labelLine: Object.assign({ length: 5, show: true }, option.labelLine), tooltip: Object.assign({ trigger: 'item', confine: true,
64
+ emphasis: Object.assign({ disabled: false, focus: 'self', scale: true, scaleSize: 5 }, option.emphasis), itemStyle: Object.assign({ borderColor: base_1.tokens.theme[theme].color.neutral.bg.weak, borderWidth: 1 }, option.itemStyle), label: Object.assign({ backgroundColor: 'transparent', color: base_1.tokens.theme[theme].color.neutral.text.weak, formatter: '{d}%' }, option.label), labelLine: Object.assign({ length: 5, show: true }, option.labelLine), tooltip: Object.assign({ trigger: 'item', confine: true,
65
65
  // Reset the default tooltip css styling
66
66
  padding: 0, borderRadius: 0, borderWidth: 0, extraCssText: 'box-shadow: none; background-color: transparent;', formatter: function (params) {
67
67
  var _a, _b;
@@ -74,7 +74,7 @@ const mergeSeries = (series, theme = 'light', userOption, palette) => {
74
74
  }
75
75
  if (option.type === 'bar') {
76
76
  const valueFormatter = (0, chart_tooltip_formatter_1.getTooltipValueFormatter)(userOption);
77
- 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: {
77
+ 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({ borderWidth: 20, color }, option.itemStyle), markLine: {
78
78
  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),
79
79
  lineStyle: Object.assign({ width: 20 }, (_j = option.markLine) === null || _j === void 0 ? void 0 : _j.lineStyle),
80
80
  }, tooltip: Object.assign({ trigger: 'axis', confine: true,
@@ -100,7 +100,7 @@ const mergeXAxis = (xAxis, theme = 'light') => {
100
100
  if (Array.isArray(xAxis)) {
101
101
  return xAxis.map((axis) => (0, exports.mergeXAxis)(axis, theme));
102
102
  }
103
- const baseXAxis = Object.assign(Object.assign({}, xAxis), { splitLine: Object.assign({ show: false }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.splitLine), axisLine: Object.assign({ lineStyle: Object.assign({}, (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle) }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine), axisTick: Object.assign(Object.assign(Object.assign({}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), { lineStyle: Object.assign({}, (_b = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle), show: true }), xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), axisLabel: Object.assign({ margin: 16, formatter: {
103
+ const baseXAxis = Object.assign(Object.assign({}, xAxis), { axisLabel: Object.assign({ formatter: {
104
104
  day: '{dd} {MMM}',
105
105
  hour: '{HH}:{mm}',
106
106
  millisecond: '{hh}:{mm}:{ss} {SSS}',
@@ -109,7 +109,7 @@ const mergeXAxis = (xAxis, theme = 'light') => {
109
109
  none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',
110
110
  second: '{HH}:{mm}:{ss}',
111
111
  year: '{yearStyle|{yyyy}}\n{monthStyle|{MMM}}',
112
- }, overflow: 'truncate' }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLabel) });
112
+ }, margin: 16, overflow: 'truncate' }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLabel), axisLine: Object.assign({ lineStyle: Object.assign({}, (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle) }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine), axisTick: Object.assign(Object.assign(Object.assign({}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), { lineStyle: Object.assign({}, (_b = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle), show: true }), xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), splitLine: Object.assign({ show: false }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.splitLine) });
113
113
  if (xAxis.type === 'time') {
114
114
  const timeXAxis = Object.assign(Object.assign({}, baseXAxis), { axisLabel: Object.assign({ hideOverlap: true }, baseXAxis.axisLabel) });
115
115
  return timeXAxis;
@@ -122,7 +122,7 @@ const mergeXAxis = (xAxis, theme = 'light') => {
122
122
  return valueXAxis;
123
123
  }
124
124
  if (xAxis.type === 'category') {
125
- const categoryXAxis = Object.assign(Object.assign({}, baseXAxis), { axisTick: Object.assign({ alignWithLabel: true }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisTick), axisLabel: Object.assign({ width: 80 }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisLabel) });
125
+ const categoryXAxis = Object.assign(Object.assign({}, baseXAxis), { axisLabel: Object.assign({ width: 80 }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisLabel), axisTick: Object.assign({ alignWithLabel: true }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisTick) });
126
126
  return categoryXAxis;
127
127
  }
128
128
  return baseXAxis;
@@ -136,7 +136,7 @@ const mergeYAxis = (yAxis, theme = 'light') => {
136
136
  if (Array.isArray(yAxis)) {
137
137
  return yAxis.map((axis) => (0, exports.mergeYAxis)(axis, theme));
138
138
  }
139
- const baseYAxis = Object.assign(Object.assign({}, yAxis), { axisLine: Object.assign(Object.assign({}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine), { lineStyle: Object.assign({}, (_a = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle), show: true }), axisTick: Object.assign(Object.assign({ show: false }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick), { lineStyle: Object.assign({ width: 1 }, (_b = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle) }), axisLabel: Object.assign({ margin: 8, overflow: 'truncate' }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLabel), splitLine: Object.assign({ show: true }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.splitLine) });
139
+ const baseYAxis = Object.assign(Object.assign({}, yAxis), { axisLabel: Object.assign({ margin: 8, overflow: 'truncate' }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLabel), axisLine: Object.assign(Object.assign({}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine), { lineStyle: Object.assign({}, (_a = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle), show: true }), axisTick: Object.assign(Object.assign({ show: false }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick), { lineStyle: Object.assign({ width: 1 }, (_b = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle) }), splitLine: Object.assign({ show: true }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.splitLine) });
140
140
  if (yAxis.type === 'time') {
141
141
  const timeYAxis = Object.assign(Object.assign({}, baseYAxis), { axisLabel: Object.assign({ hideOverlap: true }, baseYAxis.axisLabel), splitLine: Object.assign({ show: false }, baseYAxis === null || baseYAxis === void 0 ? void 0 : baseYAxis.splitLine) });
142
142
  return timeYAxis;
@@ -1 +1 @@
1
- {"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AAEzC,6CAAkD;AAElD,kDAA+C;AAC/C,uEAAqE;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AG;oBACT,IAAI,EAAE,GAAG;iBACV,EACD,IAAI,EAAE,IAAI,GACX;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,YAAY,gBA4CvB","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 { ChartTooltip } from '../ChartTooltip';\nimport { getTooltipValueFormatter } from './chart-tooltip-formatter';\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { formatNumberEnUS } from './format-utils';\n\nconst defaultColors = Object.values(tokens.categorical);\n\ntype SingleXAxisOption = Exclude<\n NonNullable<EChartsOption['xAxis']>,\n unknown[]\n>;\ntype SingleYAxisOption = Exclude<\n NonNullable<EChartsOption['yAxis']>,\n unknown[]\n>;\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 palette?: HexColor[],\n): EchartsSeries => {\n const colors = palette ?? defaultColors;\n\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 % colors.length]);\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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 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((axis) =>\n mergeXAxis(axis, theme),\n ) as EChartsOption['xAxis'];\n }\n\n const baseXAxis = {\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 day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n minute: '{HH}:{mm}',\n month: '{MMM}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n second: '{HH}:{mm}:{ss}',\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n } as SingleXAxisOption;\n\n if (xAxis.type === 'time') {\n const timeXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n } as SingleXAxisOption;\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const xAxisFormatter =\n xAxis.axisLabel && 'formatter' in xAxis.axisLabel\n ? xAxis.axisLabel.formatter\n : undefined;\n const valueXAxis = {\n ...baseXAxis,\n axisLabel: {\n ...baseXAxis.axisLabel,\n formatter: xAxisFormatter ?? formatNumberEnUS,\n },\n } as SingleXAxisOption;\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...baseXAxis?.axisTick,\n },\n axisLabel: {\n width: 80,\n ...baseXAxis?.axisLabel,\n },\n } as SingleXAxisOption;\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((axis) =>\n mergeYAxis(axis, theme),\n ) as EChartsOption['yAxis'];\n }\n\n const baseYAxis = {\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 } as SingleYAxisOption;\n\n if (yAxis.type === 'time') {\n const timeYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const yAxisFormatter =\n yAxis.axisLabel && 'formatter' in yAxis.axisLabel\n ? yAxis.axisLabel.formatter\n : undefined;\n const valueYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n formatter: yAxisFormatter ?? formatNumberEnUS,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...baseYAxis?.axisLabel,\n },\n } as SingleYAxisOption;\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\ntype SingleDataZoomOption = Exclude<\n NonNullable<EChartsOption['dataZoom']>,\n unknown[]\n>;\n\ntype MergeDataZoomAxes = {\n xAxis?: EChartsOption['xAxis'];\n yAxis?: EChartsOption['yAxis'];\n};\n\nexport type DataZoomTargetAxes = {\n xAxisIndices: number[];\n yAxisIndices: number[];\n};\n\nconst normalizeAxisIndices = (axisIndex: unknown): number[] => {\n if (typeof axisIndex === 'number') {\n return [axisIndex];\n }\n\n if (Array.isArray(axisIndex)) {\n return axisIndex.filter((index): index is number => {\n return typeof index === 'number';\n });\n }\n\n return [];\n};\n\n/**\n * Resolves the axes a single dataZoom entry targets, mirroring ECharts' own\n * resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning\n * \"not this axis\"); when no index is given, `orient: 'vertical'` targets the\n * first y-axis and horizontal/unset targets the first x-axis.\n */\nconst getSingleDataZoomTargets = (\n dataZoom: SingleDataZoomOption | undefined,\n): DataZoomTargetAxes => {\n if (dataZoom?.type !== 'slider' && dataZoom?.type !== 'inside') {\n return { xAxisIndices: [], yAxisIndices: [] };\n }\n\n const hasAxisIndex =\n dataZoom.xAxisIndex !== undefined || dataZoom.yAxisIndex !== undefined;\n\n if (hasAxisIndex) {\n return {\n xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),\n yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex),\n };\n }\n\n return dataZoom.orient === 'vertical'\n ? { xAxisIndices: [], yAxisIndices: [0] }\n : { xAxisIndices: [0], yAxisIndices: [] };\n};\n\n/**\n * Union of the axis indices targeted by all slider/inside entries in a\n * dataZoom config, using the same per-entry resolution as ECharts (explicit\n * axis indices first, then orientation).\n */\nexport const getDataZoomTargetAxes = (\n dataZoom: EChartsOption['dataZoom'],\n): DataZoomTargetAxes => {\n const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n const targets: DataZoomTargetAxes = { xAxisIndices: [], yAxisIndices: [] };\n\n for (const entry of entries) {\n const entryTargets = getSingleDataZoomTargets(entry);\n\n for (const index of entryTargets.xAxisIndices) {\n if (!targets.xAxisIndices.includes(index)) {\n targets.xAxisIndices.push(index);\n }\n }\n\n for (const index of entryTargets.yAxisIndices) {\n if (!targets.yAxisIndices.includes(index)) {\n targets.yAxisIndices.push(index);\n }\n }\n }\n\n return targets;\n};\n\n/**\n * A slider is vertical when the consumer sets `orient: 'vertical'`, or when it\n * only targets a y-axis, which makes ECharts infer the vertical orientation.\n */\nexport const isVerticalSlider = (\n dataZoom: SingleDataZoomOption | undefined,\n): boolean => {\n if (dataZoom?.type !== 'slider') {\n return false;\n }\n\n if (dataZoom.orient !== undefined) {\n return dataZoom.orient === 'vertical';\n }\n\n const targets = getSingleDataZoomTargets(dataZoom);\n\n return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;\n};\n\n/**\n * Axis types where windowing (`filterMode: 'none'`) beats ECharts' default\n * data filtering. Filtering a continuous axis removes whole data items outside\n * the window, which makes bars and points vanish instead of clipping them.\n * Category axes keep the `'filter'` default so paging through categories still\n * rescales the opposite value axis to the visible data.\n */\nconst WINDOWED_FILTER_AXIS_TYPES = ['log', 'time', 'value'];\n\nconst getSingleAxisOption = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndex: unknown,\n): { type?: string } | undefined => {\n if (!Array.isArray(axis)) {\n return axis as { type?: string } | undefined;\n }\n\n const index =\n typeof axisIndex === 'number'\n ? axisIndex\n : Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'\n ? axisIndex[0]\n : 0;\n\n return axis[index] as { type?: string } | undefined;\n};\n\n/**\n * Resolves the slider's target axis the way ECharts does (explicit axis index\n * first, then orientation) and returns `'none'` when that axis is continuous.\n * Returns `undefined` (keep ECharts' `'filter'` default) for category axes and\n * for sliders that target both axes at once.\n */\nconst getSliderDefaultFilterMode = (\n dataZoom: SingleDataZoomOption,\n axes: MergeDataZoomAxes | undefined,\n): 'none' | undefined => {\n const targets = getSingleDataZoomTargets(dataZoom);\n const isXAxisTarget = targets.xAxisIndices.length > 0;\n const isYAxisTarget = targets.yAxisIndices.length > 0;\n\n if (isXAxisTarget === isYAxisTarget) {\n return undefined;\n }\n\n const targetAxis = isYAxisTarget\n ? getSingleAxisOption(axes?.yAxis, dataZoom.yAxisIndex)\n : getSingleAxisOption(axes?.xAxis, dataZoom.xAxisIndex);\n\n return targetAxis?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)\n ? 'none'\n : undefined;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n axes?: MergeDataZoomAxes,\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option, axes),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n const filterMode = getSliderDefaultFilterMode(dataZoom, axes);\n const layoutDefaults = isVerticalSlider(dataZoom)\n ? { right: 10, width: 28 }\n : { bottom: 10, height: 28 };\n\n return {\n ...(filterMode !== undefined && { filterMode }),\n ...layoutDefaults,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n // Only pin the default x-axis binding on entries that actually target the\n // x-axis; y-targeting entries (explicit `yAxisIndex` or\n // `orient: 'vertical'`) keep their own binding.\n const targets = getSingleDataZoomTargets(dataZoom);\n const hasDefaultXAxisTarget =\n dataZoom.xAxisIndex === undefined && targets.xAxisIndices.length > 0;\n\n return {\n filterMode: 'none',\n ...(hasDefaultXAxisTarget && { xAxisIndex: [0] }),\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\ntype MergeToolboxContext = MergeDataZoomAxes & {\n dataZoom?: EChartsOption['dataZoom'];\n};\n\nconst isContinuousAxisOption = (\n axisOption: { type?: string } | undefined,\n): boolean => {\n return (\n axisOption?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type)\n );\n};\n\nconst areTargetAxesContinuous = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndices: number[] | 'all',\n): boolean => {\n if (axisIndices === 'all') {\n const axisOptions = Array.isArray(axis) ? axis : [axis];\n\n return (\n axisOptions.length > 0 &&\n axisOptions.every((axisOption) => {\n return isContinuousAxisOption(axisOption as { type?: string });\n })\n );\n }\n\n return axisIndices.every((axisIndex) => {\n return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));\n });\n};\n\n/**\n * Returns `'none'` when every axis targeted by the drag-to-zoom brush is\n * continuous (`value`/`time`/`log`), matching the slider rule: filtering a\n * continuous axis removes whole data items outside the selection instead of\n * clipping them. Category (or unknown) targets keep ECharts' `'filter'`\n * default.\n */\nconst getBrushDefaultFilterMode = (\n context: MergeToolboxContext | undefined,\n xAxisTargets: number[] | 'all' | false,\n yAxisTargets: number[] | 'all' | false,\n): 'none' | undefined => {\n const checks: boolean[] = [];\n\n if (xAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.xAxis, xAxisTargets));\n }\n\n if (yAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.yAxis, yAxisTargets));\n }\n\n return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n context?: MergeToolboxContext,\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option, context),\n ) as EChartsOption['toolbox'];\n }\n\n // The drag-to-zoom brush follows the axes the dataZoom config targets, so\n // zoom direction is configured in one place. Without any dataZoom config it\n // keeps the historical default: all x-axes on, y off.\n const targets = getDataZoomTargetAxes(context?.dataZoom);\n const hasTargets =\n targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0;\n const xAxisTargets: number[] | 'all' | false = hasTargets\n ? targets.xAxisIndices.length > 0 && targets.xAxisIndices\n : 'all';\n const yAxisTargets: number[] | false =\n targets.yAxisIndices.length > 0 && targets.yAxisIndices;\n const filterMode = getBrushDefaultFilterMode(\n context,\n xAxisTargets,\n yAxisTargets,\n );\n\n return {\n feature: {\n dataZoom: {\n ...(filterMode !== undefined && { filterMode }),\n ...(xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets }),\n yAxisIndex: yAxisTargets,\n ...toolbox?.feature?.dataZoom,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n show: true,\n },\n },\n };\n};\n"]}
1
+ {"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AAEzC,6CAAkD;AAElD,kDAA+C;AAC/C,uEAAqE;AAOrE,yCAA8D;AAC9D,iDAAkD;AAElD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,WAAW,CAAC,CAAC;AAWjD,MAAM,WAAW,GAAG,CACzB,MAAoB,EACpB,QAA0B,OAAO,EACjC,UAGC,EACD,OAAoB,EACL,EAAE;IACjB,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,aAAa,CAAC;IAExC,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,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,UAAU,GACd,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACrE,MAAM,YAAY,GAA6B,UAAU;QACvD,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY;QACzD,CAAC,CAAC,KAAK,CAAC;IACV,MAAM,YAAY,GAChB,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC;IAC1D,MAAM,UAAU,GAAG,yBAAyB,CAC1C,OAAO,EACP,YAAY,EACZ,YAAY,CACb,CAAC;IAEF,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,4EACH,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC,GAC5C,CAAC,YAAY,KAAK,KAAK,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,KAC3D,UAAU,EAAE,YAAY,KACrB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,EACD,IAAI,EAAE,IAAI,GACX;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,YAAY,gBA4CvB","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 { ChartTooltip } from '../ChartTooltip';\nimport { getTooltipValueFormatter } from './chart-tooltip-formatter';\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { formatNumberEnUS } from './format-utils';\n\nconst defaultColors = Object.values(tokens.categorical);\n\ntype SingleXAxisOption = Exclude<\n NonNullable<EChartsOption['xAxis']>,\n unknown[]\n>;\ntype SingleYAxisOption = Exclude<\n NonNullable<EChartsOption['yAxis']>,\n unknown[]\n>;\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 palette?: HexColor[],\n): EchartsSeries => {\n const colors = palette ?? defaultColors;\n\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 % colors.length]);\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 type: 'dashed',\n width: 2,\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 type: 'solid' as const,\n width: 2,\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 shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n const valueFormatter = getTooltipValueFormatter(userOption);\n\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 backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n formatter: '{d}%',\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 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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 borderWidth: 20,\n color,\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 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((axis) =>\n mergeXAxis(axis, theme),\n ) as EChartsOption['xAxis'];\n }\n\n const baseXAxis = {\n ...xAxis,\n axisLabel: {\n formatter: {\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n minute: '{HH}:{mm}',\n month: '{MMM}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n second: '{HH}:{mm}:{ss}',\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n },\n margin: 16,\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\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 splitLine: { show: false, ...xAxis?.splitLine },\n } as SingleXAxisOption;\n\n if (xAxis.type === 'time') {\n const timeXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n } as SingleXAxisOption;\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const xAxisFormatter =\n xAxis.axisLabel && 'formatter' in xAxis.axisLabel\n ? xAxis.axisLabel.formatter\n : undefined;\n const valueXAxis = {\n ...baseXAxis,\n axisLabel: {\n ...baseXAxis.axisLabel,\n formatter: xAxisFormatter ?? formatNumberEnUS,\n },\n } as SingleXAxisOption;\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis = {\n ...baseXAxis,\n axisLabel: {\n width: 80,\n ...baseXAxis?.axisLabel,\n },\n axisTick: {\n alignWithLabel: true,\n ...baseXAxis?.axisTick,\n },\n } as SingleXAxisOption;\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((axis) =>\n mergeYAxis(axis, theme),\n ) as EChartsOption['yAxis'];\n }\n\n const baseYAxis = {\n ...yAxis,\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\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 splitLine: { show: true, ...yAxis?.splitLine },\n } as SingleYAxisOption;\n\n if (yAxis.type === 'time') {\n const timeYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const yAxisFormatter =\n yAxis.axisLabel && 'formatter' in yAxis.axisLabel\n ? yAxis.axisLabel.formatter\n : undefined;\n const valueYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n formatter: yAxisFormatter ?? formatNumberEnUS,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...baseYAxis?.axisLabel,\n },\n } as SingleYAxisOption;\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\ntype SingleDataZoomOption = Exclude<\n NonNullable<EChartsOption['dataZoom']>,\n unknown[]\n>;\n\ntype MergeDataZoomAxes = {\n xAxis?: EChartsOption['xAxis'];\n yAxis?: EChartsOption['yAxis'];\n};\n\nexport type DataZoomTargetAxes = {\n xAxisIndices: number[];\n yAxisIndices: number[];\n};\n\nconst normalizeAxisIndices = (axisIndex: unknown): number[] => {\n if (typeof axisIndex === 'number') {\n return [axisIndex];\n }\n\n if (Array.isArray(axisIndex)) {\n return axisIndex.filter((index): index is number => {\n return typeof index === 'number';\n });\n }\n\n return [];\n};\n\n/**\n * Resolves the axes a single dataZoom entry targets, mirroring ECharts' own\n * resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning\n * \"not this axis\"); when no index is given, `orient: 'vertical'` targets the\n * first y-axis and horizontal/unset targets the first x-axis.\n */\nconst getSingleDataZoomTargets = (\n dataZoom: SingleDataZoomOption | undefined,\n): DataZoomTargetAxes => {\n if (dataZoom?.type !== 'slider' && dataZoom?.type !== 'inside') {\n return { xAxisIndices: [], yAxisIndices: [] };\n }\n\n const hasAxisIndex =\n dataZoom.xAxisIndex !== undefined || dataZoom.yAxisIndex !== undefined;\n\n if (hasAxisIndex) {\n return {\n xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),\n yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex),\n };\n }\n\n return dataZoom.orient === 'vertical'\n ? { xAxisIndices: [], yAxisIndices: [0] }\n : { xAxisIndices: [0], yAxisIndices: [] };\n};\n\n/**\n * Union of the axis indices targeted by all slider/inside entries in a\n * dataZoom config, using the same per-entry resolution as ECharts (explicit\n * axis indices first, then orientation).\n */\nexport const getDataZoomTargetAxes = (\n dataZoom: EChartsOption['dataZoom'],\n): DataZoomTargetAxes => {\n const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n const targets: DataZoomTargetAxes = { xAxisIndices: [], yAxisIndices: [] };\n\n for (const entry of entries) {\n const entryTargets = getSingleDataZoomTargets(entry);\n\n for (const index of entryTargets.xAxisIndices) {\n if (!targets.xAxisIndices.includes(index)) {\n targets.xAxisIndices.push(index);\n }\n }\n\n for (const index of entryTargets.yAxisIndices) {\n if (!targets.yAxisIndices.includes(index)) {\n targets.yAxisIndices.push(index);\n }\n }\n }\n\n return targets;\n};\n\n/**\n * A slider is vertical when the consumer sets `orient: 'vertical'`, or when it\n * only targets a y-axis, which makes ECharts infer the vertical orientation.\n */\nexport const isVerticalSlider = (\n dataZoom: SingleDataZoomOption | undefined,\n): boolean => {\n if (dataZoom?.type !== 'slider') {\n return false;\n }\n\n if (dataZoom.orient !== undefined) {\n return dataZoom.orient === 'vertical';\n }\n\n const targets = getSingleDataZoomTargets(dataZoom);\n\n return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;\n};\n\n/**\n * Axis types where windowing (`filterMode: 'none'`) beats ECharts' default\n * data filtering. Filtering a continuous axis removes whole data items outside\n * the window, which makes bars and points vanish instead of clipping them.\n * Category axes keep the `'filter'` default so paging through categories still\n * rescales the opposite value axis to the visible data.\n */\nconst WINDOWED_FILTER_AXIS_TYPES = ['log', 'time', 'value'];\n\nconst getSingleAxisOption = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndex: unknown,\n): { type?: string } | undefined => {\n if (!Array.isArray(axis)) {\n return axis as { type?: string } | undefined;\n }\n\n const index =\n typeof axisIndex === 'number'\n ? axisIndex\n : Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'\n ? axisIndex[0]\n : 0;\n\n return axis[index] as { type?: string } | undefined;\n};\n\n/**\n * Resolves the slider's target axis the way ECharts does (explicit axis index\n * first, then orientation) and returns `'none'` when that axis is continuous.\n * Returns `undefined` (keep ECharts' `'filter'` default) for category axes and\n * for sliders that target both axes at once.\n */\nconst getSliderDefaultFilterMode = (\n dataZoom: SingleDataZoomOption,\n axes: MergeDataZoomAxes | undefined,\n): 'none' | undefined => {\n const targets = getSingleDataZoomTargets(dataZoom);\n const isXAxisTarget = targets.xAxisIndices.length > 0;\n const isYAxisTarget = targets.yAxisIndices.length > 0;\n\n if (isXAxisTarget === isYAxisTarget) {\n return undefined;\n }\n\n const targetAxis = isYAxisTarget\n ? getSingleAxisOption(axes?.yAxis, dataZoom.yAxisIndex)\n : getSingleAxisOption(axes?.xAxis, dataZoom.xAxisIndex);\n\n return targetAxis?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)\n ? 'none'\n : undefined;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n axes?: MergeDataZoomAxes,\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option, axes),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n const filterMode = getSliderDefaultFilterMode(dataZoom, axes);\n const layoutDefaults = isVerticalSlider(dataZoom)\n ? { right: 10, width: 28 }\n : { bottom: 10, height: 28 };\n\n return {\n ...(filterMode !== undefined && { filterMode }),\n ...layoutDefaults,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n // Only pin the default x-axis binding on entries that actually target the\n // x-axis; y-targeting entries (explicit `yAxisIndex` or\n // `orient: 'vertical'`) keep their own binding.\n const targets = getSingleDataZoomTargets(dataZoom);\n const hasDefaultXAxisTarget =\n dataZoom.xAxisIndex === undefined && targets.xAxisIndices.length > 0;\n\n return {\n filterMode: 'none',\n ...(hasDefaultXAxisTarget && { xAxisIndex: [0] }),\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\ntype MergeToolboxContext = MergeDataZoomAxes & {\n dataZoom?: EChartsOption['dataZoom'];\n};\n\nconst isContinuousAxisOption = (\n axisOption: { type?: string } | undefined,\n): boolean => {\n return (\n axisOption?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type)\n );\n};\n\nconst areTargetAxesContinuous = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndices: number[] | 'all',\n): boolean => {\n if (axisIndices === 'all') {\n const axisOptions = Array.isArray(axis) ? axis : [axis];\n\n return (\n axisOptions.length > 0 &&\n axisOptions.every((axisOption) => {\n return isContinuousAxisOption(axisOption as { type?: string });\n })\n );\n }\n\n return axisIndices.every((axisIndex) => {\n return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));\n });\n};\n\n/**\n * Returns `'none'` when every axis targeted by the drag-to-zoom brush is\n * continuous (`value`/`time`/`log`), matching the slider rule: filtering a\n * continuous axis removes whole data items outside the selection instead of\n * clipping them. Category (or unknown) targets keep ECharts' `'filter'`\n * default.\n */\nconst getBrushDefaultFilterMode = (\n context: MergeToolboxContext | undefined,\n xAxisTargets: number[] | 'all' | false,\n yAxisTargets: number[] | 'all' | false,\n): 'none' | undefined => {\n const checks: boolean[] = [];\n\n if (xAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.xAxis, xAxisTargets));\n }\n\n if (yAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.yAxis, yAxisTargets));\n }\n\n return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n context?: MergeToolboxContext,\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option, context),\n ) as EChartsOption['toolbox'];\n }\n\n // The drag-to-zoom brush follows the axes the dataZoom config targets, so\n // zoom direction is configured in one place. Without any dataZoom config it\n // keeps the historical default: all x-axes on, y off.\n const targets = getDataZoomTargetAxes(context?.dataZoom);\n const hasTargets =\n targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0;\n const xAxisTargets: number[] | 'all' | false = hasTargets\n ? targets.xAxisIndices.length > 0 && targets.xAxisIndices\n : 'all';\n const yAxisTargets: number[] | false =\n targets.yAxisIndices.length > 0 && targets.yAxisIndices;\n const filterMode = getBrushDefaultFilterMode(\n context,\n xAxisTargets,\n yAxisTargets,\n );\n\n return {\n feature: {\n dataZoom: {\n ...(filterMode !== undefined && { filterMode }),\n ...(xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets }),\n yAxisIndex: yAxisTargets,\n ...toolbox?.feature?.dataZoom,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n show: true,\n },\n },\n };\n};\n"]}
@@ -85,14 +85,14 @@ const highlightOrDownplayPieSlices = (chart, currentSeriesToDispatch, action, cu
85
85
  .map((_row, index) => index)
86
86
  .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));
87
87
  chart === null || chart === void 0 ? void 0 : chart.dispatchAction({
88
- seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0
89
88
  dataIndex: otherSeriesIndexes,
89
+ seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0
90
90
  type: 'downplay',
91
91
  });
92
92
  }
93
93
  chart === null || chart === void 0 ? void 0 : chart.dispatchAction({
94
- seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0
95
94
  dataIndex: currentDataSeriesIndexes,
95
+ seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0
96
96
  type: action,
97
97
  });
98
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"legend-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/legend-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAGL,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,MAAM,UAAU,GAAI,MAAM,CAAC,MAAgC,IAAI,EAAE,CAAC;IAElE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,WAAmB,EAAE,EAAE;QAClD,KAAK,CAAC,cAAc,CAAC;YACnB,WAAW;YACX,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,mCAAmC,GAAG,CAC1C,KAAk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CAAC;QACX,OAAO;IACT,CAAC;IACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAE9C,MAAM,UAAU,GAAG,MAAA,MACjB,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MACtB,0CAAG,CAAC,CAAC,0CAAE,IAAI,CAAC;IAEb,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,4BAA4B,CAC1B,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mCAAmC,CACjC,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,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 {\n type EChartsOption,\n type EChartsType,\n getInstanceByDom,\n} from 'echarts';\n\nexport const resetAllSeriesHighlight = (chart: EChartsType) => {\n const option = chart.getOption();\n const seriesList = (option.series as unknown[] | undefined) || [];\n\n seriesList.forEach((_series, seriesIndex: number) => {\n chart.dispatchAction({\n seriesIndex,\n type: 'downplay',\n });\n });\n};\n\nconst highlightOrDownplayLineAndBarSeries = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change emphasis state to add opacity on the non highlighted items\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n emphasis: {\n ...(seriesItem.emphasis as Record<string, unknown>),\n disabled: isDownplay,\n },\n }),\n ),\n });\n\n const seriesWithSeriesIndex = allChartOptionSeries\n // Since the series index does not exist in the data we extract it from the series index\n ?.map((seriesItem, index) => ({\n ...seriesItem,\n seriesIndex: index,\n }))\n // Select the series that are in the currentSeriesToDispatch array\n ?.filter((seriesItem: Record<string, unknown>) =>\n currentSeriesToDispatch.some((series) => series.name === seriesItem.name),\n );\n\n if (!seriesWithSeriesIndex.length) {\n return;\n }\n\n chart?.dispatchAction({\n seriesIndex: seriesWithSeriesIndex.map((series) => series.seriesIndex),\n type: action,\n });\n};\n\n/**\n * Highlight or downplay pie chart dataset item\n */\nconst highlightOrDownplayPieSlices = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change blur state to add opacity on the non highlighted items in the pie chart\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n blur: {\n itemStyle: {\n opacity: isDownplay ? 1 : 0.3,\n },\n label: {\n opacity: isDownplay ? 1 : 0.3,\n },\n },\n }),\n ),\n });\n\n // The dataIndex that we want to dispatch can be found in the dataset[0] source array, where the first item is the name of the series\n const chartOptionDataset =\n currentChartOptions?.dataset as EChartsOption['dataset'];\n const datasetArray = Array.isArray(chartOptionDataset)\n ? chartOptionDataset\n : [chartOptionDataset];\n const sourceArray = datasetArray?.[0]?.source as unknown[][];\n\n // Find the dataIndexes that we want to dispatch\n const currentDataSeriesIndexes = currentSeriesToDispatch.map((series) => {\n const index = sourceArray?.findIndex((item) => item[0] === series.name) - 1;\n return index;\n });\n\n if (action === 'highlight') {\n // Downplay other data indexes to make sure the other slices are not highlighted\n const otherSeriesIndexes = sourceArray\n .map((_row, index) => index)\n .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));\n\n chart?.dispatchAction({\n seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0\n dataIndex: otherSeriesIndexes,\n type: 'downplay',\n });\n }\n\n chart?.dispatchAction({\n seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0\n dataIndex: currentDataSeriesIndexes,\n type: action,\n });\n};\n\n/**\n * Highlight or downplay the series in the chart to toggle between emphasized and non-emphasized state\n */\nconst highlightOrDownplaySeries = (\n chartRef: React.RefObject<HTMLDivElement | null>,\n series: { name: string; color: string }[],\n currentSelectedSeries: Record<string, boolean>,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n) => {\n const hasOnlyOneSeries = series.length === 1;\n\n const isOnlyOneSeriesSelected =\n Object.values(currentSelectedSeries).filter(Boolean).length === 1;\n\n if (\n isOnlyOneSeriesSelected ||\n currentSeriesToDispatch.length === 0 ||\n chartRef.current === null ||\n hasOnlyOneSeries\n ) {\n return;\n }\n\n const chart = getInstanceByDom(chartRef.current);\n\n if (!chart) {\n return;\n }\n const currentChartOptions = chart.getOption();\n\n const seriesType = (\n currentChartOptions?.series as Record<string, unknown>[]\n )?.[0]?.type;\n\n if (seriesType === 'pie') {\n highlightOrDownplayPieSlices(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n } else {\n highlightOrDownplayLineAndBarSeries(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n }\n};\n\nexport { highlightOrDownplaySeries };\n"]}
1
+ {"version":3,"file":"legend-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/legend-utils.ts"],"names":[],"mappings":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AAyC,EACzC,qBAA8C,EAC9C,uBAA0D,EAC1D,MAAgC,EAChC,EAAE;;IACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAE7C,MAAM,uBAAuB,GAC3B,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAEpE,IACE,uBAAuB;QACvB,uBAAuB,CAAC,MAAM,KAAK,CAAC;QACpC,QAAQ,CAAC,OAAO,KAAK,IAAI;QACzB,gBAAgB,EAChB,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAE9C,MAAM,UAAU,GAAG,MAAA,MACjB,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MACtB,0CAAG,CAAC,CAAC,0CAAE,IAAI,CAAC;IAEb,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,4BAA4B,CAC1B,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mCAAmC,CACjC,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,mBAAmB,CACpB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,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 {\n type EChartsOption,\n type EChartsType,\n getInstanceByDom,\n} from 'echarts';\n\nexport const resetAllSeriesHighlight = (chart: EChartsType) => {\n const option = chart.getOption();\n const seriesList = (option.series as unknown[] | undefined) || [];\n\n seriesList.forEach((_series, seriesIndex: number) => {\n chart.dispatchAction({\n seriesIndex,\n type: 'downplay',\n });\n });\n};\n\nconst highlightOrDownplayLineAndBarSeries = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change emphasis state to add opacity on the non highlighted items\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n emphasis: {\n ...(seriesItem.emphasis as Record<string, unknown>),\n disabled: isDownplay,\n },\n }),\n ),\n });\n\n const seriesWithSeriesIndex = allChartOptionSeries\n // Since the series index does not exist in the data we extract it from the series index\n ?.map((seriesItem, index) => ({\n ...seriesItem,\n seriesIndex: index,\n }))\n // Select the series that are in the currentSeriesToDispatch array\n ?.filter((seriesItem: Record<string, unknown>) =>\n currentSeriesToDispatch.some((series) => series.name === seriesItem.name),\n );\n\n if (!seriesWithSeriesIndex.length) {\n return;\n }\n\n chart?.dispatchAction({\n seriesIndex: seriesWithSeriesIndex.map((series) => series.seriesIndex),\n type: action,\n });\n};\n\n/**\n * Highlight or downplay pie chart dataset item\n */\nconst highlightOrDownplayPieSlices = (\n chart: EChartsType,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n currentChartOptions: ReturnType<EChartsType['getOption']>,\n) => {\n const isDownplay = action === 'downplay';\n const allChartOptionSeries =\n (currentChartOptions?.series as Record<string, unknown>[] | undefined) ||\n [];\n\n // Change blur state to add opacity on the non highlighted items in the pie chart\n chart?.setOption({\n series: allChartOptionSeries?.map(\n (seriesItem: Record<string, unknown>) => ({\n ...seriesItem,\n blur: {\n itemStyle: {\n opacity: isDownplay ? 1 : 0.3,\n },\n label: {\n opacity: isDownplay ? 1 : 0.3,\n },\n },\n }),\n ),\n });\n\n // The dataIndex that we want to dispatch can be found in the dataset[0] source array, where the first item is the name of the series\n const chartOptionDataset =\n currentChartOptions?.dataset as EChartsOption['dataset'];\n const datasetArray = Array.isArray(chartOptionDataset)\n ? chartOptionDataset\n : [chartOptionDataset];\n const sourceArray = datasetArray?.[0]?.source as unknown[][];\n\n // Find the dataIndexes that we want to dispatch\n const currentDataSeriesIndexes = currentSeriesToDispatch.map((series) => {\n const index = sourceArray?.findIndex((item) => item[0] === series.name) - 1;\n return index;\n });\n\n if (action === 'highlight') {\n // Downplay other data indexes to make sure the other slices are not highlighted\n const otherSeriesIndexes = sourceArray\n .map((_row, index) => index)\n .filter((dataIndex) => !currentDataSeriesIndexes.includes(dataIndex));\n\n chart?.dispatchAction({\n dataIndex: otherSeriesIndexes,\n seriesIndex: [0], // pie charts only has one series so seriesIndex is always 0\n type: 'downplay',\n });\n }\n\n chart?.dispatchAction({\n dataIndex: currentDataSeriesIndexes,\n seriesIndex: [0], // pie charts only has one series so otherSeriesIndexes is always 0\n type: action,\n });\n};\n\n/**\n * Highlight or downplay the series in the chart to toggle between emphasized and non-emphasized state\n */\nconst highlightOrDownplaySeries = (\n chartRef: React.RefObject<HTMLDivElement | null>,\n series: { name: string; color: string }[],\n currentSelectedSeries: Record<string, boolean>,\n currentSeriesToDispatch: { name: string; color: string }[],\n action: 'highlight' | 'downplay',\n) => {\n const hasOnlyOneSeries = series.length === 1;\n\n const isOnlyOneSeriesSelected =\n Object.values(currentSelectedSeries).filter(Boolean).length === 1;\n\n if (\n isOnlyOneSeriesSelected ||\n currentSeriesToDispatch.length === 0 ||\n chartRef.current === null ||\n hasOnlyOneSeries\n ) {\n return;\n }\n\n const chart = getInstanceByDom(chartRef.current);\n\n if (!chart) {\n return;\n }\n const currentChartOptions = chart.getOption();\n\n const seriesType = (\n currentChartOptions?.series as Record<string, unknown>[]\n )?.[0]?.type;\n\n if (seriesType === 'pie') {\n highlightOrDownplayPieSlices(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n } else {\n highlightOrDownplayLineAndBarSeries(\n chart,\n currentSeriesToDispatch,\n action,\n currentChartOptions,\n );\n }\n};\n\nexport { highlightOrDownplaySeries };\n"]}
@@ -41,7 +41,7 @@ export const mergeSeries = (series, theme = 'light', userOption, palette) => {
41
41
  // Needed to differentiate between normal lines and threshold lines
42
42
  // as we are unable to inject custom properties into echarts series lines.
43
43
  const thresholdLineName = `thresholdLine-${notificationType}`;
44
- return Object.assign(Object.assign({ symbolSize: 9, symbol: 'none', condition: defaultThresholdLineSeriesOption.condition }, option), { lineStyle: Object.assign({ width: 2, type: 'dashed' }, option.lineStyle), name: thresholdLineName, type: 'line', data: [
44
+ return Object.assign(Object.assign({ symbolSize: 9, symbol: 'none', condition: defaultThresholdLineSeriesOption.condition }, option), { lineStyle: Object.assign({ type: 'dashed', width: 2 }, option.lineStyle), name: thresholdLineName, type: 'line', data: [
45
45
  [option.xAxis[0], option.yAxis],
46
46
  [option.xAxis[1], option.yAxis],
47
47
  ] });
@@ -49,7 +49,7 @@ export const mergeSeries = (series, theme = 'light', userOption, palette) => {
49
49
  if (option.type === 'line') {
50
50
  const shadow = tokens.theme[theme].boxShadow.raised;
51
51
  const shadowParts = shadow.split(/ (?=\d+px|rgba?\()/);
52
- return Object.assign(Object.assign({ type: 'line', symbolSize: 9, color, symbol: 'none' }, option), { lineStyle: Object.assign({ width: 2, type: 'solid' }, option.lineStyle), emphasis: Object.assign(Object.assign(Object.assign({ disabled: true, focus: 'series' }, option.emphasis), { itemStyle: Object.assign({ borderColor: tokens.theme[theme].color.neutral.bg.weak, shadowOffsetX: parseInt(shadowParts[0]), shadowOffsetY: parseInt(shadowParts[1]), shadowBlur: parseInt(shadowParts[2]), shadowColor: shadowParts[4] }, (_b = option.emphasis) === null || _b === void 0 ? void 0 : _b.itemStyle), label: { show: false } }), option.emphasis) });
52
+ return Object.assign(Object.assign({ type: 'line', symbolSize: 9, color, symbol: 'none' }, option), { lineStyle: Object.assign({ type: 'solid', width: 2 }, option.lineStyle), emphasis: Object.assign(Object.assign(Object.assign({ disabled: true, focus: 'series' }, option.emphasis), { itemStyle: Object.assign({ borderColor: tokens.theme[theme].color.neutral.bg.weak, shadowBlur: parseInt(shadowParts[2]), shadowColor: shadowParts[4], shadowOffsetX: parseInt(shadowParts[0]), shadowOffsetY: parseInt(shadowParts[1]) }, (_b = option.emphasis) === null || _b === void 0 ? void 0 : _b.itemStyle), label: { show: false } }), option.emphasis) });
53
53
  }
54
54
  if (option.type === 'pie') {
55
55
  const valueFormatter = getTooltipValueFormatter(userOption);
@@ -58,7 +58,7 @@ export const mergeSeries = (series, theme = 'light', userOption, palette) => {
58
58
  // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)
59
59
  blur: Object.assign({ itemStyle: Object.assign({ opacity: 1 }, (_c = option.blur) === null || _c === void 0 ? void 0 : _c.itemStyle), label: Object.assign({ opacity: 1 }, (_d = option.blur) === null || _d === void 0 ? void 0 : _d.label) }, option.blur),
60
60
  // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.
61
- emphasis: Object.assign({ disabled: false, focus: 'self', scale: true, scaleSize: 5 }, option.emphasis), itemStyle: Object.assign({ borderColor: tokens.theme[theme].color.neutral.bg.weak, borderWidth: 1 }, option.itemStyle), label: Object.assign({ formatter: '{d}%', backgroundColor: 'transparent', color: tokens.theme[theme].color.neutral.text.weak }, option.label), labelLine: Object.assign({ length: 5, show: true }, option.labelLine), tooltip: Object.assign({ trigger: 'item', confine: true,
61
+ emphasis: Object.assign({ disabled: false, focus: 'self', scale: true, scaleSize: 5 }, option.emphasis), itemStyle: Object.assign({ borderColor: tokens.theme[theme].color.neutral.bg.weak, borderWidth: 1 }, option.itemStyle), label: Object.assign({ backgroundColor: 'transparent', color: tokens.theme[theme].color.neutral.text.weak, formatter: '{d}%' }, option.label), labelLine: Object.assign({ length: 5, show: true }, option.labelLine), tooltip: Object.assign({ trigger: 'item', confine: true,
62
62
  // Reset the default tooltip css styling
63
63
  padding: 0, borderRadius: 0, borderWidth: 0, extraCssText: 'box-shadow: none; background-color: transparent;', formatter: function (params) {
64
64
  var _a, _b;
@@ -71,7 +71,7 @@ export const mergeSeries = (series, theme = 'light', userOption, palette) => {
71
71
  }
72
72
  if (option.type === 'bar') {
73
73
  const valueFormatter = getTooltipValueFormatter(userOption);
74
- 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: {
74
+ 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({ borderWidth: 20, color }, option.itemStyle), markLine: {
75
75
  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),
76
76
  lineStyle: Object.assign({ width: 20 }, (_j = option.markLine) === null || _j === void 0 ? void 0 : _j.lineStyle),
77
77
  }, tooltip: Object.assign({ trigger: 'axis', confine: true,
@@ -96,7 +96,7 @@ export const mergeXAxis = (xAxis, theme = 'light') => {
96
96
  if (Array.isArray(xAxis)) {
97
97
  return xAxis.map((axis) => mergeXAxis(axis, theme));
98
98
  }
99
- const baseXAxis = Object.assign(Object.assign({}, xAxis), { splitLine: Object.assign({ show: false }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.splitLine), axisLine: Object.assign({ lineStyle: Object.assign({}, (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle) }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine), axisTick: Object.assign(Object.assign(Object.assign({}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), { lineStyle: Object.assign({}, (_b = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle), show: true }), xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), axisLabel: Object.assign({ margin: 16, formatter: {
99
+ const baseXAxis = Object.assign(Object.assign({}, xAxis), { axisLabel: Object.assign({ formatter: {
100
100
  day: '{dd} {MMM}',
101
101
  hour: '{HH}:{mm}',
102
102
  millisecond: '{hh}:{mm}:{ss} {SSS}',
@@ -105,7 +105,7 @@ export const mergeXAxis = (xAxis, theme = 'light') => {
105
105
  none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',
106
106
  second: '{HH}:{mm}:{ss}',
107
107
  year: '{yearStyle|{yyyy}}\n{monthStyle|{MMM}}',
108
- }, overflow: 'truncate' }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLabel) });
108
+ }, margin: 16, overflow: 'truncate' }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLabel), axisLine: Object.assign({ lineStyle: Object.assign({}, (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle) }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine), axisTick: Object.assign(Object.assign(Object.assign({}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), { lineStyle: Object.assign({}, (_b = xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle), show: true }), xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), splitLine: Object.assign({ show: false }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.splitLine) });
109
109
  if (xAxis.type === 'time') {
110
110
  const timeXAxis = Object.assign(Object.assign({}, baseXAxis), { axisLabel: Object.assign({ hideOverlap: true }, baseXAxis.axisLabel) });
111
111
  return timeXAxis;
@@ -118,7 +118,7 @@ export const mergeXAxis = (xAxis, theme = 'light') => {
118
118
  return valueXAxis;
119
119
  }
120
120
  if (xAxis.type === 'category') {
121
- const categoryXAxis = Object.assign(Object.assign({}, baseXAxis), { axisTick: Object.assign({ alignWithLabel: true }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisTick), axisLabel: Object.assign({ width: 80 }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisLabel) });
121
+ const categoryXAxis = Object.assign(Object.assign({}, baseXAxis), { axisLabel: Object.assign({ width: 80 }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisLabel), axisTick: Object.assign({ alignWithLabel: true }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisTick) });
122
122
  return categoryXAxis;
123
123
  }
124
124
  return baseXAxis;
@@ -131,7 +131,7 @@ export const mergeYAxis = (yAxis, theme = 'light') => {
131
131
  if (Array.isArray(yAxis)) {
132
132
  return yAxis.map((axis) => mergeYAxis(axis, theme));
133
133
  }
134
- const baseYAxis = Object.assign(Object.assign({}, yAxis), { axisLine: Object.assign(Object.assign({}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine), { lineStyle: Object.assign({}, (_a = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle), show: true }), axisTick: Object.assign(Object.assign({ show: false }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick), { lineStyle: Object.assign({ width: 1 }, (_b = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle) }), axisLabel: Object.assign({ margin: 8, overflow: 'truncate' }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLabel), splitLine: Object.assign({ show: true }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.splitLine) });
134
+ const baseYAxis = Object.assign(Object.assign({}, yAxis), { axisLabel: Object.assign({ margin: 8, overflow: 'truncate' }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLabel), axisLine: Object.assign(Object.assign({}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine), { lineStyle: Object.assign({}, (_a = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine) === null || _a === void 0 ? void 0 : _a.lineStyle), show: true }), axisTick: Object.assign(Object.assign({ show: false }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick), { lineStyle: Object.assign({ width: 1 }, (_b = yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick) === null || _b === void 0 ? void 0 : _b.lineStyle) }), splitLine: Object.assign({ show: true }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.splitLine) });
135
135
  if (yAxis.type === 'time') {
136
136
  const timeYAxis = Object.assign(Object.assign({}, baseYAxis), { axisLabel: Object.assign({ hideOverlap: true }, baseYAxis.axisLabel), splitLine: Object.assign({ show: false }, baseYAxis === null || baseYAxis === void 0 ? void 0 : baseYAxis.splitLine) });
137
137
  return timeYAxis;
@@ -1 +1 @@
1
- {"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAA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oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,EACD,IAAI,EAAE,IAAI,GACX;SACF;KACF,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\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport { ChartTooltip } from '../ChartTooltip';\nimport { getTooltipValueFormatter } from './chart-tooltip-formatter';\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { formatNumberEnUS } from './format-utils';\n\nconst defaultColors = Object.values(tokens.categorical);\n\ntype SingleXAxisOption = Exclude<\n NonNullable<EChartsOption['xAxis']>,\n unknown[]\n>;\ntype SingleYAxisOption = Exclude<\n NonNullable<EChartsOption['yAxis']>,\n unknown[]\n>;\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 palette?: HexColor[],\n): EchartsSeries => {\n const colors = palette ?? defaultColors;\n\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 % colors.length]);\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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 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((axis) =>\n mergeXAxis(axis, theme),\n ) as EChartsOption['xAxis'];\n }\n\n const baseXAxis = {\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 day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n minute: '{HH}:{mm}',\n month: '{MMM}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n second: '{HH}:{mm}:{ss}',\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n } as SingleXAxisOption;\n\n if (xAxis.type === 'time') {\n const timeXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n } as SingleXAxisOption;\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const xAxisFormatter =\n xAxis.axisLabel && 'formatter' in xAxis.axisLabel\n ? xAxis.axisLabel.formatter\n : undefined;\n const valueXAxis = {\n ...baseXAxis,\n axisLabel: {\n ...baseXAxis.axisLabel,\n formatter: xAxisFormatter ?? formatNumberEnUS,\n },\n } as SingleXAxisOption;\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...baseXAxis?.axisTick,\n },\n axisLabel: {\n width: 80,\n ...baseXAxis?.axisLabel,\n },\n } as SingleXAxisOption;\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((axis) =>\n mergeYAxis(axis, theme),\n ) as EChartsOption['yAxis'];\n }\n\n const baseYAxis = {\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 } as SingleYAxisOption;\n\n if (yAxis.type === 'time') {\n const timeYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const yAxisFormatter =\n yAxis.axisLabel && 'formatter' in yAxis.axisLabel\n ? yAxis.axisLabel.formatter\n : undefined;\n const valueYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n formatter: yAxisFormatter ?? formatNumberEnUS,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...baseYAxis?.axisLabel,\n },\n } as SingleYAxisOption;\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\ntype SingleDataZoomOption = Exclude<\n NonNullable<EChartsOption['dataZoom']>,\n unknown[]\n>;\n\ntype MergeDataZoomAxes = {\n xAxis?: EChartsOption['xAxis'];\n yAxis?: EChartsOption['yAxis'];\n};\n\nexport type DataZoomTargetAxes = {\n xAxisIndices: number[];\n yAxisIndices: number[];\n};\n\nconst normalizeAxisIndices = (axisIndex: unknown): number[] => {\n if (typeof axisIndex === 'number') {\n return [axisIndex];\n }\n\n if (Array.isArray(axisIndex)) {\n return axisIndex.filter((index): index is number => {\n return typeof index === 'number';\n });\n }\n\n return [];\n};\n\n/**\n * Resolves the axes a single dataZoom entry targets, mirroring ECharts' own\n * resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning\n * \"not this axis\"); when no index is given, `orient: 'vertical'` targets the\n * first y-axis and horizontal/unset targets the first x-axis.\n */\nconst getSingleDataZoomTargets = (\n dataZoom: SingleDataZoomOption | undefined,\n): DataZoomTargetAxes => {\n if (dataZoom?.type !== 'slider' && dataZoom?.type !== 'inside') {\n return { xAxisIndices: [], yAxisIndices: [] };\n }\n\n const hasAxisIndex =\n dataZoom.xAxisIndex !== undefined || dataZoom.yAxisIndex !== undefined;\n\n if (hasAxisIndex) {\n return {\n xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),\n yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex),\n };\n }\n\n return dataZoom.orient === 'vertical'\n ? { xAxisIndices: [], yAxisIndices: [0] }\n : { xAxisIndices: [0], yAxisIndices: [] };\n};\n\n/**\n * Union of the axis indices targeted by all slider/inside entries in a\n * dataZoom config, using the same per-entry resolution as ECharts (explicit\n * axis indices first, then orientation).\n */\nexport const getDataZoomTargetAxes = (\n dataZoom: EChartsOption['dataZoom'],\n): DataZoomTargetAxes => {\n const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n const targets: DataZoomTargetAxes = { xAxisIndices: [], yAxisIndices: [] };\n\n for (const entry of entries) {\n const entryTargets = getSingleDataZoomTargets(entry);\n\n for (const index of entryTargets.xAxisIndices) {\n if (!targets.xAxisIndices.includes(index)) {\n targets.xAxisIndices.push(index);\n }\n }\n\n for (const index of entryTargets.yAxisIndices) {\n if (!targets.yAxisIndices.includes(index)) {\n targets.yAxisIndices.push(index);\n }\n }\n }\n\n return targets;\n};\n\n/**\n * A slider is vertical when the consumer sets `orient: 'vertical'`, or when it\n * only targets a y-axis, which makes ECharts infer the vertical orientation.\n */\nexport const isVerticalSlider = (\n dataZoom: SingleDataZoomOption | undefined,\n): boolean => {\n if (dataZoom?.type !== 'slider') {\n return false;\n }\n\n if (dataZoom.orient !== undefined) {\n return dataZoom.orient === 'vertical';\n }\n\n const targets = getSingleDataZoomTargets(dataZoom);\n\n return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;\n};\n\n/**\n * Axis types where windowing (`filterMode: 'none'`) beats ECharts' default\n * data filtering. Filtering a continuous axis removes whole data items outside\n * the window, which makes bars and points vanish instead of clipping them.\n * Category axes keep the `'filter'` default so paging through categories still\n * rescales the opposite value axis to the visible data.\n */\nconst WINDOWED_FILTER_AXIS_TYPES = ['log', 'time', 'value'];\n\nconst getSingleAxisOption = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndex: unknown,\n): { type?: string } | undefined => {\n if (!Array.isArray(axis)) {\n return axis as { type?: string } | undefined;\n }\n\n const index =\n typeof axisIndex === 'number'\n ? axisIndex\n : Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'\n ? axisIndex[0]\n : 0;\n\n return axis[index] as { type?: string } | undefined;\n};\n\n/**\n * Resolves the slider's target axis the way ECharts does (explicit axis index\n * first, then orientation) and returns `'none'` when that axis is continuous.\n * Returns `undefined` (keep ECharts' `'filter'` default) for category axes and\n * for sliders that target both axes at once.\n */\nconst getSliderDefaultFilterMode = (\n dataZoom: SingleDataZoomOption,\n axes: MergeDataZoomAxes | undefined,\n): 'none' | undefined => {\n const targets = getSingleDataZoomTargets(dataZoom);\n const isXAxisTarget = targets.xAxisIndices.length > 0;\n const isYAxisTarget = targets.yAxisIndices.length > 0;\n\n if (isXAxisTarget === isYAxisTarget) {\n return undefined;\n }\n\n const targetAxis = isYAxisTarget\n ? getSingleAxisOption(axes?.yAxis, dataZoom.yAxisIndex)\n : getSingleAxisOption(axes?.xAxis, dataZoom.xAxisIndex);\n\n return targetAxis?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)\n ? 'none'\n : undefined;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n axes?: MergeDataZoomAxes,\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option, axes),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n const filterMode = getSliderDefaultFilterMode(dataZoom, axes);\n const layoutDefaults = isVerticalSlider(dataZoom)\n ? { right: 10, width: 28 }\n : { bottom: 10, height: 28 };\n\n return {\n ...(filterMode !== undefined && { filterMode }),\n ...layoutDefaults,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n // Only pin the default x-axis binding on entries that actually target the\n // x-axis; y-targeting entries (explicit `yAxisIndex` or\n // `orient: 'vertical'`) keep their own binding.\n const targets = getSingleDataZoomTargets(dataZoom);\n const hasDefaultXAxisTarget =\n dataZoom.xAxisIndex === undefined && targets.xAxisIndices.length > 0;\n\n return {\n filterMode: 'none',\n ...(hasDefaultXAxisTarget && { xAxisIndex: [0] }),\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\ntype MergeToolboxContext = MergeDataZoomAxes & {\n dataZoom?: EChartsOption['dataZoom'];\n};\n\nconst isContinuousAxisOption = (\n axisOption: { type?: string } | undefined,\n): boolean => {\n return (\n axisOption?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type)\n );\n};\n\nconst areTargetAxesContinuous = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndices: number[] | 'all',\n): boolean => {\n if (axisIndices === 'all') {\n const axisOptions = Array.isArray(axis) ? axis : [axis];\n\n return (\n axisOptions.length > 0 &&\n axisOptions.every((axisOption) => {\n return isContinuousAxisOption(axisOption as { type?: string });\n })\n );\n }\n\n return axisIndices.every((axisIndex) => {\n return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));\n });\n};\n\n/**\n * Returns `'none'` when every axis targeted by the drag-to-zoom brush is\n * continuous (`value`/`time`/`log`), matching the slider rule: filtering a\n * continuous axis removes whole data items outside the selection instead of\n * clipping them. Category (or unknown) targets keep ECharts' `'filter'`\n * default.\n */\nconst getBrushDefaultFilterMode = (\n context: MergeToolboxContext | undefined,\n xAxisTargets: number[] | 'all' | false,\n yAxisTargets: number[] | 'all' | false,\n): 'none' | undefined => {\n const checks: boolean[] = [];\n\n if (xAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.xAxis, xAxisTargets));\n }\n\n if (yAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.yAxis, yAxisTargets));\n }\n\n return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n context?: MergeToolboxContext,\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option, context),\n ) as EChartsOption['toolbox'];\n }\n\n // The drag-to-zoom brush follows the axes the dataZoom config targets, so\n // zoom direction is configured in one place. Without any dataZoom config it\n // keeps the historical default: all x-axes on, y off.\n const targets = getDataZoomTargetAxes(context?.dataZoom);\n const hasTargets =\n targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0;\n const xAxisTargets: number[] | 'all' | false = hasTargets\n ? targets.xAxisIndices.length > 0 && targets.xAxisIndices\n : 'all';\n const yAxisTargets: number[] | false =\n targets.yAxisIndices.length > 0 && targets.yAxisIndices;\n const filterMode = getBrushDefaultFilterMode(\n context,\n xAxisTargets,\n yAxisTargets,\n );\n\n return {\n feature: {\n dataZoom: {\n ...(filterMode !== undefined && { filterMode }),\n ...(xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets }),\n yAxisIndex: yAxisTargets,\n ...toolbox?.feature?.dataZoom,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n show: true,\n },\n },\n };\n};\n"]}
1
+ {"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAOrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAWxD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAoB,EACpB,QAA0B,OAAO,EACjC,UAGC,EACD,OAAoB,EACL,EAAE;IACjB,MAAM,MAAM,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O,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,CAAC;IACzD,MAAM,UAAU,GACd,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACrE,MAAM,YAAY,GAA6B,UAAU;QACvD,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY;QACzD,CAAC,CAAC,KAAK,CAAC;IACV,MAAM,YAAY,GAChB,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC;IAC1D,MAAM,UAAU,GAAG,yBAAyB,CAC1C,OAAO,EACP,YAAY,EACZ,YAAY,CACb,CAAC;IAEF,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,4EACH,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC,GAC5C,CAAC,YAAY,KAAK,KAAK,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,KAC3D,UAAU,EAAE,YAAY,KACrB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,EACD,IAAI,EAAE,IAAI,GACX;SACF;KACF,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\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport { ChartTooltip } from '../ChartTooltip';\nimport { getTooltipValueFormatter } from './chart-tooltip-formatter';\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { formatNumberEnUS } from './format-utils';\n\nconst defaultColors = Object.values(tokens.categorical);\n\ntype SingleXAxisOption = Exclude<\n NonNullable<EChartsOption['xAxis']>,\n unknown[]\n>;\ntype SingleYAxisOption = Exclude<\n NonNullable<EChartsOption['yAxis']>,\n unknown[]\n>;\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 palette?: HexColor[],\n): EchartsSeries => {\n const colors = palette ?? defaultColors;\n\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 % colors.length]);\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 type: 'dashed',\n width: 2,\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 type: 'solid' as const,\n width: 2,\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 shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n const valueFormatter = getTooltipValueFormatter(userOption);\n\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 backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n formatter: '{d}%',\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 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 const valueFormatter = getTooltipValueFormatter(userOption);\n\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 borderWidth: 20,\n color,\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 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((axis) =>\n mergeXAxis(axis, theme),\n ) as EChartsOption['xAxis'];\n }\n\n const baseXAxis = {\n ...xAxis,\n axisLabel: {\n formatter: {\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n minute: '{HH}:{mm}',\n month: '{MMM}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n second: '{HH}:{mm}:{ss}',\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n },\n margin: 16,\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\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 splitLine: { show: false, ...xAxis?.splitLine },\n } as SingleXAxisOption;\n\n if (xAxis.type === 'time') {\n const timeXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n } as SingleXAxisOption;\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const xAxisFormatter =\n xAxis.axisLabel && 'formatter' in xAxis.axisLabel\n ? xAxis.axisLabel.formatter\n : undefined;\n const valueXAxis = {\n ...baseXAxis,\n axisLabel: {\n ...baseXAxis.axisLabel,\n formatter: xAxisFormatter ?? formatNumberEnUS,\n },\n } as SingleXAxisOption;\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis = {\n ...baseXAxis,\n axisLabel: {\n width: 80,\n ...baseXAxis?.axisLabel,\n },\n axisTick: {\n alignWithLabel: true,\n ...baseXAxis?.axisTick,\n },\n } as SingleXAxisOption;\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((axis) =>\n mergeYAxis(axis, theme),\n ) as EChartsOption['yAxis'];\n }\n\n const baseYAxis = {\n ...yAxis,\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\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 splitLine: { show: true, ...yAxis?.splitLine },\n } as SingleYAxisOption;\n\n if (yAxis.type === 'time') {\n const timeYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const yAxisFormatter =\n yAxis.axisLabel && 'formatter' in yAxis.axisLabel\n ? yAxis.axisLabel.formatter\n : undefined;\n const valueYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n formatter: yAxisFormatter ?? formatNumberEnUS,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n } as SingleYAxisOption;\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...baseYAxis?.axisLabel,\n },\n } as SingleYAxisOption;\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\ntype SingleDataZoomOption = Exclude<\n NonNullable<EChartsOption['dataZoom']>,\n unknown[]\n>;\n\ntype MergeDataZoomAxes = {\n xAxis?: EChartsOption['xAxis'];\n yAxis?: EChartsOption['yAxis'];\n};\n\nexport type DataZoomTargetAxes = {\n xAxisIndices: number[];\n yAxisIndices: number[];\n};\n\nconst normalizeAxisIndices = (axisIndex: unknown): number[] => {\n if (typeof axisIndex === 'number') {\n return [axisIndex];\n }\n\n if (Array.isArray(axisIndex)) {\n return axisIndex.filter((index): index is number => {\n return typeof index === 'number';\n });\n }\n\n return [];\n};\n\n/**\n * Resolves the axes a single dataZoom entry targets, mirroring ECharts' own\n * resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning\n * \"not this axis\"); when no index is given, `orient: 'vertical'` targets the\n * first y-axis and horizontal/unset targets the first x-axis.\n */\nconst getSingleDataZoomTargets = (\n dataZoom: SingleDataZoomOption | undefined,\n): DataZoomTargetAxes => {\n if (dataZoom?.type !== 'slider' && dataZoom?.type !== 'inside') {\n return { xAxisIndices: [], yAxisIndices: [] };\n }\n\n const hasAxisIndex =\n dataZoom.xAxisIndex !== undefined || dataZoom.yAxisIndex !== undefined;\n\n if (hasAxisIndex) {\n return {\n xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),\n yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex),\n };\n }\n\n return dataZoom.orient === 'vertical'\n ? { xAxisIndices: [], yAxisIndices: [0] }\n : { xAxisIndices: [0], yAxisIndices: [] };\n};\n\n/**\n * Union of the axis indices targeted by all slider/inside entries in a\n * dataZoom config, using the same per-entry resolution as ECharts (explicit\n * axis indices first, then orientation).\n */\nexport const getDataZoomTargetAxes = (\n dataZoom: EChartsOption['dataZoom'],\n): DataZoomTargetAxes => {\n const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n const targets: DataZoomTargetAxes = { xAxisIndices: [], yAxisIndices: [] };\n\n for (const entry of entries) {\n const entryTargets = getSingleDataZoomTargets(entry);\n\n for (const index of entryTargets.xAxisIndices) {\n if (!targets.xAxisIndices.includes(index)) {\n targets.xAxisIndices.push(index);\n }\n }\n\n for (const index of entryTargets.yAxisIndices) {\n if (!targets.yAxisIndices.includes(index)) {\n targets.yAxisIndices.push(index);\n }\n }\n }\n\n return targets;\n};\n\n/**\n * A slider is vertical when the consumer sets `orient: 'vertical'`, or when it\n * only targets a y-axis, which makes ECharts infer the vertical orientation.\n */\nexport const isVerticalSlider = (\n dataZoom: SingleDataZoomOption | undefined,\n): boolean => {\n if (dataZoom?.type !== 'slider') {\n return false;\n }\n\n if (dataZoom.orient !== undefined) {\n return dataZoom.orient === 'vertical';\n }\n\n const targets = getSingleDataZoomTargets(dataZoom);\n\n return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;\n};\n\n/**\n * Axis types where windowing (`filterMode: 'none'`) beats ECharts' default\n * data filtering. Filtering a continuous axis removes whole data items outside\n * the window, which makes bars and points vanish instead of clipping them.\n * Category axes keep the `'filter'` default so paging through categories still\n * rescales the opposite value axis to the visible data.\n */\nconst WINDOWED_FILTER_AXIS_TYPES = ['log', 'time', 'value'];\n\nconst getSingleAxisOption = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndex: unknown,\n): { type?: string } | undefined => {\n if (!Array.isArray(axis)) {\n return axis as { type?: string } | undefined;\n }\n\n const index =\n typeof axisIndex === 'number'\n ? axisIndex\n : Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'\n ? axisIndex[0]\n : 0;\n\n return axis[index] as { type?: string } | undefined;\n};\n\n/**\n * Resolves the slider's target axis the way ECharts does (explicit axis index\n * first, then orientation) and returns `'none'` when that axis is continuous.\n * Returns `undefined` (keep ECharts' `'filter'` default) for category axes and\n * for sliders that target both axes at once.\n */\nconst getSliderDefaultFilterMode = (\n dataZoom: SingleDataZoomOption,\n axes: MergeDataZoomAxes | undefined,\n): 'none' | undefined => {\n const targets = getSingleDataZoomTargets(dataZoom);\n const isXAxisTarget = targets.xAxisIndices.length > 0;\n const isYAxisTarget = targets.yAxisIndices.length > 0;\n\n if (isXAxisTarget === isYAxisTarget) {\n return undefined;\n }\n\n const targetAxis = isYAxisTarget\n ? getSingleAxisOption(axes?.yAxis, dataZoom.yAxisIndex)\n : getSingleAxisOption(axes?.xAxis, dataZoom.xAxisIndex);\n\n return targetAxis?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)\n ? 'none'\n : undefined;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n axes?: MergeDataZoomAxes,\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option, axes),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n const filterMode = getSliderDefaultFilterMode(dataZoom, axes);\n const layoutDefaults = isVerticalSlider(dataZoom)\n ? { right: 10, width: 28 }\n : { bottom: 10, height: 28 };\n\n return {\n ...(filterMode !== undefined && { filterMode }),\n ...layoutDefaults,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n // Only pin the default x-axis binding on entries that actually target the\n // x-axis; y-targeting entries (explicit `yAxisIndex` or\n // `orient: 'vertical'`) keep their own binding.\n const targets = getSingleDataZoomTargets(dataZoom);\n const hasDefaultXAxisTarget =\n dataZoom.xAxisIndex === undefined && targets.xAxisIndices.length > 0;\n\n return {\n filterMode: 'none',\n ...(hasDefaultXAxisTarget && { xAxisIndex: [0] }),\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\ntype MergeToolboxContext = MergeDataZoomAxes & {\n dataZoom?: EChartsOption['dataZoom'];\n};\n\nconst isContinuousAxisOption = (\n axisOption: { type?: string } | undefined,\n): boolean => {\n return (\n axisOption?.type !== undefined &&\n WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type)\n );\n};\n\nconst areTargetAxesContinuous = (\n axis: EChartsOption['xAxis'] | EChartsOption['yAxis'],\n axisIndices: number[] | 'all',\n): boolean => {\n if (axisIndices === 'all') {\n const axisOptions = Array.isArray(axis) ? axis : [axis];\n\n return (\n axisOptions.length > 0 &&\n axisOptions.every((axisOption) => {\n return isContinuousAxisOption(axisOption as { type?: string });\n })\n );\n }\n\n return axisIndices.every((axisIndex) => {\n return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));\n });\n};\n\n/**\n * Returns `'none'` when every axis targeted by the drag-to-zoom brush is\n * continuous (`value`/`time`/`log`), matching the slider rule: filtering a\n * continuous axis removes whole data items outside the selection instead of\n * clipping them. Category (or unknown) targets keep ECharts' `'filter'`\n * default.\n */\nconst getBrushDefaultFilterMode = (\n context: MergeToolboxContext | undefined,\n xAxisTargets: number[] | 'all' | false,\n yAxisTargets: number[] | 'all' | false,\n): 'none' | undefined => {\n const checks: boolean[] = [];\n\n if (xAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.xAxis, xAxisTargets));\n }\n\n if (yAxisTargets !== false) {\n checks.push(areTargetAxesContinuous(context?.yAxis, yAxisTargets));\n }\n\n return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n context?: MergeToolboxContext,\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option, context),\n ) as EChartsOption['toolbox'];\n }\n\n // The drag-to-zoom brush follows the axes the dataZoom config targets, so\n // zoom direction is configured in one place. Without any dataZoom config it\n // keeps the historical default: all x-axes on, y off.\n const targets = getDataZoomTargetAxes(context?.dataZoom);\n const hasTargets =\n targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0;\n const xAxisTargets: number[] | 'all' | false = hasTargets\n ? targets.xAxisIndices.length > 0 && targets.xAxisIndices\n : 'all';\n const yAxisTargets: number[] | false =\n targets.yAxisIndices.length > 0 && targets.yAxisIndices;\n const filterMode = getBrushDefaultFilterMode(\n context,\n xAxisTargets,\n yAxisTargets,\n );\n\n return {\n feature: {\n dataZoom: {\n ...(filterMode !== undefined && { filterMode }),\n ...(xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets }),\n yAxisIndex: yAxisTargets,\n ...toolbox?.feature?.dataZoom,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n show: true,\n },\n },\n };\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react-charts",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of charts from Neo4j Design System",
6
6
  "keywords": [
@@ -56,8 +56,8 @@
56
56
  "peerDependencies": {
57
57
  "react": ">=19.0.0",
58
58
  "react-dom": ">=19.0.0",
59
- "@neo4j-ndl/base": "^4.20.2",
60
- "@neo4j-ndl/react": "^4.21.2"
59
+ "@neo4j-ndl/base": "^4.21.0",
60
+ "@neo4j-ndl/react": "^4.22.0"
61
61
  },
62
62
  "dependencies": {
63
63
  "classnames": "2.5.1",