@neo4j-ndl/react-charts 1.2.14 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/cjs/charts/Chart.js +20 -0
  2. package/lib/cjs/charts/Chart.js.map +1 -1
  3. package/lib/cjs/charts/ChartRender.js +1 -3
  4. package/lib/cjs/charts/ChartRender.js.map +1 -1
  5. package/lib/cjs/charts/hooks/use-chart-option.js +1 -3
  6. package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
  7. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +78 -0
  8. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -0
  9. package/lib/cjs/charts/utils/build-chart-option.js +48 -16
  10. package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
  11. package/lib/cjs/charts/utils/user-option-utils.js +171 -8
  12. package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
  13. package/lib/esm/charts/Chart.js +20 -0
  14. package/lib/esm/charts/Chart.js.map +1 -1
  15. package/lib/esm/charts/ChartRender.js +2 -4
  16. package/lib/esm/charts/ChartRender.js.map +1 -1
  17. package/lib/esm/charts/hooks/use-chart-option.js +1 -3
  18. package/lib/esm/charts/hooks/use-chart-option.js.map +1 -1
  19. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +74 -0
  20. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -0
  21. package/lib/esm/charts/utils/build-chart-option.js +46 -16
  22. package/lib/esm/charts/utils/build-chart-option.js.map +1 -1
  23. package/lib/esm/charts/utils/user-option-utils.js +168 -7
  24. package/lib/esm/charts/utils/user-option-utils.js.map +1 -1
  25. package/lib/types/charts/Chart.d.ts +20 -0
  26. package/lib/types/charts/Chart.d.ts.map +1 -1
  27. package/lib/types/charts/ChartRender.d.ts.map +1 -1
  28. package/lib/types/charts/hooks/use-chart-option.d.ts +1 -2
  29. package/lib/types/charts/hooks/use-chart-option.d.ts.map +1 -1
  30. package/lib/types/charts/tests/HorizontalBarWithVerticalSlider.d.ts +38 -0
  31. package/lib/types/charts/tests/HorizontalBarWithVerticalSlider.d.ts.map +1 -0
  32. package/lib/types/charts/utils/build-chart-option.d.ts +17 -4
  33. package/lib/types/charts/utils/build-chart-option.d.ts.map +1 -1
  34. package/lib/types/charts/utils/user-option-utils.d.ts +26 -2
  35. package/lib/types/charts/utils/user-option-utils.d.ts.map +1 -1
  36. package/package.json +3 -3
  37. package/skills/ndl-react-charts/SKILL.md +1 -1
  38. package/skills/ndl-react-charts/components/charts.md +195 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalBarWithVerticalSlider.js","sourceRoot":"","sources":["../../../../src/charts/tests/HorizontalBarWithVerticalSlider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,WAAW;CACZ,CAAC;AAEF,MAAM,OAAO,GAAG;IACd;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;QAC5B,MAAM,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,GAAG;YACH,EAAE,GAAG,KAAK,GAAG,EAAE;SAChB,CAAC;KACH;CACF,CAAC;AAgBF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC5D,OAAO,OAAO,YAAY,WAAW,CAAC,CAAC,C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AAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAC3D,GACE,CACP,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 { Chart } from '@neo4j-ndl/react-charts';\nimport { getInstanceByDom } from 'echarts';\nimport { useEffect } from 'react';\n\nexport const verticalSliderCategories = [\n 'Friday',\n 'Saturday',\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday II',\n];\n\nconst dataset = [\n {\n dimensions: ['day', 'First'],\n source: verticalSliderCategories.map((day, index) => [\n day,\n 10 + index * 12,\n ]),\n },\n];\n\nexport type VerticalSliderHarnessApi = {\n /** Resolved layout of the first dataZoom component and the grid. */\n getResolvedLayout: () => {\n grid: { right?: number | string };\n slider: Record<string, unknown>;\n };\n /** Applies a zoom window through the slider's dataZoom action. */\n zoomTo: (start: number, end: number) => void;\n};\n\ntype HarnessWindow = Window & {\n verticalSliderHarness?: VerticalSliderHarnessApi;\n};\n\nconst getChart = () => {\n const element = document.querySelector('.ndl-chart-echart');\n return element instanceof HTMLElement ? getInstanceByDom(element) : undefined;\n};\n\n/**\n * Horizontal bar chart (value x-axis, category y-axis) with a slider bound to\n * the category axis, which Needle lays out as a vertical slider on the right.\n */\nexport const HorizontalBarWithVerticalSlider = () => {\n useEffect(() => {\n (window as HarnessWindow).verticalSliderHarness = {\n getResolvedLayout: () => {\n const option = getChart()?.getOption() as\n | {\n dataZoom?: Record<string, unknown>[];\n grid?: { right?: number | string }[];\n }\n | undefined;\n\n return {\n grid: option?.grid?.[0] ?? {},\n slider: option?.dataZoom?.[0] ?? {},\n };\n },\n zoomTo: (start: number, end: number) => {\n getChart()?.dispatchAction({ end, start, type: 'dataZoom' });\n },\n };\n }, []);\n\n return (\n <div style={{ height: '420px', width: '760px' }}>\n <Chart\n dataset={dataset}\n series={[\n // oxlint-disable-next-line\n { encode: { x: 'First', y: 'day' }, name: 'First', type: 'bar' },\n ]}\n xAxis={{ type: 'value' }}\n yAxis={{ type: 'category' }}\n option={{ dataZoom: [{ type: 'slider', yAxisIndex: [0] }] }}\n />\n </div>\n );\n};\n"]}
@@ -20,18 +20,23 @@
20
20
  */
21
21
  import { generateThresholdAriaDescription } from './aria-description';
22
22
  import { createAxisTooltipFormatter } from './chart-tooltip-formatter';
23
- import { mergeToolbox } from './user-option-utils';
23
+ import { isVerticalSlider, mergeToolbox } from './user-option-utils';
24
24
  const SLIDER_OUTER_BOUND_GAP = 8;
25
25
  const SLIDER_OUTER_BOUND_FALLBACK = 60;
26
+ const toDataZoomArray = (dataZoom) => Array.isArray(dataZoom) ? dataZoom : [dataZoom];
26
27
  /**
27
- * Slider zoom needs extra bottom grid space for ECharts' slider control.
28
+ * Horizontal slider zoom needs extra bottom grid space for ECharts' slider
29
+ * control.
28
30
  */
29
- export function hasSliderDataZoom(dataZoom) {
30
- return Array.isArray(dataZoom)
31
- ? dataZoom.some((dataZoomOption) => {
32
- return (dataZoomOption === null || dataZoomOption === void 0 ? void 0 : dataZoomOption.type) === 'slider';
33
- })
34
- : (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) === 'slider';
31
+ export function hasHorizontalSliderZoom(dataZoom) {
32
+ return toDataZoomArray(dataZoom).some((dataZoomOption) => (dataZoomOption === null || dataZoomOption === void 0 ? void 0 : dataZoomOption.type) === 'slider' && !isVerticalSlider(dataZoomOption));
33
+ }
34
+ /**
35
+ * Vertical slider zoom needs extra right grid space for ECharts' slider
36
+ * control.
37
+ */
38
+ export function hasVerticalSliderZoom(dataZoom) {
39
+ return toDataZoomArray(dataZoom).some((dataZoomOption) => isVerticalSlider(dataZoomOption));
35
40
  }
36
41
  const getPixelValue = (value) => {
37
42
  if (typeof value === 'number' && Number.isFinite(value)) {
@@ -51,10 +56,9 @@ const getPixelValue = (value) => {
51
56
  * reserve because they cannot be resolved without the rendered chart size.
52
57
  */
53
58
  export function getSliderBottomOuterBound(dataZoom) {
54
- const dataZoomOptions = Array.isArray(dataZoom) ? dataZoom : [dataZoom];
55
- const sliderOuterBounds = dataZoomOptions.flatMap((option) => {
59
+ const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {
56
60
  const slider = option;
57
- if ((slider === null || slider === void 0 ? void 0 : slider.type) !== 'slider' || slider.orient === 'vertical') {
61
+ if ((slider === null || slider === void 0 ? void 0 : slider.type) !== 'slider' || isVerticalSlider(slider)) {
58
62
  return [];
59
63
  }
60
64
  const bottom = getPixelValue(slider.bottom);
@@ -68,6 +72,30 @@ export function getSliderBottomOuterBound(dataZoom) {
68
72
  ? Math.max(...sliderOuterBounds)
69
73
  : undefined;
70
74
  }
75
+ /**
76
+ * Reserves the area occupied by right-positioned vertical slider controls,
77
+ * mirroring `getSliderBottomOuterBound` for horizontal ones. Normalized
78
+ * sliders use pixel values; custom percentage-based layouts fall back to the
79
+ * 60px reserve because they cannot be resolved without the rendered chart
80
+ * size.
81
+ */
82
+ export function getSliderRightOuterBound(dataZoom) {
83
+ const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {
84
+ const slider = option;
85
+ if (!isVerticalSlider(slider)) {
86
+ return [];
87
+ }
88
+ const right = getPixelValue(slider === null || slider === void 0 ? void 0 : slider.right);
89
+ const width = getPixelValue(slider === null || slider === void 0 ? void 0 : slider.width);
90
+ if (right === undefined || width === undefined) {
91
+ return [SLIDER_OUTER_BOUND_FALLBACK];
92
+ }
93
+ return [right + width + SLIDER_OUTER_BOUND_GAP];
94
+ });
95
+ return sliderOuterBounds.length > 0
96
+ ? Math.max(...sliderOuterBounds)
97
+ : undefined;
98
+ }
71
99
  /**
72
100
  * Mark area needs extra top grid space to fit inside the chart.
73
101
  */
@@ -86,11 +114,13 @@ export function hasCategoryXAxis(xAxis) {
86
114
  * Builds the ECharts option object from Needle chart props and derived values.
87
115
  * Applying the option to an ECharts instance happens in `useChartOption`.
88
116
  */
89
- export function buildChartOption({ dataZoom, dataset, hasCategoryXAxis, hasSliderZoom, legendSelected, propsSeries, series, thresholdLines, toolboxOptions, userOption, xAxis, yAxis, hasMarkArea, }) {
117
+ export function buildChartOption({ dataZoom, dataset, hasCategoryXAxis, legendSelected, propsSeries, series, thresholdLines, toolboxOptions, userOption, xAxis, yAxis, hasMarkArea, }) {
90
118
  const customAriaDescription = generateThresholdAriaDescription(propsSeries, dataset);
91
119
  const sliderBottomOuterBound = getSliderBottomOuterBound(dataZoom);
92
- const gridBottom = hasSliderZoom ? 60 : 10;
120
+ const sliderRightOuterBound = getSliderRightOuterBound(dataZoom);
121
+ const gridBottom = hasHorizontalSliderZoom(dataZoom) ? 60 : 10;
93
122
  const gridHorizontalInset = hasCategoryXAxis ? 15 : 10;
123
+ const gridRight = hasVerticalSliderZoom(dataZoom) ? 60 : gridHorizontalInset;
94
124
  const gridTop = hasMarkArea ? 20 : 10;
95
125
  return Object.assign(Object.assign({}, userOption), { aria: Object.assign(Object.assign({ decal: {
96
126
  show: false,
@@ -100,14 +130,14 @@ export function buildChartOption({ dataZoom, dataset, hasCategoryXAxis, hasSlide
100
130
  dataset, grid: Object.assign({ bottom: `${gridBottom}px`, left: `${gridHorizontalInset}px`, outerBounds: {
101
131
  bottom: sliderBottomOuterBound !== null && sliderBottomOuterBound !== void 0 ? sliderBottomOuterBound : gridBottom,
102
132
  left: gridHorizontalInset,
103
- right: gridHorizontalInset,
133
+ right: sliderRightOuterBound !== null && sliderRightOuterBound !== void 0 ? sliderRightOuterBound : gridRight,
104
134
  top: gridTop,
105
- }, outerBoundsContain: 'all', right: `${gridHorizontalInset}px`, top: `${gridTop}px`, type: 'solid' }, userOption === null || userOption === void 0 ? void 0 : userOption.grid), legend: {
135
+ }, outerBoundsContain: 'all', right: `${gridRight}px`, top: `${gridTop}px`, type: 'solid' }, userOption === null || userOption === void 0 ? void 0 : userOption.grid), legend: {
106
136
  // ECharts mutates option.legend.selected internally; callers pass a
107
137
  // copied object so the React ref remains the source of truth.
108
138
  selected: Object.assign({}, legendSelected),
109
139
  show: false,
110
- }, series, toolbox: mergeToolbox(toolboxOptions), tooltip: {
140
+ }, series, toolbox: mergeToolbox(toolboxOptions, { dataZoom, xAxis, yAxis }), tooltip: {
111
141
  borderRadius: 0,
112
142
  borderWidth: 0,
113
143
  confine: true,
@@ -1 +1 @@
1
- {"version":3,"file":"build-chart-option.js","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAkBvC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAmC;IAEnC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,cAAuC,EAAE,EAAE;YACxD,OAAO,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,MAAK,QAAQ,CAAC;QAC3C,CAAC,CAAC;QACJ,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,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","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { DataZoomComponentOption, EChartsOption } from 'echarts';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport { createAxisTooltipFormatter } from './chart-tooltip-formatter';\nimport type { ChartProps, EchartsSeries } from './chart-types';\nimport type { NormalizedThresholdLine } from './threshold';\nimport { mergeToolbox } from './user-option-utils';\n\nconst SLIDER_OUTER_BOUND_GAP = 8;\nconst SLIDER_OUTER_BOUND_FALLBACK = 60;\n\ntype BuildChartOptionParams = {\n dataZoom: EChartsOption['dataZoom'];\n dataset: ChartProps['dataset'];\n hasCategoryXAxis: boolean;\n hasSliderZoom: boolean;\n legendSelected: Record<string, boolean>;\n propsSeries: ChartProps['series'];\n series: EchartsSeries;\n thresholdLines: NormalizedThresholdLine[];\n toolboxOptions: EChartsOption['toolbox'];\n userOption: ChartProps['option'];\n xAxis: EChartsOption['xAxis'];\n yAxis: EChartsOption['yAxis'];\n hasMarkArea: boolean;\n};\n\n/**\n * Slider zoom needs extra bottom grid space for ECharts' slider control.\n */\nexport function hasSliderDataZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return Array.isArray(dataZoom)\n ? dataZoom.some((dataZoomOption: DataZoomComponentOption) => {\n return dataZoomOption?.type === 'slider';\n })\n : dataZoom?.type === 'slider';\n}\n\ntype SliderDataZoomLayout = DataZoomComponentOption & {\n bottom?: number | string;\n height?: number | string;\n orient?: 'horizontal' | 'vertical';\n};\n\nconst getPixelValue = (value: number | string | undefined) => {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value !== 'string' || !/^-?\\d+(?:\\.\\d+)?px$/.test(value)) {\n return undefined;\n }\n\n return Number.parseFloat(value);\n};\n\n/**\n * Reserves the area occupied by bottom-positioned horizontal slider controls.\n *\n * ECharts lays data zoom controls outside the Cartesian grid, so its automatic\n * axis outer bounds do not account for them. Normalized sliders use pixel\n * values; custom percentage-based layouts fall back to the previous 60px\n * reserve because they cannot be resolved without the rendered chart size.\n */\nexport function getSliderBottomOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const dataZoomOptions = Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n const sliderOuterBounds = dataZoomOptions.flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (slider?.type !== 'slider' || slider.orient === 'vertical') {\n return [];\n }\n\n const bottom = getPixelValue(slider.bottom);\n const height = getPixelValue(slider.height);\n if (bottom === undefined || height === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [bottom + height + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Mark area needs extra top grid space to fit inside the chart.\n */\nexport const hasMarkAreaInSeries = (series: EchartsSeries) =>\n Array.isArray(series)\n ? series.some((option) => !!option.markArea)\n : !!series.markArea;\n\n/**\n * Category x-axes use slightly wider grid padding to avoid clipped labels.\n */\nexport function hasCategoryXAxis(xAxis: EChartsOption['xAxis']): boolean {\n return Array.isArray(xAxis)\n ? xAxis.some((axis) => axis.type === 'category')\n : xAxis?.type === 'category';\n}\n\n/**\n * Builds the ECharts option object from Needle chart props and derived values.\n * Applying the option to an ECharts instance happens in `useChartOption`.\n */\nexport function buildChartOption({\n dataZoom,\n dataset,\n hasCategoryXAxis,\n hasSliderZoom,\n legendSelected,\n propsSeries,\n series,\n thresholdLines,\n toolboxOptions,\n userOption,\n xAxis,\n yAxis,\n hasMarkArea,\n}: BuildChartOptionParams): EChartsOption {\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n const sliderBottomOuterBound = getSliderBottomOuterBound(dataZoom);\n const gridBottom = hasSliderZoom ? 60 : 10;\n const gridHorizontalInset = hasCategoryXAxis ? 15 : 10;\n const gridTop = hasMarkArea ? 20 : 10;\n\n return {\n ...userOption,\n aria: {\n decal: {\n show: false,\n },\n enabled: true,\n ...(customAriaDescription !== undefined && {\n label: { description: customAriaDescription },\n }),\n ...(userOption?.aria as EChartsOption['aria']),\n },\n dataZoom,\n dataset,\n grid: {\n bottom: `${gridBottom}px`,\n left: `${gridHorizontalInset}px`,\n outerBounds: {\n bottom: sliderBottomOuterBound ?? gridBottom,\n left: gridHorizontalInset,\n right: gridHorizontalInset,\n top: gridTop,\n },\n outerBoundsContain: 'all',\n right: `${gridHorizontalInset}px`,\n top: `${gridTop}px`,\n type: 'solid',\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // ECharts mutates option.legend.selected internally; callers pass a\n // copied object so the React ref remains the source of truth.\n selected: { ...legendSelected },\n show: false,\n },\n series,\n toolbox: mergeToolbox(toolboxOptions),\n tooltip: {\n borderRadius: 0,\n borderWidth: 0,\n confine: true,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: createAxisTooltipFormatter({ thresholdLines, userOption }),\n padding: 0,\n trigger: 'axis',\n },\n xAxis,\n yAxis,\n };\n}\n"]}
1
+ {"version":3,"file":"build-chart-option.js","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM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CAAE;YAC/B,IAAI,EAAE,KAAK;SACZ,EACD,MAAM,EACN,OAAO,EAAE,YAAY,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EACjE,OAAO,EAAE;YACP,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,kDAAkD;YAChE,SAAS,EAAE,0BAA0B,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;YACrE,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,MAAM;SAChB,EACD,KAAK;QACL,KAAK,IACL;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { DataZoomComponentOption, EChartsOption } from 'echarts';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport { createAxisTooltipFormatter } from './chart-tooltip-formatter';\nimport type { ChartProps, EchartsSeries } from './chart-types';\nimport type { NormalizedThresholdLine } from './threshold';\nimport { isVerticalSlider, mergeToolbox } from './user-option-utils';\n\nconst SLIDER_OUTER_BOUND_GAP = 8;\nconst SLIDER_OUTER_BOUND_FALLBACK = 60;\n\ntype BuildChartOptionParams = {\n dataZoom: EChartsOption['dataZoom'];\n dataset: ChartProps['dataset'];\n hasCategoryXAxis: boolean;\n legendSelected: Record<string, boolean>;\n propsSeries: ChartProps['series'];\n series: EchartsSeries;\n thresholdLines: NormalizedThresholdLine[];\n toolboxOptions: EChartsOption['toolbox'];\n userOption: ChartProps['option'];\n xAxis: EChartsOption['xAxis'];\n yAxis: EChartsOption['yAxis'];\n hasMarkArea: boolean;\n};\n\nconst toDataZoomArray = (dataZoom: EChartsOption['dataZoom']) =>\n Array.isArray(dataZoom) ? dataZoom : [dataZoom];\n\n/**\n * Horizontal slider zoom needs extra bottom grid space for ECharts' slider\n * control.\n */\nexport function hasHorizontalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n dataZoomOption?.type === 'slider' && !isVerticalSlider(dataZoomOption),\n );\n}\n\n/**\n * Vertical slider zoom needs extra right grid space for ECharts' slider\n * control.\n */\nexport function hasVerticalSliderZoom(\n dataZoom: EChartsOption['dataZoom'],\n): boolean {\n return toDataZoomArray(dataZoom).some(\n (dataZoomOption: DataZoomComponentOption | undefined) =>\n isVerticalSlider(dataZoomOption),\n );\n}\n\ntype SliderDataZoomLayout = DataZoomComponentOption & {\n bottom?: number | string;\n height?: number | string;\n orient?: 'horizontal' | 'vertical';\n right?: number | string;\n width?: number | string;\n};\n\nconst getPixelValue = (value: number | string | undefined) => {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value !== 'string' || !/^-?\\d+(?:\\.\\d+)?px$/.test(value)) {\n return undefined;\n }\n\n return Number.parseFloat(value);\n};\n\n/**\n * Reserves the area occupied by bottom-positioned horizontal slider controls.\n *\n * ECharts lays data zoom controls outside the Cartesian grid, so its automatic\n * axis outer bounds do not account for them. Normalized sliders use pixel\n * values; custom percentage-based layouts fall back to the previous 60px\n * reserve because they cannot be resolved without the rendered chart size.\n */\nexport function getSliderBottomOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (slider?.type !== 'slider' || isVerticalSlider(slider)) {\n return [];\n }\n\n const bottom = getPixelValue(slider.bottom);\n const height = getPixelValue(slider.height);\n if (bottom === undefined || height === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [bottom + height + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Reserves the area occupied by right-positioned vertical slider controls,\n * mirroring `getSliderBottomOuterBound` for horizontal ones. Normalized\n * sliders use pixel values; custom percentage-based layouts fall back to the\n * 60px reserve because they cannot be resolved without the rendered chart\n * size.\n */\nexport function getSliderRightOuterBound(\n dataZoom: EChartsOption['dataZoom'],\n): number | undefined {\n const sliderOuterBounds = toDataZoomArray(dataZoom).flatMap((option) => {\n const slider = option as SliderDataZoomLayout | undefined;\n if (!isVerticalSlider(slider)) {\n return [];\n }\n\n const right = getPixelValue(slider?.right);\n const width = getPixelValue(slider?.width);\n if (right === undefined || width === undefined) {\n return [SLIDER_OUTER_BOUND_FALLBACK];\n }\n\n return [right + width + SLIDER_OUTER_BOUND_GAP];\n });\n\n return sliderOuterBounds.length > 0\n ? Math.max(...sliderOuterBounds)\n : undefined;\n}\n\n/**\n * Mark area needs extra top grid space to fit inside the chart.\n */\nexport const hasMarkAreaInSeries = (series: EchartsSeries) =>\n Array.isArray(series)\n ? series.some((option) => !!option.markArea)\n : !!series.markArea;\n\n/**\n * Category x-axes use slightly wider grid padding to avoid clipped labels.\n */\nexport function hasCategoryXAxis(xAxis: EChartsOption['xAxis']): boolean {\n return Array.isArray(xAxis)\n ? xAxis.some((axis) => axis.type === 'category')\n : xAxis?.type === 'category';\n}\n\n/**\n * Builds the ECharts option object from Needle chart props and derived values.\n * Applying the option to an ECharts instance happens in `useChartOption`.\n */\nexport function buildChartOption({\n dataZoom,\n dataset,\n hasCategoryXAxis,\n legendSelected,\n propsSeries,\n series,\n thresholdLines,\n toolboxOptions,\n userOption,\n xAxis,\n yAxis,\n hasMarkArea,\n}: BuildChartOptionParams): EChartsOption {\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n const sliderBottomOuterBound = getSliderBottomOuterBound(dataZoom);\n const sliderRightOuterBound = getSliderRightOuterBound(dataZoom);\n const gridBottom = hasHorizontalSliderZoom(dataZoom) ? 60 : 10;\n const gridHorizontalInset = hasCategoryXAxis ? 15 : 10;\n const gridRight = hasVerticalSliderZoom(dataZoom) ? 60 : gridHorizontalInset;\n const gridTop = hasMarkArea ? 20 : 10;\n\n return {\n ...userOption,\n aria: {\n decal: {\n show: false,\n },\n enabled: true,\n ...(customAriaDescription !== undefined && {\n label: { description: customAriaDescription },\n }),\n ...(userOption?.aria as EChartsOption['aria']),\n },\n dataZoom,\n dataset,\n grid: {\n bottom: `${gridBottom}px`,\n left: `${gridHorizontalInset}px`,\n outerBounds: {\n bottom: sliderBottomOuterBound ?? gridBottom,\n left: gridHorizontalInset,\n right: sliderRightOuterBound ?? gridRight,\n top: gridTop,\n },\n outerBoundsContain: 'all',\n right: `${gridRight}px`,\n top: `${gridTop}px`,\n type: 'solid',\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // ECharts mutates option.legend.selected internally; callers pass a\n // copied object so the React ref remains the source of truth.\n selected: { ...legendSelected },\n show: false,\n },\n series,\n toolbox: mergeToolbox(toolboxOptions, { dataZoom, xAxis, yAxis }),\n tooltip: {\n borderRadius: 0,\n borderWidth: 0,\n confine: true,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: createAxisTooltipFormatter({ thresholdLines, userOption }),\n padding: 0,\n trigger: 'axis',\n },\n xAxis,\n yAxis,\n };\n}\n"]}
@@ -149,28 +149,189 @@ export const mergeYAxis = (yAxis, theme = 'light') => {
149
149
  }
150
150
  return baseYAxis;
151
151
  };
152
- export const mergeDataZoom = (dataZoom) => {
152
+ const normalizeAxisIndices = (axisIndex) => {
153
+ if (typeof axisIndex === 'number') {
154
+ return [axisIndex];
155
+ }
156
+ if (Array.isArray(axisIndex)) {
157
+ return axisIndex.filter((index) => {
158
+ return typeof index === 'number';
159
+ });
160
+ }
161
+ return [];
162
+ };
163
+ /**
164
+ * Resolves the axes a single dataZoom entry targets, mirroring ECharts' own
165
+ * resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning
166
+ * "not this axis"); when no index is given, `orient: 'vertical'` targets the
167
+ * first y-axis and horizontal/unset targets the first x-axis.
168
+ */
169
+ const getSingleDataZoomTargets = (dataZoom) => {
170
+ if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== 'slider' && (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== 'inside') {
171
+ return { xAxisIndices: [], yAxisIndices: [] };
172
+ }
173
+ const hasAxisIndex = dataZoom.xAxisIndex !== undefined || dataZoom.yAxisIndex !== undefined;
174
+ if (hasAxisIndex) {
175
+ return {
176
+ xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),
177
+ yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex),
178
+ };
179
+ }
180
+ return dataZoom.orient === 'vertical'
181
+ ? { xAxisIndices: [], yAxisIndices: [0] }
182
+ : { xAxisIndices: [0], yAxisIndices: [] };
183
+ };
184
+ /**
185
+ * Union of the axis indices targeted by all slider/inside entries in a
186
+ * dataZoom config, using the same per-entry resolution as ECharts (explicit
187
+ * axis indices first, then orientation).
188
+ */
189
+ export const getDataZoomTargetAxes = (dataZoom) => {
190
+ const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];
191
+ const targets = { xAxisIndices: [], yAxisIndices: [] };
192
+ for (const entry of entries) {
193
+ const entryTargets = getSingleDataZoomTargets(entry);
194
+ for (const index of entryTargets.xAxisIndices) {
195
+ if (!targets.xAxisIndices.includes(index)) {
196
+ targets.xAxisIndices.push(index);
197
+ }
198
+ }
199
+ for (const index of entryTargets.yAxisIndices) {
200
+ if (!targets.yAxisIndices.includes(index)) {
201
+ targets.yAxisIndices.push(index);
202
+ }
203
+ }
204
+ }
205
+ return targets;
206
+ };
207
+ /**
208
+ * A slider is vertical when the consumer sets `orient: 'vertical'`, or when it
209
+ * only targets a y-axis, which makes ECharts infer the vertical orientation.
210
+ */
211
+ export const isVerticalSlider = (dataZoom) => {
212
+ if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== 'slider') {
213
+ return false;
214
+ }
215
+ if (dataZoom.orient !== undefined) {
216
+ return dataZoom.orient === 'vertical';
217
+ }
218
+ const targets = getSingleDataZoomTargets(dataZoom);
219
+ return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;
220
+ };
221
+ /**
222
+ * Axis types where windowing (`filterMode: 'none'`) beats ECharts' default
223
+ * data filtering. Filtering a continuous axis removes whole data items outside
224
+ * the window, which makes bars and points vanish instead of clipping them.
225
+ * Category axes keep the `'filter'` default so paging through categories still
226
+ * rescales the opposite value axis to the visible data.
227
+ */
228
+ const WINDOWED_FILTER_AXIS_TYPES = ['log', 'time', 'value'];
229
+ const getSingleAxisOption = (axis, axisIndex) => {
230
+ if (!Array.isArray(axis)) {
231
+ return axis;
232
+ }
233
+ const index = typeof axisIndex === 'number'
234
+ ? axisIndex
235
+ : Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'
236
+ ? axisIndex[0]
237
+ : 0;
238
+ return axis[index];
239
+ };
240
+ /**
241
+ * Resolves the slider's target axis the way ECharts does (explicit axis index
242
+ * first, then orientation) and returns `'none'` when that axis is continuous.
243
+ * Returns `undefined` (keep ECharts' `'filter'` default) for category axes and
244
+ * for sliders that target both axes at once.
245
+ */
246
+ const getSliderDefaultFilterMode = (dataZoom, axes) => {
247
+ const targets = getSingleDataZoomTargets(dataZoom);
248
+ const isXAxisTarget = targets.xAxisIndices.length > 0;
249
+ const isYAxisTarget = targets.yAxisIndices.length > 0;
250
+ if (isXAxisTarget === isYAxisTarget) {
251
+ return undefined;
252
+ }
253
+ const targetAxis = isYAxisTarget
254
+ ? getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.yAxis, dataZoom.yAxisIndex)
255
+ : getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.xAxis, dataZoom.xAxisIndex);
256
+ return (targetAxis === null || targetAxis === void 0 ? void 0 : targetAxis.type) !== undefined &&
257
+ WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)
258
+ ? 'none'
259
+ : undefined;
260
+ };
261
+ export const mergeDataZoom = (dataZoom, axes) => {
153
262
  if (Array.isArray(dataZoom)) {
154
- return dataZoom.map((option) => mergeDataZoom(option));
263
+ return dataZoom.map((option) => mergeDataZoom(option, axes));
155
264
  }
156
265
  const isSlider = (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) === 'slider';
157
266
  const isInside = (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) === 'inside';
158
267
  if (isSlider) {
159
- return Object.assign({ bottom: 10, height: 28, show: true, type: 'slider' }, dataZoom);
268
+ const filterMode = getSliderDefaultFilterMode(dataZoom, axes);
269
+ const layoutDefaults = isVerticalSlider(dataZoom)
270
+ ? { right: 10, width: 28 }
271
+ : { bottom: 10, height: 28 };
272
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, (filterMode !== undefined && { filterMode })), layoutDefaults), { show: true, type: 'slider' }), dataZoom);
160
273
  }
161
274
  else if (isInside) {
162
- return Object.assign({ filterMode: 'none', xAxisIndex: [0], zoomOnMouseWheel: false }, dataZoom);
275
+ // Only pin the default x-axis binding on entries that actually target the
276
+ // x-axis; y-targeting entries (explicit `yAxisIndex` or
277
+ // `orient: 'vertical'`) keep their own binding.
278
+ const targets = getSingleDataZoomTargets(dataZoom);
279
+ const hasDefaultXAxisTarget = dataZoom.xAxisIndex === undefined && targets.xAxisIndices.length > 0;
280
+ return Object.assign(Object.assign(Object.assign({ filterMode: 'none' }, (hasDefaultXAxisTarget && { xAxisIndex: [0] })), { zoomOnMouseWheel: false }), dataZoom);
163
281
  }
164
282
  return dataZoom;
165
283
  };
166
- export const mergeToolbox = (toolbox) => {
284
+ const isContinuousAxisOption = (axisOption) => {
285
+ return ((axisOption === null || axisOption === void 0 ? void 0 : axisOption.type) !== undefined &&
286
+ WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type));
287
+ };
288
+ const areTargetAxesContinuous = (axis, axisIndices) => {
289
+ if (axisIndices === 'all') {
290
+ const axisOptions = Array.isArray(axis) ? axis : [axis];
291
+ return (axisOptions.length > 0 &&
292
+ axisOptions.every((axisOption) => {
293
+ return isContinuousAxisOption(axisOption);
294
+ }));
295
+ }
296
+ return axisIndices.every((axisIndex) => {
297
+ return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));
298
+ });
299
+ };
300
+ /**
301
+ * Returns `'none'` when every axis targeted by the drag-to-zoom brush is
302
+ * continuous (`value`/`time`/`log`), matching the slider rule: filtering a
303
+ * continuous axis removes whole data items outside the selection instead of
304
+ * clipping them. Category (or unknown) targets keep ECharts' `'filter'`
305
+ * default.
306
+ */
307
+ const getBrushDefaultFilterMode = (context, xAxisTargets, yAxisTargets) => {
308
+ const checks = [];
309
+ if (xAxisTargets !== false) {
310
+ checks.push(areTargetAxesContinuous(context === null || context === void 0 ? void 0 : context.xAxis, xAxisTargets));
311
+ }
312
+ if (yAxisTargets !== false) {
313
+ checks.push(areTargetAxesContinuous(context === null || context === void 0 ? void 0 : context.yAxis, yAxisTargets));
314
+ }
315
+ return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;
316
+ };
317
+ export const mergeToolbox = (toolbox, context) => {
167
318
  var _a;
168
319
  if (Array.isArray(toolbox)) {
169
- return toolbox.map((option) => mergeToolbox(option));
320
+ return toolbox.map((option) => mergeToolbox(option, context));
170
321
  }
322
+ // The drag-to-zoom brush follows the axes the dataZoom config targets, so
323
+ // zoom direction is configured in one place. Without any dataZoom config it
324
+ // keeps the historical default: all x-axes on, y off.
325
+ const targets = getDataZoomTargetAxes(context === null || context === void 0 ? void 0 : context.dataZoom);
326
+ const hasTargets = targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0;
327
+ const xAxisTargets = hasTargets
328
+ ? targets.xAxisIndices.length > 0 && targets.xAxisIndices
329
+ : 'all';
330
+ const yAxisTargets = targets.yAxisIndices.length > 0 && targets.yAxisIndices;
331
+ const filterMode = getBrushDefaultFilterMode(context, xAxisTargets, yAxisTargets);
171
332
  return {
172
333
  feature: {
173
- dataZoom: Object.assign(Object.assign({ yAxisIndex: false }, (_a = toolbox === null || toolbox === void 0 ? void 0 : toolbox.feature) === null || _a === void 0 ? void 0 : _a.dataZoom), { icon: {
334
+ dataZoom: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (filterMode !== undefined && { filterMode })), (xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets })), { yAxisIndex: yAxisTargets }), (_a = toolbox === null || toolbox === void 0 ? void 0 : toolbox.feature) === null || _a === void 0 ? void 0 : _a.dataZoom), { icon: {
174
335
  // This hack removes the icons.
175
336
  // Due to: https://github.com/apache/echarts/issues/10274
176
337
  back: '-',
@@ -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,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,E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C;IAChC,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,gCACN,UAAU,EAAE,KAAK,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE;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 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\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n 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":[],"mapp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,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 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"]}
@@ -32,6 +32,26 @@ import { type ChartProps } from './utils/chart-types';
32
32
  * <Chart dataset={dataset} series={series} xAxis={xAxis} yAxis={yAxis} />
33
33
  * </div>
34
34
  * ```
35
+ *
36
+ * @remarks
37
+ * **Data zoom sliders.** A `dataZoom` slider passed through `option` targets
38
+ * the x-axis unless it is bound to an axis explicitly, so on a horizontal bar
39
+ * chart it zooms the value axis rather than the categories. Bind the slider to
40
+ * the category axis with `yAxisIndex: [0]` (or set `orient: 'vertical'`) to
41
+ * page through the bars instead; Needle then lays the slider out vertically on
42
+ * the right of the chart and reserves grid space for it. Sliders that target a
43
+ * continuous (`value`, `time`, or `log`) axis default to `filterMode: 'none'`
44
+ * so out-of-window data is clipped rather than removed, while category-axis
45
+ * sliders keep ECharts' `'filter'` default so the opposite value axis rescales
46
+ * to the visible data.
47
+ *
48
+ * **Drag-to-zoom.** Dragging in the plot area zooms the axes your `dataZoom`
49
+ * config targets: entries bound to a y-axis (`yAxisIndex` or
50
+ * `orient: 'vertical'`) make the drag select a y band, entries on both axes
51
+ * make it select a rectangle, and without any `dataZoom` config the drag zooms
52
+ * the x-axis. Set `toolbox.feature.dataZoom` through `option` to override the
53
+ * derived axes explicitly. When every drag-targeted axis is continuous the
54
+ * drag defaults to `filterMode: 'none'`, matching the slider rule above.
35
55
  */
36
56
  export declare const Chart: ({ style, legend, ...chartProps }: ChartProps) => import("react/jsx-runtime").JSX.Element;
37
57
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA8CtD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAAI,kCAAkC,UAAU,4CAyCjE,CAAC"}
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA8CtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,KAAK,GAAI,kCAAkC,UAAU,4CAyCjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChartRender.d.ts","sourceRoot":"","sources":["../../../src/charts/ChartRender.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgB7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUtD,KAAK,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG;IAC7D,mBAAmB,EAAE,CAAC,WAAW,EAAE,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC;IACtE,mBAAmB,EAAE,CAAC,uBAAuB,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,mMAazB,gBAAgB,4CAiElB,CAAC"}
1
+ {"version":3,"file":"ChartRender.d.ts","sourceRoot":"","sources":["../../../src/charts/ChartRender.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAe7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUtD,KAAK,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG;IAC7D,mBAAmB,EAAE,CAAC,WAAW,EAAE,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC;IACtE,mBAAmB,EAAE,CAAC,uBAAuB,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,mMAazB,gBAAgB,4CAgElB,CAAC"}
@@ -25,7 +25,6 @@ export type UseChartOptionParams = {
25
25
  dataZoom: EChartsOption['dataZoom'];
26
26
  dataset: ChartProps['dataset'];
27
27
  hasCategoryXAxis: boolean;
28
- hasSliderZoom: boolean;
29
28
  propsSeries: ChartProps['series'];
30
29
  series: EchartsSeries;
31
30
  settings: ChartProps['settings'];
@@ -45,5 +44,5 @@ export type UseChartOptionParams = {
45
44
  * downstream code, especially the custom legend, can read the final series and
46
45
  * dataset shape ECharts is actually using.
47
46
  */
48
- export declare function useChartOption({ dataZoom, dataset, hasCategoryXAxis, hasSliderZoom, propsSeries, series, settings, thresholdLines, toolboxOptions, userOption, xAxis, yAxis, hasMarkArea, }: UseChartOptionParams): EChartsOption | undefined;
47
+ export declare function useChartOption({ dataZoom, dataset, hasCategoryXAxis, propsSeries, series, settings, thresholdLines, toolboxOptions, userOption, xAxis, yAxis, hasMarkArea, }: UseChartOptionParams): EChartsOption | undefined;
49
48
  //# sourceMappingURL=use-chart-option.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-chart-option.d.ts","sourceRoot":"","sources":["../../../../src/charts/hooks/use-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACjC,cAAc,EAAE,uBAAuB,EAAE,CAAC;IAC1C,cAAc,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACzC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACjC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,WAAW,EAC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