@neo4j-ndl/react-charts 1.0.146 → 1.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/charts/Chart.js +4 -4
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/chart-types.js.map +1 -1
- package/lib/cjs/charts/themes/ndl-echarts-theme.js +3 -2
- package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/cjs/charts/user-option-utils.js +4 -3
- package/lib/cjs/charts/user-option-utils.js.map +1 -1
- package/lib/esm/charts/Chart.js +4 -4
- package/lib/esm/charts/Chart.js.map +1 -1
- package/lib/esm/charts/chart-types.js.map +1 -1
- package/lib/esm/charts/themes/ndl-echarts-theme.js +3 -2
- package/lib/esm/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/esm/charts/user-option-utils.js +4 -3
- package/lib/esm/charts/user-option-utils.js.map +1 -1
- package/lib/types/charts/Chart.d.ts +1 -1
- package/lib/types/charts/Chart.d.ts.map +1 -1
- package/lib/types/charts/chart-types.d.ts +3 -0
- package/lib/types/charts/chart-types.d.ts.map +1 -1
- package/lib/types/charts/themes/ndl-echarts-theme.d.ts +2 -1
- package/lib/types/charts/themes/ndl-echarts-theme.d.ts.map +1 -1
- package/lib/types/charts/user-option-utils.d.ts +2 -2
- package/lib/types/charts/user-option-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cjs/charts/Chart.js
CHANGED
|
@@ -108,7 +108,7 @@ function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis
|
|
|
108
108
|
lazyUpdate: false,
|
|
109
109
|
notMerge: true,
|
|
110
110
|
silent: false,
|
|
111
|
-
}, isLoading, isChartZoomDisabled = false, legend, callbacks, }) {
|
|
111
|
+
}, isLoading, isChartZoomDisabled = false, legend, callbacks, palette, }) {
|
|
112
112
|
const chartRef = (0, react_2.useRef)(null);
|
|
113
113
|
const chartEchartRef = (0, react_2.useRef)(null);
|
|
114
114
|
const chartLegendRef = (0, react_2.useRef)(null);
|
|
@@ -138,7 +138,7 @@ function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis
|
|
|
138
138
|
const dataZoom = (0, react_2.useMemo)(() => {
|
|
139
139
|
return (0, user_option_utils_1.mergeDataZoom)(dataZoomOptions);
|
|
140
140
|
}, [dataZoomOptions]);
|
|
141
|
-
const series = (0, user_option_utils_1.mergeSeries)(propsSeries, theme, userOption);
|
|
141
|
+
const series = (0, user_option_utils_1.mergeSeries)(propsSeries, theme, userOption, palette);
|
|
142
142
|
const xAxis = (0, user_option_utils_1.mergeXAxis)(propXAxis, theme);
|
|
143
143
|
const yAxis = (0, user_option_utils_1.mergeYAxis)(propYAxis, theme);
|
|
144
144
|
const hasCategoryXAxis = Array.isArray(xAxis)
|
|
@@ -247,8 +247,8 @@ function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis
|
|
|
247
247
|
// Initialize chart
|
|
248
248
|
let chart;
|
|
249
249
|
if (chartEchartRef.current !== null) {
|
|
250
|
-
(0, echarts_1.registerTheme)('ndl-light', (0, ndl_echarts_theme_1.ndlEchartsTheme)('light'));
|
|
251
|
-
(0, echarts_1.registerTheme)('ndl-dark', (0, ndl_echarts_theme_1.ndlEchartsTheme)('dark'));
|
|
250
|
+
(0, echarts_1.registerTheme)('ndl-light', (0, ndl_echarts_theme_1.ndlEchartsTheme)('light', palette));
|
|
251
|
+
(0, echarts_1.registerTheme)('ndl-dark', (0, ndl_echarts_theme_1.ndlEchartsTheme)('dark', palette));
|
|
252
252
|
const currentChart = (0, echarts_1.getInstanceByDom)(chartEchartRef.current);
|
|
253
253
|
if (currentChart) {
|
|
254
254
|
chart = currentChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":";;AAwIA,sBAyiBC;;AAjrBD;;;;;;;;;;;;;;;;;;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AAE,KAAK,aACpD,gCAAK,GAAG,EAAE,cAAc,GAAI,EAC3B,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,CAAC,uBAAuB,IAAI,CAC3C,uBAAC,eAAM,IACL,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,MAAM,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAC1B,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,iBAAiB,GAC9B,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { useNeedleTheme } from '@neo4j-ndl/react';\nimport {\n type DataZoomComponentOption,\n type ECharts,\n type EChartsOption,\n getInstanceByDom,\n init,\n registerTheme,\n} from 'echarts';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport {\n type ChartProps,\n type Condition,\n type NeedleSeries,\n type NotificationType,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { Legend } from './Legend';\nimport { ndlEchartsTheme } from './themes/ndl-echarts-theme';\nimport {\n mergeDataZoom,\n mergeSeries,\n mergeToolbox,\n mergeXAxis,\n mergeYAxis,\n} from './user-option-utils';\nimport { capitalizeFirstLetter, extractValueFromTooltipSeries } from './utils';\n\n// This returns a boolean if the condition is met\n// and also what to display in the tooltip.\nfunction checkCondition(\n value: number,\n condition: Condition,\n threshold: number,\n): {\n isConditionMet: boolean;\n conditionText: string | undefined;\n} {\n switch (condition) {\n case 'greater':\n return {\n conditionText: 'Above',\n isConditionMet: value > threshold,\n };\n case 'greaterOrEqual':\n return {\n conditionText:\n value > threshold\n ? 'Above'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value >= threshold,\n };\n case 'less':\n return {\n conditionText: 'Below',\n isConditionMet: value < threshold,\n };\n case 'lessOrEqual':\n return {\n conditionText:\n value < threshold\n ? 'Below'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value <= threshold,\n };\n case 'equal':\n return {\n conditionText: 'Equal',\n isConditionMet: value === threshold,\n };\n case 'notEqual':\n return {\n conditionText: 'Not equal',\n isConditionMet: value !== threshold,\n };\n default:\n return { conditionText: undefined, isConditionMet: false };\n }\n}\n\n/*\nKeep this, if we want more than one type of the same threshold line\nthis will be useful to use.\n\nexport interface NewRegisteredSeriesOption extends RegisteredSeriesOption {\nthresholdLine: ThresholdLineSeriesOption;\n}\nexport type SeriesOption = Values<NewRegisteredSeriesOption>;\nexport type Series = SeriesOption | SeriesOption[];\n*/\n\n/**\n * A chart component powered by Apache ECharts with Needle's customization and theming.\n *\n * The `Chart` component fills 100% of its parent's width and height. Because it\n * relies on the container's `clientHeight` to size the canvas, **the parent element\n * must have an explicit height** (e.g. a fixed px/rem value or a viewport unit).\n *\n * @example\n * ```tsx\n * <div style={{ height: '350px' }}>\n * <Chart dataset={dataset} series={series} xAxis={xAxis} yAxis={yAxis} />\n * </div>\n * ```\n */\nexport function Chart({\n dataset,\n option: userOption,\n xAxis: propXAxis,\n yAxis: propYAxis,\n series: propsSeries,\n style,\n settings = {\n lazyUpdate: false,\n notMerge: true,\n silent: false,\n },\n isLoading,\n isChartZoomDisabled = false,\n legend,\n callbacks,\n}: ChartProps): React.JSX.Element {\n const chartRef = useRef<HTMLDivElement>(null);\n const chartEchartRef = useRef<HTMLDivElement>(null);\n const chartLegendRef = useRef<HTMLDivElement>(null);\n const legendSelectedRef = useRef<Record<string, boolean>>({});\n const legendColorCacheRef = useRef<Map<string, string>>(new Map());\n const [isWaitingForFirstResize, setIsWaitingForFirstResize] = useState(true);\n\n const dataZoomOptions = (userOption as EChartsOption)?.dataZoom;\n const toolboxOptions = (userOption as EChartsOption)?.toolbox;\n\n const hasSliderZoom = Array.isArray(dataZoomOptions)\n ? dataZoomOptions.some((dataZoomOption: DataZoomComponentOption) => {\n return dataZoomOption?.type === 'slider';\n })\n : dataZoomOptions?.type === 'slider';\n\n const { theme } = useNeedleTheme();\n const thresholdLines = useMemo(() => {\n const seriesArray = Array.isArray(propsSeries)\n ? propsSeries\n : [propsSeries];\n\n const thresholdLineSeries = seriesArray.filter((currentSeries) => {\n return currentSeries.type === 'thresholdLine';\n }) as ThresholdLineSeriesOption<NotificationType>[];\n\n return thresholdLineSeries.map((currentThresholdLineSeriesOption) => {\n return {\n ...currentThresholdLineSeriesOption,\n condition:\n currentThresholdLineSeriesOption.condition ??\n defaultThresholdLineSeriesOption.condition,\n value: currentThresholdLineSeriesOption.yAxis,\n };\n });\n }, [propsSeries]);\n\n const dataZoom = useMemo(() => {\n return mergeDataZoom(dataZoomOptions);\n }, [dataZoomOptions]);\n\n const series = mergeSeries(propsSeries, theme, userOption);\n const xAxis = mergeXAxis(propXAxis, theme);\n const yAxis = mergeYAxis(propYAxis, theme);\n\n const hasCategoryXAxis = Array.isArray(xAxis)\n ? xAxis.some((x) => x.type === 'category')\n : xAxis?.type === 'category';\n\n // The initial option used, the charts option is not necessarily\n // the same as this due to mutation via dispatch and setOption.\n // use getOption to get the current option of the chart.\n const initialOption = useMemo(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n\n const option = {\n dataset,\n xAxis,\n yAxis,\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 grid: {\n left: hasCategoryXAxis ? '15px' : '10px',\n right: hasCategoryXAxis ? '15px' : '10px',\n top: '10px',\n bottom: hasSliderZoom ? '60px' : '10px',\n type: 'solid',\n containLabel: true,\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // Removes in-built echarts legend\n show: false,\n // Preserve legend filter state across re-renders. legendSelectedRef\n // is the single source of truth, written by the Legend component.\n // ECharts mutates the options object, so pass a shallow copy here\n // to avoid it mutating the React ref object.\n selected: { ...(legendSelectedRef.current || {}) },\n },\n series,\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\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue =\n typeof value === 'number' ? value : Number(value);\n\n const isThresholdLine =\n series.seriesName.startsWith('thresholdLine');\n\n const notifications = thresholdLines\n .filter((threshold) => {\n const {\n value: thresholdValue,\n condition,\n customCondition,\n } = threshold;\n\n if (Number.isNaN(seriesValue)) {\n return false;\n }\n\n const isConditionMet = customCondition\n ? customCondition(seriesValue, thresholdValue)\n : checkCondition(seriesValue, condition, thresholdValue)\n .isConditionMet;\n\n return !isThresholdLine && isConditionMet;\n })\n .map((threshold) => {\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n\n return {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? customConditionText\n : `${\n checkCondition(\n seriesValue,\n condition,\n thresholdValue,\n ).conditionText\n } threshold`,\n notificationType,\n trailingElement: thresholdValue,\n };\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isThresholdLine\n ? `${capitalizeFirstLetter(\n series.seriesName.replace('thresholdLine-', ''),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n },\n },\n dataZoom,\n toolbox: mergeToolbox(toolboxOptions),\n };\n\n // Update chart with initial option\n chart?.setOption(option, settings);\n\n // Get option returns the current option of the chart.\n // This is slightly different than the option we gave as an argument.\n // Because we use useMemo in other areas we want to get this set first,\n // this is why we are setting then getting then returning. If we did this in\n // a useEffect it would run after the other useMemos which is not what we want.\n // This is purely for order of operations.\n const chartOption = chart?.getOption();\n\n return chartOption;\n }, [\n thresholdLines,\n propsSeries,\n dataset,\n xAxis,\n yAxis,\n userOption,\n hasCategoryXAxis,\n hasSliderZoom,\n series,\n dataZoom,\n toolboxOptions,\n settings,\n ]);\n\n useEffect(() => {\n // Initialize chart\n let chart: ECharts | undefined;\n if (chartEchartRef.current !== null) {\n registerTheme('ndl-light', ndlEchartsTheme('light'));\n registerTheme('ndl-dark', ndlEchartsTheme('dark'));\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (currentChart) {\n chart = currentChart;\n } else {\n const echartsTheme = theme === 'light' ? 'ndl-light' : 'ndl-dark';\n chart = init(chartEchartRef.current, echartsTheme, {\n renderer: 'svg',\n });\n }\n }\n\n if (callbacks?.onZoom) {\n chart?.on('datazoom', () => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (!currentChart) {\n return;\n }\n\n const option = currentChart.getOption();\n if (!option || !option.dataZoom) {\n return;\n }\n\n const dataZoom = Array.isArray(option.dataZoom)\n ? option.dataZoom[0]\n : option.dataZoom;\n const { startValue, endValue } = dataZoom as {\n startValue: number;\n endValue: number;\n };\n\n callbacks?.onZoom?.({ endValue, startValue });\n });\n }\n\n // Add chart resize listener\n // ResizeObserver is leading to a bit janky UX\n function resizeChart() {\n // TODO: We need to revisit this. Right now using grid containLabel seems to work.\n // We still need to visit this for overflowing of the x-axis labels.\n // const calculateGridLeft = () => {\n // const textElements = chartEchartRef.current?.querySelectorAll('text');\n // const filteredTextElements = Array.from(textElements || []).filter(\n // (element) => element.getAttribute('text-anchor') === 'end',\n // );\n // let maxWidth = 0;\n // filteredTextElements.forEach((element) => {\n // const bbox = element.getBBox();\n // maxWidth = Math.max(maxWidth, bbox.width);\n // });\n // const tickLength = 5;\n // const tickPadding = 3;\n // return maxWidth + tickLength + tickPadding;\n // };\n //\n // // Example of dynamically setting the grid's left\n // const gridLeft = calculateGridLeft();\n // chart?.setOption({\n // grid: {\n // left: gridLeft,\n // },\n // });\n\n // We want to fit the chart to the charts container.\n const chartContainerHeight = chartRef.current?.clientHeight;\n const chartContainerWidth = chartRef.current?.clientWidth;\n // Need to take legends height into consideration, otherwise it will overflow the parent.\n const chartLegendHeight = chartLegendRef?.current?.clientHeight || 0;\n const height = chartContainerHeight\n ? chartContainerHeight - chartLegendHeight\n : undefined;\n chart?.resize({\n height,\n width: chartContainerWidth,\n });\n }\n window.addEventListener('resize', resizeChart);\n requestAnimationFrame(() => {\n resizeChart();\n setIsWaitingForFirstResize(false);\n });\n\n // Add chart zoom listeners\n const handleMouseMove = () => {\n // I do not like this at all: https://github.com/apache/echarts/issues/19819\n // echarts updates the svgs on every mouse movement so we need to do this.\n chart?.getZr().setCursorStyle('default');\n };\n // We cannot use chart.getZr().on('mousemove', handleMouseMove)\n // This is because it doesn't respect our callbacks. It will\n // always run echarts code last instead of our callback.\n const chartChild = chartEchartRef.current?.children[0] as HTMLElement;\n if (!isChartZoomDisabled) {\n chartChild.addEventListener('mousemove', handleMouseMove);\n }\n\n const handleMouseDown = (params: { event: MouseEvent }) => {\n const event = params.event;\n const amountOfMouseClicks = event.detail;\n const isDoubleClick = amountOfMouseClicks === 2;\n if (isDoubleClick) {\n // Reset zooming.\n if (chart === undefined) {\n return;\n }\n chart?.dispatchAction({\n end: 100,\n start: 0,\n type: 'dataZoom',\n });\n if (callbacks?.onZoom) {\n callbacks?.onZoom?.({ endValue: 100, startValue: 0 });\n }\n }\n };\n if (!isChartZoomDisabled) {\n chart?.getZr().on('mousedown', handleMouseDown);\n }\n\n // Return cleanup function\n const chartRefCurrentElement = chartEchartRef.current;\n const element = chartRefCurrentElement?.children[0];\n return () => {\n window.removeEventListener('resize', resizeChart);\n\n element?.removeEventListener('mousemove', handleMouseMove);\n\n // Remove chart zoom handlers\n if (chartRefCurrentElement) {\n const chart = getInstanceByDom(chartRefCurrentElement);\n chart?.getZr().off('mousedown', handleMouseDown);\n }\n };\n });\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n\n if (isLoading === true || isWaitingForFirstResize) {\n chart?.showLoading({\n color: tokens.theme[theme].color.primary.bg.status,\n fontFamily: tokens.typography['label'].fontFamily,\n fontSize: tokens.typography['label'].fontSize,\n fontWeight: tokens.typography['label'].fontWeight,\n maskColor: `rgb( from ${tokens.theme[theme].color.neutral.text.inverse} r g b / 0.8)`,\n text: 'Loading',\n textColor: tokens.theme[theme].color.neutral.text.default,\n });\n } else {\n chart?.hideLoading();\n }\n }, [isLoading, isWaitingForFirstResize, theme]);\n\n const legendSeries = useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n const optionSeries = (initialOption?.series as NeedleSeries) ?? [];\n const optionDataset = initialOption?.dataset;\n\n const legendSeries: {\n name: string;\n color: string;\n }[] = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (\n currentSeries.type === 'line' &&\n typeof currentSeries.name === 'string' &&\n currentSeries.name?.includes('thresholdLine')\n ) {\n return;\n } else if (currentSeries.type === 'pie') {\n const encodedItemName = currentSeries.encode?.itemName;\n let currentDataset = Array.isArray(optionDataset)\n ? optionDataset[0]\n : optionDataset;\n if (currentSeries.datasetId && Array.isArray(optionDataset)) {\n currentDataset = optionDataset.find(\n (ds) => ds.id === currentSeries.datasetId,\n );\n } else if (currentSeries.datasetIndex !== undefined) {\n currentDataset = Array.isArray(optionDataset)\n ? optionDataset[currentSeries.datasetIndex]\n : optionDataset;\n }\n const firstDatasetRow = Array.isArray(currentDataset?.source)\n ? currentDataset?.source[0]\n : undefined;\n if (!firstDatasetRow) {\n return;\n }\n\n if (Array.isArray(firstDatasetRow)) {\n const firstDatasetRowIndex = firstDatasetRow.findIndex(\n (item) => item === encodedItemName,\n );\n\n if (firstDatasetRowIndex === -1) {\n return;\n }\n\n const source = currentDataset?.source;\n if (!source) {\n return;\n }\n\n const sourceLength = Array.isArray(source) ? source.length : 0;\n const selected = legendSelectedRef.current;\n const isAllVisible = Object.values(selected).every((v) => v);\n\n for (let rowIndex = 1; rowIndex < sourceLength; rowIndex++) {\n const row = source[rowIndex] as (string | number)[];\n const name = String(row[firstDatasetRowIndex]);\n const freshColor = chart?.getVisual(\n { dataIndexInside: rowIndex - 1, seriesIndex: index },\n 'color',\n );\n\n // Only trust getVisual colors when all items are visible.\n // When items are deselected, getVisual returns grayed-out\n // colors, so we use the cached color from when it was visible.\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n const color =\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000');\n\n legendSeries.push({ color, name });\n }\n } else {\n // TODO: handle dictionary\n }\n\n return;\n } else {\n const name = Array.isArray(optionSeries)\n ? optionSeries[index]?.name\n : undefined;\n\n if (name === undefined) {\n return null;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries.filter((currentSeries) => currentSeries !== null);\n }, [isWaitingForFirstResize, initialOption]);\n\n if (chartEchartRef.current !== null && !isChartZoomDisabled) {\n const chart = getInstanceByDom(chartEchartRef.current);\n if (chart) {\n // Needs to be re-set on every re-render.\n // Sets the selectable zoom area over the chart (not the slider).\n chart.dispatchAction({\n dataZoomSelectActive: true,\n key: 'dataZoomSelect',\n type: 'takeGlobalCursor',\n });\n }\n }\n\n return (\n <div ref={chartRef} className=\"ndl-chart\" style={style}>\n <div ref={chartEchartRef} />\n {legend?.show && !isWaitingForFirstResize && (\n <Legend\n ref={chartLegendRef}\n wrappingType={legend.wrappingType}\n series={legendSeries ?? []}\n chartRef={chartEchartRef}\n selectedRef={legendSelectedRef}\n />\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":";;AAwIA,sBA0iBC;;AAlrBD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,4CAAkD;AAClD,qCAOiB;AACjB,iCAA6D;AAC7D,6CAAkD;AAElD,yDAAsE;AAQtE,iDAA8C;AAC9C,yCAA8D;AAC9D,qCAAkC;AAClC,kEAA6D;AAC7D,2DAM6B;AAC7B,mCAA+E;AAE/E,iDAAiD;AACjD,2CAA2C;AAC3C,SAAS,cAAc,CACrB,KAAa,EACb,SAAoB,EACpB,SAAiB;IAKjB,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO;gBACL,aAAa,EAA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AAW,EAAE,iBAAiB,GAC9B,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { useNeedleTheme } from '@neo4j-ndl/react';\nimport {\n type DataZoomComponentOption,\n type ECharts,\n type EChartsOption,\n getInstanceByDom,\n init,\n registerTheme,\n} from 'echarts';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport {\n type ChartProps,\n type Condition,\n type NeedleSeries,\n type NotificationType,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { Legend } from './Legend';\nimport { ndlEchartsTheme } from './themes/ndl-echarts-theme';\nimport {\n mergeDataZoom,\n mergeSeries,\n mergeToolbox,\n mergeXAxis,\n mergeYAxis,\n} from './user-option-utils';\nimport { capitalizeFirstLetter, extractValueFromTooltipSeries } from './utils';\n\n// This returns a boolean if the condition is met\n// and also what to display in the tooltip.\nfunction checkCondition(\n value: number,\n condition: Condition,\n threshold: number,\n): {\n isConditionMet: boolean;\n conditionText: string | undefined;\n} {\n switch (condition) {\n case 'greater':\n return {\n conditionText: 'Above',\n isConditionMet: value > threshold,\n };\n case 'greaterOrEqual':\n return {\n conditionText:\n value > threshold\n ? 'Above'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value >= threshold,\n };\n case 'less':\n return {\n conditionText: 'Below',\n isConditionMet: value < threshold,\n };\n case 'lessOrEqual':\n return {\n conditionText:\n value < threshold\n ? 'Below'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value <= threshold,\n };\n case 'equal':\n return {\n conditionText: 'Equal',\n isConditionMet: value === threshold,\n };\n case 'notEqual':\n return {\n conditionText: 'Not equal',\n isConditionMet: value !== threshold,\n };\n default:\n return { conditionText: undefined, isConditionMet: false };\n }\n}\n\n/*\nKeep this, if we want more than one type of the same threshold line\nthis will be useful to use.\n\nexport interface NewRegisteredSeriesOption extends RegisteredSeriesOption {\nthresholdLine: ThresholdLineSeriesOption;\n}\nexport type SeriesOption = Values<NewRegisteredSeriesOption>;\nexport type Series = SeriesOption | SeriesOption[];\n*/\n\n/**\n * A chart component powered by Apache ECharts with Needle's customization and theming.\n *\n * The `Chart` component fills 100% of its parent's width and height. Because it\n * relies on the container's `clientHeight` to size the canvas, **the parent element\n * must have an explicit height** (e.g. a fixed px/rem value or a viewport unit).\n *\n * @example\n * ```tsx\n * <div style={{ height: '350px' }}>\n * <Chart dataset={dataset} series={series} xAxis={xAxis} yAxis={yAxis} />\n * </div>\n * ```\n */\nexport function Chart({\n dataset,\n option: userOption,\n xAxis: propXAxis,\n yAxis: propYAxis,\n series: propsSeries,\n style,\n settings = {\n lazyUpdate: false,\n notMerge: true,\n silent: false,\n },\n isLoading,\n isChartZoomDisabled = false,\n legend,\n callbacks,\n palette,\n}: ChartProps): React.JSX.Element {\n const chartRef = useRef<HTMLDivElement>(null);\n const chartEchartRef = useRef<HTMLDivElement>(null);\n const chartLegendRef = useRef<HTMLDivElement>(null);\n const legendSelectedRef = useRef<Record<string, boolean>>({});\n const legendColorCacheRef = useRef<Map<string, string>>(new Map());\n const [isWaitingForFirstResize, setIsWaitingForFirstResize] = useState(true);\n\n const dataZoomOptions = (userOption as EChartsOption)?.dataZoom;\n const toolboxOptions = (userOption as EChartsOption)?.toolbox;\n\n const hasSliderZoom = Array.isArray(dataZoomOptions)\n ? dataZoomOptions.some((dataZoomOption: DataZoomComponentOption) => {\n return dataZoomOption?.type === 'slider';\n })\n : dataZoomOptions?.type === 'slider';\n\n const { theme } = useNeedleTheme();\n const thresholdLines = useMemo(() => {\n const seriesArray = Array.isArray(propsSeries)\n ? propsSeries\n : [propsSeries];\n\n const thresholdLineSeries = seriesArray.filter((currentSeries) => {\n return currentSeries.type === 'thresholdLine';\n }) as ThresholdLineSeriesOption<NotificationType>[];\n\n return thresholdLineSeries.map((currentThresholdLineSeriesOption) => {\n return {\n ...currentThresholdLineSeriesOption,\n condition:\n currentThresholdLineSeriesOption.condition ??\n defaultThresholdLineSeriesOption.condition,\n value: currentThresholdLineSeriesOption.yAxis,\n };\n });\n }, [propsSeries]);\n\n const dataZoom = useMemo(() => {\n return mergeDataZoom(dataZoomOptions);\n }, [dataZoomOptions]);\n\n const series = mergeSeries(propsSeries, theme, userOption, palette);\n const xAxis = mergeXAxis(propXAxis, theme);\n const yAxis = mergeYAxis(propYAxis, theme);\n\n const hasCategoryXAxis = Array.isArray(xAxis)\n ? xAxis.some((x) => x.type === 'category')\n : xAxis?.type === 'category';\n\n // The initial option used, the charts option is not necessarily\n // the same as this due to mutation via dispatch and setOption.\n // use getOption to get the current option of the chart.\n const initialOption = useMemo(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n\n const option = {\n dataset,\n xAxis,\n yAxis,\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 grid: {\n left: hasCategoryXAxis ? '15px' : '10px',\n right: hasCategoryXAxis ? '15px' : '10px',\n top: '10px',\n bottom: hasSliderZoom ? '60px' : '10px',\n type: 'solid',\n containLabel: true,\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // Removes in-built echarts legend\n show: false,\n // Preserve legend filter state across re-renders. legendSelectedRef\n // is the single source of truth, written by the Legend component.\n // ECharts mutates the options object, so pass a shallow copy here\n // to avoid it mutating the React ref object.\n selected: { ...(legendSelectedRef.current || {}) },\n },\n series,\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\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue =\n typeof value === 'number' ? value : Number(value);\n\n const isThresholdLine =\n series.seriesName.startsWith('thresholdLine');\n\n const notifications = thresholdLines\n .filter((threshold) => {\n const {\n value: thresholdValue,\n condition,\n customCondition,\n } = threshold;\n\n if (Number.isNaN(seriesValue)) {\n return false;\n }\n\n const isConditionMet = customCondition\n ? customCondition(seriesValue, thresholdValue)\n : checkCondition(seriesValue, condition, thresholdValue)\n .isConditionMet;\n\n return !isThresholdLine && isConditionMet;\n })\n .map((threshold) => {\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n\n return {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? customConditionText\n : `${\n checkCondition(\n seriesValue,\n condition,\n thresholdValue,\n ).conditionText\n } threshold`,\n notificationType,\n trailingElement: thresholdValue,\n };\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isThresholdLine\n ? `${capitalizeFirstLetter(\n series.seriesName.replace('thresholdLine-', ''),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n },\n },\n dataZoom,\n toolbox: mergeToolbox(toolboxOptions),\n };\n\n // Update chart with initial option\n chart?.setOption(option, settings);\n\n // Get option returns the current option of the chart.\n // This is slightly different than the option we gave as an argument.\n // Because we use useMemo in other areas we want to get this set first,\n // this is why we are setting then getting then returning. If we did this in\n // a useEffect it would run after the other useMemos which is not what we want.\n // This is purely for order of operations.\n const chartOption = chart?.getOption();\n\n return chartOption;\n }, [\n thresholdLines,\n propsSeries,\n dataset,\n xAxis,\n yAxis,\n userOption,\n hasCategoryXAxis,\n hasSliderZoom,\n series,\n dataZoom,\n toolboxOptions,\n settings,\n ]);\n\n useEffect(() => {\n // Initialize chart\n let chart: ECharts | undefined;\n if (chartEchartRef.current !== null) {\n registerTheme('ndl-light', ndlEchartsTheme('light', palette));\n registerTheme('ndl-dark', ndlEchartsTheme('dark', palette));\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (currentChart) {\n chart = currentChart;\n } else {\n const echartsTheme = theme === 'light' ? 'ndl-light' : 'ndl-dark';\n chart = init(chartEchartRef.current, echartsTheme, {\n renderer: 'svg',\n });\n }\n }\n\n if (callbacks?.onZoom) {\n chart?.on('datazoom', () => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (!currentChart) {\n return;\n }\n\n const option = currentChart.getOption();\n if (!option || !option.dataZoom) {\n return;\n }\n\n const dataZoom = Array.isArray(option.dataZoom)\n ? option.dataZoom[0]\n : option.dataZoom;\n const { startValue, endValue } = dataZoom as {\n startValue: number;\n endValue: number;\n };\n\n callbacks?.onZoom?.({ endValue, startValue });\n });\n }\n\n // Add chart resize listener\n // ResizeObserver is leading to a bit janky UX\n function resizeChart() {\n // TODO: We need to revisit this. Right now using grid containLabel seems to work.\n // We still need to visit this for overflowing of the x-axis labels.\n // const calculateGridLeft = () => {\n // const textElements = chartEchartRef.current?.querySelectorAll('text');\n // const filteredTextElements = Array.from(textElements || []).filter(\n // (element) => element.getAttribute('text-anchor') === 'end',\n // );\n // let maxWidth = 0;\n // filteredTextElements.forEach((element) => {\n // const bbox = element.getBBox();\n // maxWidth = Math.max(maxWidth, bbox.width);\n // });\n // const tickLength = 5;\n // const tickPadding = 3;\n // return maxWidth + tickLength + tickPadding;\n // };\n //\n // // Example of dynamically setting the grid's left\n // const gridLeft = calculateGridLeft();\n // chart?.setOption({\n // grid: {\n // left: gridLeft,\n // },\n // });\n\n // We want to fit the chart to the charts container.\n const chartContainerHeight = chartRef.current?.clientHeight;\n const chartContainerWidth = chartRef.current?.clientWidth;\n // Need to take legends height into consideration, otherwise it will overflow the parent.\n const chartLegendHeight = chartLegendRef?.current?.clientHeight || 0;\n const height = chartContainerHeight\n ? chartContainerHeight - chartLegendHeight\n : undefined;\n chart?.resize({\n height,\n width: chartContainerWidth,\n });\n }\n window.addEventListener('resize', resizeChart);\n requestAnimationFrame(() => {\n resizeChart();\n setIsWaitingForFirstResize(false);\n });\n\n // Add chart zoom listeners\n const handleMouseMove = () => {\n // I do not like this at all: https://github.com/apache/echarts/issues/19819\n // echarts updates the svgs on every mouse movement so we need to do this.\n chart?.getZr().setCursorStyle('default');\n };\n // We cannot use chart.getZr().on('mousemove', handleMouseMove)\n // This is because it doesn't respect our callbacks. It will\n // always run echarts code last instead of our callback.\n const chartChild = chartEchartRef.current?.children[0] as HTMLElement;\n if (!isChartZoomDisabled) {\n chartChild.addEventListener('mousemove', handleMouseMove);\n }\n\n const handleMouseDown = (params: { event: MouseEvent }) => {\n const event = params.event;\n const amountOfMouseClicks = event.detail;\n const isDoubleClick = amountOfMouseClicks === 2;\n if (isDoubleClick) {\n // Reset zooming.\n if (chart === undefined) {\n return;\n }\n chart?.dispatchAction({\n end: 100,\n start: 0,\n type: 'dataZoom',\n });\n if (callbacks?.onZoom) {\n callbacks?.onZoom?.({ endValue: 100, startValue: 0 });\n }\n }\n };\n if (!isChartZoomDisabled) {\n chart?.getZr().on('mousedown', handleMouseDown);\n }\n\n // Return cleanup function\n const chartRefCurrentElement = chartEchartRef.current;\n const element = chartRefCurrentElement?.children[0];\n return () => {\n window.removeEventListener('resize', resizeChart);\n\n element?.removeEventListener('mousemove', handleMouseMove);\n\n // Remove chart zoom handlers\n if (chartRefCurrentElement) {\n const chart = getInstanceByDom(chartRefCurrentElement);\n chart?.getZr().off('mousedown', handleMouseDown);\n }\n };\n });\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n\n if (isLoading === true || isWaitingForFirstResize) {\n chart?.showLoading({\n color: tokens.theme[theme].color.primary.bg.status,\n fontFamily: tokens.typography['label'].fontFamily,\n fontSize: tokens.typography['label'].fontSize,\n fontWeight: tokens.typography['label'].fontWeight,\n maskColor: `rgb( from ${tokens.theme[theme].color.neutral.text.inverse} r g b / 0.8)`,\n text: 'Loading',\n textColor: tokens.theme[theme].color.neutral.text.default,\n });\n } else {\n chart?.hideLoading();\n }\n }, [isLoading, isWaitingForFirstResize, theme]);\n\n const legendSeries = useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n const optionSeries = (initialOption?.series as NeedleSeries) ?? [];\n const optionDataset = initialOption?.dataset;\n\n const legendSeries: {\n name: string;\n color: string;\n }[] = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (\n currentSeries.type === 'line' &&\n typeof currentSeries.name === 'string' &&\n currentSeries.name?.includes('thresholdLine')\n ) {\n return;\n } else if (currentSeries.type === 'pie') {\n const encodedItemName = currentSeries.encode?.itemName;\n let currentDataset = Array.isArray(optionDataset)\n ? optionDataset[0]\n : optionDataset;\n if (currentSeries.datasetId && Array.isArray(optionDataset)) {\n currentDataset = optionDataset.find(\n (ds) => ds.id === currentSeries.datasetId,\n );\n } else if (currentSeries.datasetIndex !== undefined) {\n currentDataset = Array.isArray(optionDataset)\n ? optionDataset[currentSeries.datasetIndex]\n : optionDataset;\n }\n const firstDatasetRow = Array.isArray(currentDataset?.source)\n ? currentDataset?.source[0]\n : undefined;\n if (!firstDatasetRow) {\n return;\n }\n\n if (Array.isArray(firstDatasetRow)) {\n const firstDatasetRowIndex = firstDatasetRow.findIndex(\n (item) => item === encodedItemName,\n );\n\n if (firstDatasetRowIndex === -1) {\n return;\n }\n\n const source = currentDataset?.source;\n if (!source) {\n return;\n }\n\n const sourceLength = Array.isArray(source) ? source.length : 0;\n const selected = legendSelectedRef.current;\n const isAllVisible = Object.values(selected).every((v) => v);\n\n for (let rowIndex = 1; rowIndex < sourceLength; rowIndex++) {\n const row = source[rowIndex] as (string | number)[];\n const name = String(row[firstDatasetRowIndex]);\n const freshColor = chart?.getVisual(\n { dataIndexInside: rowIndex - 1, seriesIndex: index },\n 'color',\n );\n\n // Only trust getVisual colors when all items are visible.\n // When items are deselected, getVisual returns grayed-out\n // colors, so we use the cached color from when it was visible.\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n const color =\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000');\n\n legendSeries.push({ color, name });\n }\n } else {\n // TODO: handle dictionary\n }\n\n return;\n } else {\n const name = Array.isArray(optionSeries)\n ? optionSeries[index]?.name\n : undefined;\n\n if (name === undefined) {\n return null;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries.filter((currentSeries) => currentSeries !== null);\n }, [isWaitingForFirstResize, initialOption]);\n\n if (chartEchartRef.current !== null && !isChartZoomDisabled) {\n const chart = getInstanceByDom(chartEchartRef.current);\n if (chart) {\n // Needs to be re-set on every re-render.\n // Sets the selectable zoom area over the chart (not the slider).\n chart.dispatchAction({\n dataZoomSelectActive: true,\n key: 'dataZoomSelect',\n type: 'takeGlobalCursor',\n });\n }\n }\n\n return (\n <div ref={chartRef} className=\"ndl-chart\" style={style}>\n <div ref={chartEchartRef} />\n {legend?.show && !isWaitingForFirstResize && (\n <Legend\n ref={chartLegendRef}\n wrappingType={legend.wrappingType}\n series={legendSeries ?? []}\n chartRef={chartEchartRef}\n selectedRef={legendSelectedRef}\n />\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../src/charts/chart-types.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n show?: boolean;\n wrappingType?: LegendProps['wrappingType'];\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /** Settings for how ECharts should update the chart. */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n x: number;\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n selected?: boolean;\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n series: {\n name: string;\n color: string;\n }[];\n chartRef: React.RefObject<HTMLDivElement | null>;\n /** Shared ref for legend selection state. Chart reads this when building\n * setOption so that legend filters survive re-renders. */\n selectedRef?: React.MutableRefObject<Record<string, boolean>>;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport interface LegendOverflowProps extends LegendProps {\n className?: string;\n selectedSeries: Record<string, boolean>;\n onSetAllVisible: () => void;\n onToggleLegendVisibility?: (\n name: string,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n allSeries: { name: string; color: string }[],\n ) => void;\n onLegendItemMouseEnter: (series: { name: string; color: string }[]) => void;\n onLegendItemMouseLeave: (series: { name: string; color: string }[]) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../src/charts/chart-types.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type HexColor = `#${string}`;\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n show?: boolean;\n wrappingType?: LegendProps['wrappingType'];\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /** Settings for how ECharts should update the chart. */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n /** Custom color palette that overrides the default categorical colors. */\n palette?: HexColor[];\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n x: number;\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n selected?: boolean;\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n series: {\n name: string;\n color: string;\n }[];\n chartRef: React.RefObject<HTMLDivElement | null>;\n /** Shared ref for legend selection state. Chart reads this when building\n * setOption so that legend filters survive re-renders. */\n selectedRef?: React.MutableRefObject<Record<string, boolean>>;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport interface LegendOverflowProps extends LegendProps {\n className?: string;\n selectedSeries: Record<string, boolean>;\n onSetAllVisible: () => void;\n onToggleLegendVisibility?: (\n name: string,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n allSeries: { name: string; color: string }[],\n ) => void;\n onLegendItemMouseEnter: (series: { name: string; color: string }[]) => void;\n onLegendItemMouseLeave: (series: { name: string; color: string }[]) => void;\n}\n"]}
|
|
@@ -21,6 +21,7 @@ exports.ndlEchartsTheme = void 0;
|
|
|
21
21
|
* You should have received a copy of the GNU General Public License
|
|
22
22
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
23
|
*/
|
|
24
|
+
// oxlint-disable sort-keys
|
|
24
25
|
const base_1 = require("@neo4j-ndl/base");
|
|
25
26
|
const axisCommon = (theme) => ({
|
|
26
27
|
axisLabel: {
|
|
@@ -59,10 +60,10 @@ const axisCommon = (theme) => ({
|
|
|
59
60
|
},
|
|
60
61
|
},
|
|
61
62
|
});
|
|
62
|
-
const ndlEchartsTheme = (theme) => {
|
|
63
|
+
const ndlEchartsTheme = (theme, palette) => {
|
|
63
64
|
return {
|
|
64
65
|
darkMode: theme === 'dark',
|
|
65
|
-
color: Object.values(base_1.tokens.categorical),
|
|
66
|
+
color: palette !== null && palette !== void 0 ? palette : Object.values(base_1.tokens.categorical),
|
|
66
67
|
backgroundColor: 'transparent',
|
|
67
68
|
axisPointer: {
|
|
68
69
|
crossStyle: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;
|
|
1
|
+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BAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,eAAe,mBA6G1B","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n// oxlint-disable sort-keys\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type HexColor } from '../chart-types';\n\nconst axisCommon = (theme: 'light' | 'dark') => ({\n axisLabel: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n fontFamily: tokens.typography['body-small'].fontFamily,\n fontSize: tokens.typography['body-small'].fontSize,\n },\n axisLine: {\n lineStyle: {\n cap: 'square',\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 2,\n },\n },\n axisTick: {\n length: 8,\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 1,\n },\n show: true,\n },\n minorSplitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n splitArea: {\n areaStyle: {\n color: [tokens.theme[theme].color.neutral.hover, 'transparent'],\n },\n },\n splitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n});\n\nexport const ndlEchartsTheme = (\n theme: 'light' | 'dark',\n palette?: HexColor[],\n) => {\n return {\n darkMode: theme === 'dark',\n color: palette ?? Object.values(tokens.categorical),\n backgroundColor: 'transparent',\n\n axisPointer: {\n crossStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n label: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n },\n // We use a custom legend so this does not affect anything\n legend: {},\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n // We are not using the echarts title so this does not affect anything\n title: {},\n toolbox: {},\n\n dataZoom: {\n backgroundColor: 'transparent',\n borderColor: tokens.theme[theme].color.neutral.border.weak,\n borderRadius: parseInt(tokens.borderRadius.sm.replace('px', '')),\n dataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg.default,\n opacity: 1,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n opacity: 1,\n width: 1,\n },\n },\n emphasis: {\n handleLabel: {},\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1,\n },\n moveHandleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n },\n },\n fillerColor: `rgb( from ${tokens.theme[theme].color.neutral.hover} r g b / 0.1)`,\n handleIcon:\n 'M2 0.5h4s1.5 0 1.5 1.5v16s0 1.5 -1.5 1.5h-4s-1.5 0 -1.5 -1.5v-16s0 -1.5 1.5 -1.5',\n handleSize: '80%',\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.weak,\n\n // borderRadius: 0, // Doesn't work\n },\n moveHandleSize: 6,\n moveHandleStyle: {\n backgroundColor: tokens.theme[theme].color.neutral.bg.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1, // 0.3,\n },\n selectedDataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg['on-bg-weak'],\n opacity: 1,\n shadowBlur: 0,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n width: 1,\n },\n },\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n },\n // Not implemented\n visualMap: {},\n // Not implemented\n timeline: {},\n // Not implemented\n calendar: {},\n timeAxis: axisCommon(theme),\n logAxis: axisCommon(theme),\n valueAxis: axisCommon(theme),\n categoryAxis: axisCommon(theme),\n line: {\n symbol: 'circle',\n },\n // Not implemented\n graph: {},\n // Not implemented\n gauge: {},\n // Not implemented\n candlestick: {},\n };\n};\n"]}
|
|
@@ -26,8 +26,9 @@ const base_1 = require("@neo4j-ndl/base");
|
|
|
26
26
|
const server_1 = require("react-dom/server");
|
|
27
27
|
const ChartTooltip_1 = require("./ChartTooltip");
|
|
28
28
|
const defaults_1 = require("./defaults");
|
|
29
|
-
const
|
|
30
|
-
const mergeSeries = (series, theme = 'light', userOption) => {
|
|
29
|
+
const defaultColors = Object.values(base_1.tokens.categorical);
|
|
30
|
+
const mergeSeries = (series, theme = 'light', userOption, palette) => {
|
|
31
|
+
const colors = palette !== null && palette !== void 0 ? palette : defaultColors;
|
|
31
32
|
return series.map((option, index = 0) => {
|
|
32
33
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
33
34
|
if (option === undefined) {
|
|
@@ -35,7 +36,7 @@ const mergeSeries = (series, theme = 'light', userOption) => {
|
|
|
35
36
|
}
|
|
36
37
|
const color = Array.isArray(option.color)
|
|
37
38
|
? option.color[index]
|
|
38
|
-
: ((_a = option.color) !== null && _a !== void 0 ? _a : colors[index]);
|
|
39
|
+
: ((_a = option.color) !== null && _a !== void 0 ? _a : colors[index % colors.length]);
|
|
39
40
|
if (option.type === 'thresholdLine') {
|
|
40
41
|
const { notificationType } = option;
|
|
41
42
|
// Needed to differentiate between normal lines and threshold lines
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;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AM,EAAE,EAAE,EACV,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,EAAE,EACT,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,QAAQ,IACX,QAAQ,EACX;IACJ,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,uBACE,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,CAAC,CAAC,CAAC,EACf,gBAAgB,EAAE,KAAK,IACpB,QAAQ,EACX;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAhCW,QAAA,aAAa,iBAgCxB;AAEK,MAAM,YAAY,GAAG,CAC1B,OAAiC,EACP,EAAE;;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,IAAA,oBAAY,EAAC,MAAM,CAAC,CACO,CAAC;IAChC,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,gCACN,UAAU,EAAE,KAAK,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n type EchartsSeries,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\n\nconst colors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n): EchartsSeries => {\n return series.map(\n (\n option:\n | SeriesOption\n | ThresholdLineSeriesOption<'warning'>\n | ThresholdLineSeriesOption<'danger'>,\n index: number = 0,\n ): SeriesOption => {\n if (option === undefined) {\n return {};\n }\n\n const color = Array.isArray(option.color)\n ? option.color[index]\n : (option.color ?? colors[index]);\n\n if (option.type === 'thresholdLine') {\n const { notificationType } = option;\n // Needed to differentiate between normal lines and threshold lines\n // as we are unable to inject custom properties into echarts series lines.\n const thresholdLineName = `thresholdLine-${notificationType}`;\n return {\n symbolSize: 9,\n symbol: 'none',\n condition: defaultThresholdLineSeriesOption.condition,\n ...option,\n lineStyle: {\n width: 2,\n type: 'dashed',\n ...option.lineStyle,\n },\n name: thresholdLineName,\n type: 'line',\n data: [\n [option.xAxis[0], option.yAxis],\n [option.xAxis[1], option.yAxis],\n ],\n };\n }\n\n if (option.type === 'line') {\n const shadow = tokens.theme[theme].boxShadow.raised;\n const shadowParts = shadow.split(/ (?=\\d+px|rgba?\\()/);\n\n return {\n type: 'line',\n symbolSize: 9,\n color,\n symbol: 'none',\n ...option,\n lineStyle: {\n width: 2,\n type: 'solid' as const,\n ...option.lineStyle,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n },\n },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AAEzC,6CAAkD;AAQlD,iDAA8C;AAC9C,yCAA8D;AAE9D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,WAAW,CAAC,CAAC;AAEjD,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,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YACvC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAEpD,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,EA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,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\n\nconst defaultColors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n 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 return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n },\n },\n };\n};\n"]}
|
package/lib/esm/charts/Chart.js
CHANGED
|
@@ -105,7 +105,7 @@ export function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: pr
|
|
|
105
105
|
lazyUpdate: false,
|
|
106
106
|
notMerge: true,
|
|
107
107
|
silent: false,
|
|
108
|
-
}, isLoading, isChartZoomDisabled = false, legend, callbacks, }) {
|
|
108
|
+
}, isLoading, isChartZoomDisabled = false, legend, callbacks, palette, }) {
|
|
109
109
|
const chartRef = useRef(null);
|
|
110
110
|
const chartEchartRef = useRef(null);
|
|
111
111
|
const chartLegendRef = useRef(null);
|
|
@@ -135,7 +135,7 @@ export function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: pr
|
|
|
135
135
|
const dataZoom = useMemo(() => {
|
|
136
136
|
return mergeDataZoom(dataZoomOptions);
|
|
137
137
|
}, [dataZoomOptions]);
|
|
138
|
-
const series = mergeSeries(propsSeries, theme, userOption);
|
|
138
|
+
const series = mergeSeries(propsSeries, theme, userOption, palette);
|
|
139
139
|
const xAxis = mergeXAxis(propXAxis, theme);
|
|
140
140
|
const yAxis = mergeYAxis(propYAxis, theme);
|
|
141
141
|
const hasCategoryXAxis = Array.isArray(xAxis)
|
|
@@ -244,8 +244,8 @@ export function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: pr
|
|
|
244
244
|
// Initialize chart
|
|
245
245
|
let chart;
|
|
246
246
|
if (chartEchartRef.current !== null) {
|
|
247
|
-
registerTheme('ndl-light', ndlEchartsTheme('light'));
|
|
248
|
-
registerTheme('ndl-dark', ndlEchartsTheme('dark'));
|
|
247
|
+
registerTheme('ndl-light', ndlEchartsTheme('light', palette));
|
|
248
|
+
registerTheme('ndl-dark', ndlEchartsTheme('dark', palette));
|
|
249
249
|
const currentChart = getInstanceByDom(chartEchartRef.current);
|
|
250
250
|
if (currentChart) {
|
|
251
251
|
chart = currentChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAIL,gBAAgB,EAChB,IAAI,EACJ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,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AE,kBAAkB;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,CACL,eAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,KAAK,aACpD,cAAK,GAAG,EAAE,cAAc,GAAI,EAC3B,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,CAAC,uBAAuB,IAAI,CAC3C,KAAC,MAAM,IACL,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,MAAM,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAC1B,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,iBAAiB,GAC9B,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { useNeedleTheme } from '@neo4j-ndl/react';\nimport {\n type DataZoomComponentOption,\n type ECharts,\n type EChartsOption,\n getInstanceByDom,\n init,\n registerTheme,\n} from 'echarts';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport {\n type ChartProps,\n type Condition,\n type NeedleSeries,\n type NotificationType,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { Legend } from './Legend';\nimport { ndlEchartsTheme } from './themes/ndl-echarts-theme';\nimport {\n mergeDataZoom,\n mergeSeries,\n mergeToolbox,\n mergeXAxis,\n mergeYAxis,\n} from './user-option-utils';\nimport { capitalizeFirstLetter, extractValueFromTooltipSeries } from './utils';\n\n// This returns a boolean if the condition is met\n// and also what to display in the tooltip.\nfunction checkCondition(\n value: number,\n condition: Condition,\n threshold: number,\n): {\n isConditionMet: boolean;\n conditionText: string | undefined;\n} {\n switch (condition) {\n case 'greater':\n return {\n conditionText: 'Above',\n isConditionMet: value > threshold,\n };\n case 'greaterOrEqual':\n return {\n conditionText:\n value > threshold\n ? 'Above'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value >= threshold,\n };\n case 'less':\n return {\n conditionText: 'Below',\n isConditionMet: value < threshold,\n };\n case 'lessOrEqual':\n return {\n conditionText:\n value < threshold\n ? 'Below'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value <= threshold,\n };\n case 'equal':\n return {\n conditionText: 'Equal',\n isConditionMet: value === threshold,\n };\n case 'notEqual':\n return {\n conditionText: 'Not equal',\n isConditionMet: value !== threshold,\n };\n default:\n return { conditionText: undefined, isConditionMet: false };\n }\n}\n\n/*\nKeep this, if we want more than one type of the same threshold line\nthis will be useful to use.\n\nexport interface NewRegisteredSeriesOption extends RegisteredSeriesOption {\nthresholdLine: ThresholdLineSeriesOption;\n}\nexport type SeriesOption = Values<NewRegisteredSeriesOption>;\nexport type Series = SeriesOption | SeriesOption[];\n*/\n\n/**\n * A chart component powered by Apache ECharts with Needle's customization and theming.\n *\n * The `Chart` component fills 100% of its parent's width and height. Because it\n * relies on the container's `clientHeight` to size the canvas, **the parent element\n * must have an explicit height** (e.g. a fixed px/rem value or a viewport unit).\n *\n * @example\n * ```tsx\n * <div style={{ height: '350px' }}>\n * <Chart dataset={dataset} series={series} xAxis={xAxis} yAxis={yAxis} />\n * </div>\n * ```\n */\nexport function Chart({\n dataset,\n option: userOption,\n xAxis: propXAxis,\n yAxis: propYAxis,\n series: propsSeries,\n style,\n settings = {\n lazyUpdate: false,\n notMerge: true,\n silent: false,\n },\n isLoading,\n isChartZoomDisabled = false,\n legend,\n callbacks,\n}: ChartProps): React.JSX.Element {\n const chartRef = useRef<HTMLDivElement>(null);\n const chartEchartRef = useRef<HTMLDivElement>(null);\n const chartLegendRef = useRef<HTMLDivElement>(null);\n const legendSelectedRef = useRef<Record<string, boolean>>({});\n const legendColorCacheRef = useRef<Map<string, string>>(new Map());\n const [isWaitingForFirstResize, setIsWaitingForFirstResize] = useState(true);\n\n const dataZoomOptions = (userOption as EChartsOption)?.dataZoom;\n const toolboxOptions = (userOption as EChartsOption)?.toolbox;\n\n const hasSliderZoom = Array.isArray(dataZoomOptions)\n ? dataZoomOptions.some((dataZoomOption: DataZoomComponentOption) => {\n return dataZoomOption?.type === 'slider';\n })\n : dataZoomOptions?.type === 'slider';\n\n const { theme } = useNeedleTheme();\n const thresholdLines = useMemo(() => {\n const seriesArray = Array.isArray(propsSeries)\n ? propsSeries\n : [propsSeries];\n\n const thresholdLineSeries = seriesArray.filter((currentSeries) => {\n return currentSeries.type === 'thresholdLine';\n }) as ThresholdLineSeriesOption<NotificationType>[];\n\n return thresholdLineSeries.map((currentThresholdLineSeriesOption) => {\n return {\n ...currentThresholdLineSeriesOption,\n condition:\n currentThresholdLineSeriesOption.condition ??\n defaultThresholdLineSeriesOption.condition,\n value: currentThresholdLineSeriesOption.yAxis,\n };\n });\n }, [propsSeries]);\n\n const dataZoom = useMemo(() => {\n return mergeDataZoom(dataZoomOptions);\n }, [dataZoomOptions]);\n\n const series = mergeSeries(propsSeries, theme, userOption);\n const xAxis = mergeXAxis(propXAxis, theme);\n const yAxis = mergeYAxis(propYAxis, theme);\n\n const hasCategoryXAxis = Array.isArray(xAxis)\n ? xAxis.some((x) => x.type === 'category')\n : xAxis?.type === 'category';\n\n // The initial option used, the charts option is not necessarily\n // the same as this due to mutation via dispatch and setOption.\n // use getOption to get the current option of the chart.\n const initialOption = useMemo(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n\n const option = {\n dataset,\n xAxis,\n yAxis,\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 grid: {\n left: hasCategoryXAxis ? '15px' : '10px',\n right: hasCategoryXAxis ? '15px' : '10px',\n top: '10px',\n bottom: hasSliderZoom ? '60px' : '10px',\n type: 'solid',\n containLabel: true,\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // Removes in-built echarts legend\n show: false,\n // Preserve legend filter state across re-renders. legendSelectedRef\n // is the single source of truth, written by the Legend component.\n // ECharts mutates the options object, so pass a shallow copy here\n // to avoid it mutating the React ref object.\n selected: { ...(legendSelectedRef.current || {}) },\n },\n series,\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\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue =\n typeof value === 'number' ? value : Number(value);\n\n const isThresholdLine =\n series.seriesName.startsWith('thresholdLine');\n\n const notifications = thresholdLines\n .filter((threshold) => {\n const {\n value: thresholdValue,\n condition,\n customCondition,\n } = threshold;\n\n if (Number.isNaN(seriesValue)) {\n return false;\n }\n\n const isConditionMet = customCondition\n ? customCondition(seriesValue, thresholdValue)\n : checkCondition(seriesValue, condition, thresholdValue)\n .isConditionMet;\n\n return !isThresholdLine && isConditionMet;\n })\n .map((threshold) => {\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n\n return {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? customConditionText\n : `${\n checkCondition(\n seriesValue,\n condition,\n thresholdValue,\n ).conditionText\n } threshold`,\n notificationType,\n trailingElement: thresholdValue,\n };\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isThresholdLine\n ? `${capitalizeFirstLetter(\n series.seriesName.replace('thresholdLine-', ''),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n },\n },\n dataZoom,\n toolbox: mergeToolbox(toolboxOptions),\n };\n\n // Update chart with initial option\n chart?.setOption(option, settings);\n\n // Get option returns the current option of the chart.\n // This is slightly different than the option we gave as an argument.\n // Because we use useMemo in other areas we want to get this set first,\n // this is why we are setting then getting then returning. If we did this in\n // a useEffect it would run after the other useMemos which is not what we want.\n // This is purely for order of operations.\n const chartOption = chart?.getOption();\n\n return chartOption;\n }, [\n thresholdLines,\n propsSeries,\n dataset,\n xAxis,\n yAxis,\n userOption,\n hasCategoryXAxis,\n hasSliderZoom,\n series,\n dataZoom,\n toolboxOptions,\n settings,\n ]);\n\n useEffect(() => {\n // Initialize chart\n let chart: ECharts | undefined;\n if (chartEchartRef.current !== null) {\n registerTheme('ndl-light', ndlEchartsTheme('light'));\n registerTheme('ndl-dark', ndlEchartsTheme('dark'));\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (currentChart) {\n chart = currentChart;\n } else {\n const echartsTheme = theme === 'light' ? 'ndl-light' : 'ndl-dark';\n chart = init(chartEchartRef.current, echartsTheme, {\n renderer: 'svg',\n });\n }\n }\n\n if (callbacks?.onZoom) {\n chart?.on('datazoom', () => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (!currentChart) {\n return;\n }\n\n const option = currentChart.getOption();\n if (!option || !option.dataZoom) {\n return;\n }\n\n const dataZoom = Array.isArray(option.dataZoom)\n ? option.dataZoom[0]\n : option.dataZoom;\n const { startValue, endValue } = dataZoom as {\n startValue: number;\n endValue: number;\n };\n\n callbacks?.onZoom?.({ endValue, startValue });\n });\n }\n\n // Add chart resize listener\n // ResizeObserver is leading to a bit janky UX\n function resizeChart() {\n // TODO: We need to revisit this. Right now using grid containLabel seems to work.\n // We still need to visit this for overflowing of the x-axis labels.\n // const calculateGridLeft = () => {\n // const textElements = chartEchartRef.current?.querySelectorAll('text');\n // const filteredTextElements = Array.from(textElements || []).filter(\n // (element) => element.getAttribute('text-anchor') === 'end',\n // );\n // let maxWidth = 0;\n // filteredTextElements.forEach((element) => {\n // const bbox = element.getBBox();\n // maxWidth = Math.max(maxWidth, bbox.width);\n // });\n // const tickLength = 5;\n // const tickPadding = 3;\n // return maxWidth + tickLength + tickPadding;\n // };\n //\n // // Example of dynamically setting the grid's left\n // const gridLeft = calculateGridLeft();\n // chart?.setOption({\n // grid: {\n // left: gridLeft,\n // },\n // });\n\n // We want to fit the chart to the charts container.\n const chartContainerHeight = chartRef.current?.clientHeight;\n const chartContainerWidth = chartRef.current?.clientWidth;\n // Need to take legends height into consideration, otherwise it will overflow the parent.\n const chartLegendHeight = chartLegendRef?.current?.clientHeight || 0;\n const height = chartContainerHeight\n ? chartContainerHeight - chartLegendHeight\n : undefined;\n chart?.resize({\n height,\n width: chartContainerWidth,\n });\n }\n window.addEventListener('resize', resizeChart);\n requestAnimationFrame(() => {\n resizeChart();\n setIsWaitingForFirstResize(false);\n });\n\n // Add chart zoom listeners\n const handleMouseMove = () => {\n // I do not like this at all: https://github.com/apache/echarts/issues/19819\n // echarts updates the svgs on every mouse movement so we need to do this.\n chart?.getZr().setCursorStyle('default');\n };\n // We cannot use chart.getZr().on('mousemove', handleMouseMove)\n // This is because it doesn't respect our callbacks. It will\n // always run echarts code last instead of our callback.\n const chartChild = chartEchartRef.current?.children[0] as HTMLElement;\n if (!isChartZoomDisabled) {\n chartChild.addEventListener('mousemove', handleMouseMove);\n }\n\n const handleMouseDown = (params: { event: MouseEvent }) => {\n const event = params.event;\n const amountOfMouseClicks = event.detail;\n const isDoubleClick = amountOfMouseClicks === 2;\n if (isDoubleClick) {\n // Reset zooming.\n if (chart === undefined) {\n return;\n }\n chart?.dispatchAction({\n end: 100,\n start: 0,\n type: 'dataZoom',\n });\n if (callbacks?.onZoom) {\n callbacks?.onZoom?.({ endValue: 100, startValue: 0 });\n }\n }\n };\n if (!isChartZoomDisabled) {\n chart?.getZr().on('mousedown', handleMouseDown);\n }\n\n // Return cleanup function\n const chartRefCurrentElement = chartEchartRef.current;\n const element = chartRefCurrentElement?.children[0];\n return () => {\n window.removeEventListener('resize', resizeChart);\n\n element?.removeEventListener('mousemove', handleMouseMove);\n\n // Remove chart zoom handlers\n if (chartRefCurrentElement) {\n const chart = getInstanceByDom(chartRefCurrentElement);\n chart?.getZr().off('mousedown', handleMouseDown);\n }\n };\n });\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n\n if (isLoading === true || isWaitingForFirstResize) {\n chart?.showLoading({\n color: tokens.theme[theme].color.primary.bg.status,\n fontFamily: tokens.typography['label'].fontFamily,\n fontSize: tokens.typography['label'].fontSize,\n fontWeight: tokens.typography['label'].fontWeight,\n maskColor: `rgb( from ${tokens.theme[theme].color.neutral.text.inverse} r g b / 0.8)`,\n text: 'Loading',\n textColor: tokens.theme[theme].color.neutral.text.default,\n });\n } else {\n chart?.hideLoading();\n }\n }, [isLoading, isWaitingForFirstResize, theme]);\n\n const legendSeries = useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n const optionSeries = (initialOption?.series as NeedleSeries) ?? [];\n const optionDataset = initialOption?.dataset;\n\n const legendSeries: {\n name: string;\n color: string;\n }[] = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (\n currentSeries.type === 'line' &&\n typeof currentSeries.name === 'string' &&\n currentSeries.name?.includes('thresholdLine')\n ) {\n return;\n } else if (currentSeries.type === 'pie') {\n const encodedItemName = currentSeries.encode?.itemName;\n let currentDataset = Array.isArray(optionDataset)\n ? optionDataset[0]\n : optionDataset;\n if (currentSeries.datasetId && Array.isArray(optionDataset)) {\n currentDataset = optionDataset.find(\n (ds) => ds.id === currentSeries.datasetId,\n );\n } else if (currentSeries.datasetIndex !== undefined) {\n currentDataset = Array.isArray(optionDataset)\n ? optionDataset[currentSeries.datasetIndex]\n : optionDataset;\n }\n const firstDatasetRow = Array.isArray(currentDataset?.source)\n ? currentDataset?.source[0]\n : undefined;\n if (!firstDatasetRow) {\n return;\n }\n\n if (Array.isArray(firstDatasetRow)) {\n const firstDatasetRowIndex = firstDatasetRow.findIndex(\n (item) => item === encodedItemName,\n );\n\n if (firstDatasetRowIndex === -1) {\n return;\n }\n\n const source = currentDataset?.source;\n if (!source) {\n return;\n }\n\n const sourceLength = Array.isArray(source) ? source.length : 0;\n const selected = legendSelectedRef.current;\n const isAllVisible = Object.values(selected).every((v) => v);\n\n for (let rowIndex = 1; rowIndex < sourceLength; rowIndex++) {\n const row = source[rowIndex] as (string | number)[];\n const name = String(row[firstDatasetRowIndex]);\n const freshColor = chart?.getVisual(\n { dataIndexInside: rowIndex - 1, seriesIndex: index },\n 'color',\n );\n\n // Only trust getVisual colors when all items are visible.\n // When items are deselected, getVisual returns grayed-out\n // colors, so we use the cached color from when it was visible.\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n const color =\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000');\n\n legendSeries.push({ color, name });\n }\n } else {\n // TODO: handle dictionary\n }\n\n return;\n } else {\n const name = Array.isArray(optionSeries)\n ? optionSeries[index]?.name\n : undefined;\n\n if (name === undefined) {\n return null;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries.filter((currentSeries) => currentSeries !== null);\n }, [isWaitingForFirstResize, initialOption]);\n\n if (chartEchartRef.current !== null && !isChartZoomDisabled) {\n const chart = getInstanceByDom(chartEchartRef.current);\n if (chart) {\n // Needs to be re-set on every re-render.\n // Sets the selectable zoom area over the chart (not the slider).\n chart.dispatchAction({\n dataZoomSelectActive: true,\n key: 'dataZoomSelect',\n type: 'takeGlobalCursor',\n });\n }\n }\n\n return (\n <div ref={chartRef} className=\"ndl-chart\" style={style}>\n <div ref={chartEchartRef} />\n {legend?.show && !isWaitingForFirstResize && (\n <Legend\n ref={chartLegendRef}\n wrappingType={legend.wrappingType}\n series={legendSeries ?? []}\n chartRef={chartEchartRef}\n selectedRef={legendSelectedRef}\n />\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAIL,gBAAgB,EAChB,IAAI,EACJ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA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AAkB;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,CACL,eAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,KAAK,aACpD,cAAK,GAAG,EAAE,cAAc,GAAI,EAC3B,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,CAAC,uBAAuB,IAAI,CAC3C,KAAC,MAAM,IACL,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,MAAM,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAC1B,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,iBAAiB,GAC9B,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { useNeedleTheme } from '@neo4j-ndl/react';\nimport {\n type DataZoomComponentOption,\n type ECharts,\n type EChartsOption,\n getInstanceByDom,\n init,\n registerTheme,\n} from 'echarts';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { renderToString } from 'react-dom/server';\n\nimport { generateThresholdAriaDescription } from './aria-description';\nimport {\n type ChartProps,\n type Condition,\n type NeedleSeries,\n type NotificationType,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\nimport { Legend } from './Legend';\nimport { ndlEchartsTheme } from './themes/ndl-echarts-theme';\nimport {\n mergeDataZoom,\n mergeSeries,\n mergeToolbox,\n mergeXAxis,\n mergeYAxis,\n} from './user-option-utils';\nimport { capitalizeFirstLetter, extractValueFromTooltipSeries } from './utils';\n\n// This returns a boolean if the condition is met\n// and also what to display in the tooltip.\nfunction checkCondition(\n value: number,\n condition: Condition,\n threshold: number,\n): {\n isConditionMet: boolean;\n conditionText: string | undefined;\n} {\n switch (condition) {\n case 'greater':\n return {\n conditionText: 'Above',\n isConditionMet: value > threshold,\n };\n case 'greaterOrEqual':\n return {\n conditionText:\n value > threshold\n ? 'Above'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value >= threshold,\n };\n case 'less':\n return {\n conditionText: 'Below',\n isConditionMet: value < threshold,\n };\n case 'lessOrEqual':\n return {\n conditionText:\n value < threshold\n ? 'Below'\n : value === threshold\n ? 'Equal'\n : undefined,\n isConditionMet: value <= threshold,\n };\n case 'equal':\n return {\n conditionText: 'Equal',\n isConditionMet: value === threshold,\n };\n case 'notEqual':\n return {\n conditionText: 'Not equal',\n isConditionMet: value !== threshold,\n };\n default:\n return { conditionText: undefined, isConditionMet: false };\n }\n}\n\n/*\nKeep this, if we want more than one type of the same threshold line\nthis will be useful to use.\n\nexport interface NewRegisteredSeriesOption extends RegisteredSeriesOption {\nthresholdLine: ThresholdLineSeriesOption;\n}\nexport type SeriesOption = Values<NewRegisteredSeriesOption>;\nexport type Series = SeriesOption | SeriesOption[];\n*/\n\n/**\n * A chart component powered by Apache ECharts with Needle's customization and theming.\n *\n * The `Chart` component fills 100% of its parent's width and height. Because it\n * relies on the container's `clientHeight` to size the canvas, **the parent element\n * must have an explicit height** (e.g. a fixed px/rem value or a viewport unit).\n *\n * @example\n * ```tsx\n * <div style={{ height: '350px' }}>\n * <Chart dataset={dataset} series={series} xAxis={xAxis} yAxis={yAxis} />\n * </div>\n * ```\n */\nexport function Chart({\n dataset,\n option: userOption,\n xAxis: propXAxis,\n yAxis: propYAxis,\n series: propsSeries,\n style,\n settings = {\n lazyUpdate: false,\n notMerge: true,\n silent: false,\n },\n isLoading,\n isChartZoomDisabled = false,\n legend,\n callbacks,\n palette,\n}: ChartProps): React.JSX.Element {\n const chartRef = useRef<HTMLDivElement>(null);\n const chartEchartRef = useRef<HTMLDivElement>(null);\n const chartLegendRef = useRef<HTMLDivElement>(null);\n const legendSelectedRef = useRef<Record<string, boolean>>({});\n const legendColorCacheRef = useRef<Map<string, string>>(new Map());\n const [isWaitingForFirstResize, setIsWaitingForFirstResize] = useState(true);\n\n const dataZoomOptions = (userOption as EChartsOption)?.dataZoom;\n const toolboxOptions = (userOption as EChartsOption)?.toolbox;\n\n const hasSliderZoom = Array.isArray(dataZoomOptions)\n ? dataZoomOptions.some((dataZoomOption: DataZoomComponentOption) => {\n return dataZoomOption?.type === 'slider';\n })\n : dataZoomOptions?.type === 'slider';\n\n const { theme } = useNeedleTheme();\n const thresholdLines = useMemo(() => {\n const seriesArray = Array.isArray(propsSeries)\n ? propsSeries\n : [propsSeries];\n\n const thresholdLineSeries = seriesArray.filter((currentSeries) => {\n return currentSeries.type === 'thresholdLine';\n }) as ThresholdLineSeriesOption<NotificationType>[];\n\n return thresholdLineSeries.map((currentThresholdLineSeriesOption) => {\n return {\n ...currentThresholdLineSeriesOption,\n condition:\n currentThresholdLineSeriesOption.condition ??\n defaultThresholdLineSeriesOption.condition,\n value: currentThresholdLineSeriesOption.yAxis,\n };\n });\n }, [propsSeries]);\n\n const dataZoom = useMemo(() => {\n return mergeDataZoom(dataZoomOptions);\n }, [dataZoomOptions]);\n\n const series = mergeSeries(propsSeries, theme, userOption, palette);\n const xAxis = mergeXAxis(propXAxis, theme);\n const yAxis = mergeYAxis(propYAxis, theme);\n\n const hasCategoryXAxis = Array.isArray(xAxis)\n ? xAxis.some((x) => x.type === 'category')\n : xAxis?.type === 'category';\n\n // The initial option used, the charts option is not necessarily\n // the same as this due to mutation via dispatch and setOption.\n // use getOption to get the current option of the chart.\n const initialOption = useMemo(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef.current);\n\n const customAriaDescription = generateThresholdAriaDescription(\n propsSeries,\n dataset,\n );\n\n const option = {\n dataset,\n xAxis,\n yAxis,\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 grid: {\n left: hasCategoryXAxis ? '15px' : '10px',\n right: hasCategoryXAxis ? '15px' : '10px',\n top: '10px',\n bottom: hasSliderZoom ? '60px' : '10px',\n type: 'solid',\n containLabel: true,\n ...(userOption?.grid as EChartsOption['grid']),\n },\n legend: {\n // Removes in-built echarts legend\n show: false,\n // Preserve legend filter state across re-renders. legendSelectedRef\n // is the single source of truth, written by the Legend component.\n // ECharts mutates the options object, so pass a shallow copy here\n // to avoid it mutating the React ref object.\n selected: { ...(legendSelectedRef.current || {}) },\n },\n series,\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\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>\n {firstParam?.axisValueLabel ?? ''}\n </ChartTooltip.Title>\n {paramsArray.map((series) => {\n const value = extractValueFromTooltipSeries(\n series.value,\n series.encode,\n series.axisDim,\n );\n\n const seriesValue =\n typeof value === 'number' ? value : Number(value);\n\n const isThresholdLine =\n series.seriesName.startsWith('thresholdLine');\n\n const notifications = thresholdLines\n .filter((threshold) => {\n const {\n value: thresholdValue,\n condition,\n customCondition,\n } = threshold;\n\n if (Number.isNaN(seriesValue)) {\n return false;\n }\n\n const isConditionMet = customCondition\n ? customCondition(seriesValue, thresholdValue)\n : checkCondition(seriesValue, condition, thresholdValue)\n .isConditionMet;\n\n return !isThresholdLine && isConditionMet;\n })\n .map((threshold) => {\n const {\n notificationType,\n value: thresholdValue,\n condition,\n customConditionText,\n customCondition,\n } = threshold;\n\n return {\n id: `threshold-${notificationType}`,\n leadingElement: customCondition\n ? customConditionText\n : `${\n checkCondition(\n seriesValue,\n condition,\n thresholdValue,\n ).conditionText\n } threshold`,\n notificationType,\n trailingElement: thresholdValue,\n };\n });\n\n return (\n <ChartTooltip.Content\n key={series.seriesName}\n leadingElement={\n isThresholdLine\n ? `${capitalizeFirstLetter(\n series.seriesName.replace('thresholdLine-', ''),\n )} threshold`\n : series.seriesName\n }\n trailingElement={valueFormatter(value)}\n indentSquareColor={series.color}\n notifications={notifications}\n />\n );\n })}\n </span>,\n )}`;\n },\n },\n dataZoom,\n toolbox: mergeToolbox(toolboxOptions),\n };\n\n // Update chart with initial option\n chart?.setOption(option, settings);\n\n // Get option returns the current option of the chart.\n // This is slightly different than the option we gave as an argument.\n // Because we use useMemo in other areas we want to get this set first,\n // this is why we are setting then getting then returning. If we did this in\n // a useEffect it would run after the other useMemos which is not what we want.\n // This is purely for order of operations.\n const chartOption = chart?.getOption();\n\n return chartOption;\n }, [\n thresholdLines,\n propsSeries,\n dataset,\n xAxis,\n yAxis,\n userOption,\n hasCategoryXAxis,\n hasSliderZoom,\n series,\n dataZoom,\n toolboxOptions,\n settings,\n ]);\n\n useEffect(() => {\n // Initialize chart\n let chart: ECharts | undefined;\n if (chartEchartRef.current !== null) {\n registerTheme('ndl-light', ndlEchartsTheme('light', palette));\n registerTheme('ndl-dark', ndlEchartsTheme('dark', palette));\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (currentChart) {\n chart = currentChart;\n } else {\n const echartsTheme = theme === 'light' ? 'ndl-light' : 'ndl-dark';\n chart = init(chartEchartRef.current, echartsTheme, {\n renderer: 'svg',\n });\n }\n }\n\n if (callbacks?.onZoom) {\n chart?.on('datazoom', () => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const currentChart = getInstanceByDom(chartEchartRef.current);\n if (!currentChart) {\n return;\n }\n\n const option = currentChart.getOption();\n if (!option || !option.dataZoom) {\n return;\n }\n\n const dataZoom = Array.isArray(option.dataZoom)\n ? option.dataZoom[0]\n : option.dataZoom;\n const { startValue, endValue } = dataZoom as {\n startValue: number;\n endValue: number;\n };\n\n callbacks?.onZoom?.({ endValue, startValue });\n });\n }\n\n // Add chart resize listener\n // ResizeObserver is leading to a bit janky UX\n function resizeChart() {\n // TODO: We need to revisit this. Right now using grid containLabel seems to work.\n // We still need to visit this for overflowing of the x-axis labels.\n // const calculateGridLeft = () => {\n // const textElements = chartEchartRef.current?.querySelectorAll('text');\n // const filteredTextElements = Array.from(textElements || []).filter(\n // (element) => element.getAttribute('text-anchor') === 'end',\n // );\n // let maxWidth = 0;\n // filteredTextElements.forEach((element) => {\n // const bbox = element.getBBox();\n // maxWidth = Math.max(maxWidth, bbox.width);\n // });\n // const tickLength = 5;\n // const tickPadding = 3;\n // return maxWidth + tickLength + tickPadding;\n // };\n //\n // // Example of dynamically setting the grid's left\n // const gridLeft = calculateGridLeft();\n // chart?.setOption({\n // grid: {\n // left: gridLeft,\n // },\n // });\n\n // We want to fit the chart to the charts container.\n const chartContainerHeight = chartRef.current?.clientHeight;\n const chartContainerWidth = chartRef.current?.clientWidth;\n // Need to take legends height into consideration, otherwise it will overflow the parent.\n const chartLegendHeight = chartLegendRef?.current?.clientHeight || 0;\n const height = chartContainerHeight\n ? chartContainerHeight - chartLegendHeight\n : undefined;\n chart?.resize({\n height,\n width: chartContainerWidth,\n });\n }\n window.addEventListener('resize', resizeChart);\n requestAnimationFrame(() => {\n resizeChart();\n setIsWaitingForFirstResize(false);\n });\n\n // Add chart zoom listeners\n const handleMouseMove = () => {\n // I do not like this at all: https://github.com/apache/echarts/issues/19819\n // echarts updates the svgs on every mouse movement so we need to do this.\n chart?.getZr().setCursorStyle('default');\n };\n // We cannot use chart.getZr().on('mousemove', handleMouseMove)\n // This is because it doesn't respect our callbacks. It will\n // always run echarts code last instead of our callback.\n const chartChild = chartEchartRef.current?.children[0] as HTMLElement;\n if (!isChartZoomDisabled) {\n chartChild.addEventListener('mousemove', handleMouseMove);\n }\n\n const handleMouseDown = (params: { event: MouseEvent }) => {\n const event = params.event;\n const amountOfMouseClicks = event.detail;\n const isDoubleClick = amountOfMouseClicks === 2;\n if (isDoubleClick) {\n // Reset zooming.\n if (chart === undefined) {\n return;\n }\n chart?.dispatchAction({\n end: 100,\n start: 0,\n type: 'dataZoom',\n });\n if (callbacks?.onZoom) {\n callbacks?.onZoom?.({ endValue: 100, startValue: 0 });\n }\n }\n };\n if (!isChartZoomDisabled) {\n chart?.getZr().on('mousedown', handleMouseDown);\n }\n\n // Return cleanup function\n const chartRefCurrentElement = chartEchartRef.current;\n const element = chartRefCurrentElement?.children[0];\n return () => {\n window.removeEventListener('resize', resizeChart);\n\n element?.removeEventListener('mousemove', handleMouseMove);\n\n // Remove chart zoom handlers\n if (chartRefCurrentElement) {\n const chart = getInstanceByDom(chartRefCurrentElement);\n chart?.getZr().off('mousedown', handleMouseDown);\n }\n };\n });\n\n useEffect(() => {\n if (chartEchartRef.current === null) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n\n if (isLoading === true || isWaitingForFirstResize) {\n chart?.showLoading({\n color: tokens.theme[theme].color.primary.bg.status,\n fontFamily: tokens.typography['label'].fontFamily,\n fontSize: tokens.typography['label'].fontSize,\n fontWeight: tokens.typography['label'].fontWeight,\n maskColor: `rgb( from ${tokens.theme[theme].color.neutral.text.inverse} r g b / 0.8)`,\n text: 'Loading',\n textColor: tokens.theme[theme].color.neutral.text.default,\n });\n } else {\n chart?.hideLoading();\n }\n }, [isLoading, isWaitingForFirstResize, theme]);\n\n const legendSeries = useMemo(() => {\n if (chartEchartRef.current === null || isWaitingForFirstResize) {\n return;\n }\n\n const chart = getInstanceByDom(chartEchartRef?.current);\n const optionSeries = (initialOption?.series as NeedleSeries) ?? [];\n const optionDataset = initialOption?.dataset;\n\n const legendSeries: {\n name: string;\n color: string;\n }[] = [];\n if (Array.isArray(optionSeries)) {\n optionSeries.forEach((currentSeries, index) => {\n if (currentSeries === null) {\n return;\n } else if (\n currentSeries.type === 'line' &&\n typeof currentSeries.name === 'string' &&\n currentSeries.name?.includes('thresholdLine')\n ) {\n return;\n } else if (currentSeries.type === 'pie') {\n const encodedItemName = currentSeries.encode?.itemName;\n let currentDataset = Array.isArray(optionDataset)\n ? optionDataset[0]\n : optionDataset;\n if (currentSeries.datasetId && Array.isArray(optionDataset)) {\n currentDataset = optionDataset.find(\n (ds) => ds.id === currentSeries.datasetId,\n );\n } else if (currentSeries.datasetIndex !== undefined) {\n currentDataset = Array.isArray(optionDataset)\n ? optionDataset[currentSeries.datasetIndex]\n : optionDataset;\n }\n const firstDatasetRow = Array.isArray(currentDataset?.source)\n ? currentDataset?.source[0]\n : undefined;\n if (!firstDatasetRow) {\n return;\n }\n\n if (Array.isArray(firstDatasetRow)) {\n const firstDatasetRowIndex = firstDatasetRow.findIndex(\n (item) => item === encodedItemName,\n );\n\n if (firstDatasetRowIndex === -1) {\n return;\n }\n\n const source = currentDataset?.source;\n if (!source) {\n return;\n }\n\n const sourceLength = Array.isArray(source) ? source.length : 0;\n const selected = legendSelectedRef.current;\n const isAllVisible = Object.values(selected).every((v) => v);\n\n for (let rowIndex = 1; rowIndex < sourceLength; rowIndex++) {\n const row = source[rowIndex] as (string | number)[];\n const name = String(row[firstDatasetRowIndex]);\n const freshColor = chart?.getVisual(\n { dataIndexInside: rowIndex - 1, seriesIndex: index },\n 'color',\n );\n\n // Only trust getVisual colors when all items are visible.\n // When items are deselected, getVisual returns grayed-out\n // colors, so we use the cached color from when it was visible.\n if (isAllVisible && typeof freshColor === 'string') {\n legendColorCacheRef.current.set(name, freshColor);\n }\n\n const color =\n legendColorCacheRef.current.get(name) ??\n (typeof freshColor === 'string' ? freshColor : '#000000');\n\n legendSeries.push({ color, name });\n }\n } else {\n // TODO: handle dictionary\n }\n\n return;\n } else {\n const name = Array.isArray(optionSeries)\n ? optionSeries[index]?.name\n : undefined;\n\n if (name === undefined) {\n return null;\n }\n\n const color = chart?.getVisual({ seriesIndex: index }, 'color');\n legendSeries.push({\n color: typeof color === 'string' ? color : '#000000',\n name: String(name),\n });\n }\n });\n }\n return legendSeries.filter((currentSeries) => currentSeries !== null);\n }, [isWaitingForFirstResize, initialOption]);\n\n if (chartEchartRef.current !== null && !isChartZoomDisabled) {\n const chart = getInstanceByDom(chartEchartRef.current);\n if (chart) {\n // Needs to be re-set on every re-render.\n // Sets the selectable zoom area over the chart (not the slider).\n chart.dispatchAction({\n dataZoomSelectActive: true,\n key: 'dataZoomSelect',\n type: 'takeGlobalCursor',\n });\n }\n }\n\n return (\n <div ref={chartRef} className=\"ndl-chart\" style={style}>\n <div ref={chartEchartRef} />\n {legend?.show && !isWaitingForFirstResize && (\n <Legend\n ref={chartLegendRef}\n wrappingType={legend.wrappingType}\n series={legendSeries ?? []}\n chartRef={chartEchartRef}\n selectedRef={legendSelectedRef}\n />\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../src/charts/chart-types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n show?: boolean;\n wrappingType?: LegendProps['wrappingType'];\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /** Settings for how ECharts should update the chart. */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n x: number;\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n selected?: boolean;\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n series: {\n name: string;\n color: string;\n }[];\n chartRef: React.RefObject<HTMLDivElement | null>;\n /** Shared ref for legend selection state. Chart reads this when building\n * setOption so that legend filters survive re-renders. */\n selectedRef?: React.MutableRefObject<Record<string, boolean>>;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport interface LegendOverflowProps extends LegendProps {\n className?: string;\n selectedSeries: Record<string, boolean>;\n onSetAllVisible: () => void;\n onToggleLegendVisibility?: (\n name: string,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n allSeries: { name: string; color: string }[],\n ) => void;\n onLegendItemMouseEnter: (series: { name: string; color: string }[]) => void;\n onLegendItemMouseLeave: (series: { name: string; color: string }[]) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../../src/charts/chart-types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n type EChartsOption,\n type LineSeriesOption,\n type RegisteredSeriesOption,\n type SetOptionOpts,\n} from 'echarts';\n\nexport type HexColor = `#${string}`;\n\nexport type Condition =\n | 'greater'\n | 'greaterOrEqual'\n | 'less'\n | 'lessOrEqual'\n | 'equal'\n | 'notEqual';\n\nexport type Values<T> = T[keyof T];\nexport type SeriesOption = Values<RegisteredSeriesOption>;\n\nexport type EchartsSeries = SeriesOption | SeriesOption[];\n\ntype CustomCondition = (\n lineValue: unknown,\n thresholdLineValue: unknown,\n) => boolean;\n\nexport interface ThresholdLineSeriesOption<\n T extends NotificationType,\n> extends Omit<LineSeriesOption, 'type'> {\n type: 'thresholdLine';\n yAxis: number;\n xAxis: [number, number];\n notificationType: T;\n color?: string;\n condition?: Condition;\n customConditionText?: string;\n customCondition?: CustomCondition;\n}\n\n// Only one threshold line of each type is allowed.\nexport type NeedleSeries =\n | [\n ThresholdLineSeriesOption<'warning'>,\n ThresholdLineSeriesOption<'danger'>,\n ...SeriesOption[],\n ]\n | [ThresholdLineSeriesOption<'danger'>, ...SeriesOption[]]\n | [ThresholdLineSeriesOption<'warning'>, ...SeriesOption[]]\n | SeriesOption[];\n\nexport interface ChartProps {\n /** The dataset configuration for the chart. Can be a single dataset or an array of datasets. */\n dataset: EChartsOption['dataset'];\n /** The series configuration for the chart. Defines what data to display and how to display it. */\n series: NeedleSeries;\n /** X-axis configuration for the chart. */\n xAxis?: EChartsOption['xAxis'];\n /** Y-axis configuration for the chart. */\n yAxis?: EChartsOption['yAxis'];\n /** Legend configuration for the chart. */\n legend?: {\n show?: boolean;\n wrappingType?: LegendProps['wrappingType'];\n };\n /** Additional ECharts options to merge with the chart configuration. */\n option?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >;\n /** Custom CSS styles to apply to the chart container. */\n style?: React.CSSProperties;\n /** Settings for how ECharts should update the chart. */\n settings?: SetOptionOpts;\n /** Whether the chart is in a loading state. */\n isLoading?: boolean;\n /** Callback functions for chart interactions. */\n callbacks?: {\n onZoom?: (params: { startValue: number; endValue: number }) => void;\n };\n /** Data zoom configuration for the chart. */\n dataZoom?: EChartsOption['dataZoom'];\n /** Whether the zoom in the chart is disabled */\n isChartZoomDisabled?: boolean;\n /** Custom color palette that overrides the default categorical colors. */\n palette?: HexColor[];\n}\n\n/**\n * Chart tooltip\n */\n\nexport interface ChartTooltipProps {\n children: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n style?: React.CSSProperties;\n anchorPosition?: {\n x: number;\n y: number;\n };\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport type NotificationType = 'warning' | 'danger';\n\nexport type Notification = {\n leadingElement: React.ReactNode;\n trailingElement: React.ReactNode;\n notificationType: NotificationType;\n id: string;\n};\n\nexport type ChartTooltipContentProps = {\n leadingElement?: React.ReactNode;\n trailingElement?: React.ReactNode;\n indentSquareColor?: string;\n notifications?: Notification[];\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Legend\n */\nexport interface LegendItemProps {\n name: string;\n children: React.ReactNode;\n as?: 'button' | 'div';\n className?: string;\n color?: string;\n selected?: boolean;\n deSelected?: boolean;\n onLegendItemClick?: () => void;\n hasButtons?: boolean;\n onLegendItemMouseEnter?: () => void;\n onLegendItemMouseLeave?: () => void;\n ref?: React.Ref<HTMLButtonElement> & React.Ref<HTMLDivElement>;\n}\n\nexport type LegendProps = {\n wrappingType?: 'wrapping' | 'truncation' | 'overflow';\n series: {\n name: string;\n color: string;\n }[];\n chartRef: React.RefObject<HTMLDivElement | null>;\n /** Shared ref for legend selection state. Chart reads this when building\n * setOption so that legend filters survive re-renders. */\n selectedRef?: React.MutableRefObject<Record<string, boolean>>;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nexport interface LegendOverflowProps extends LegendProps {\n className?: string;\n selectedSeries: Record<string, boolean>;\n onSetAllVisible: () => void;\n onToggleLegendVisibility?: (\n name: string,\n isAllSeriesSelected: boolean,\n isOnlyVisible: boolean,\n allSeries: { name: string; color: string }[],\n ) => void;\n onLegendItemMouseEnter: (series: { name: string; color: string }[]) => void;\n onLegendItemMouseLeave: (series: { name: string; color: string }[]) => void;\n}\n"]}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
+
// oxlint-disable sort-keys
|
|
21
22
|
import { tokens } from '@neo4j-ndl/base';
|
|
22
23
|
const axisCommon = (theme) => ({
|
|
23
24
|
axisLabel: {
|
|
@@ -56,10 +57,10 @@ const axisCommon = (theme) => ({
|
|
|
56
57
|
},
|
|
57
58
|
},
|
|
58
59
|
});
|
|
59
|
-
export const ndlEchartsTheme = (theme) => {
|
|
60
|
+
export const ndlEchartsTheme = (theme, palette) => {
|
|
60
61
|
return {
|
|
61
62
|
darkMode: theme === 'dark',
|
|
62
|
-
color: Object.values(tokens.categorical),
|
|
63
|
+
color: palette !== null && palette !== void 0 ? palette : Object.values(tokens.categorical),
|
|
63
64
|
backgroundColor: 'transparent',
|
|
64
65
|
axisPointer: {
|
|
65
66
|
crossStyle: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ndl-echarts-theme.js","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2BAA2B;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACpD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU;QACtD,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ;KACnD;IACD,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;YACtD,KAAK,EAAE,CAAC;SACT;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC;QACT,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,KAAK,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F;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;aACrD;SACF;QACD,kBAAkB;QAClB,SAAS,EAAE,EAAE;QACb,kBAAkB;QAClB,QAAQ,EAAE,EAAE;QACZ,kBAAkB;QAClB,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC;QAC3B,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;QAC1B,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC;QAC/B,IAAI,EAAE;YACJ,MAAM,EAAE,QAAQ;SACjB;QACD,kBAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,KAAK,EAAE,EAAE;QACT,kBAAkB;QAClB,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n// oxlint-disable sort-keys\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type HexColor } from '../chart-types';\n\nconst axisCommon = (theme: 'light' | 'dark') => ({\n axisLabel: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n fontFamily: tokens.typography['body-small'].fontFamily,\n fontSize: tokens.typography['body-small'].fontSize,\n },\n axisLine: {\n lineStyle: {\n cap: 'square',\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 2,\n },\n },\n axisTick: {\n length: 8,\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n width: 1,\n },\n show: true,\n },\n minorSplitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n splitArea: {\n areaStyle: {\n color: [tokens.theme[theme].color.neutral.hover, 'transparent'],\n },\n },\n splitLine: {\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n },\n },\n});\n\nexport const ndlEchartsTheme = (\n theme: 'light' | 'dark',\n palette?: HexColor[],\n) => {\n return {\n darkMode: theme === 'dark',\n color: palette ?? Object.values(tokens.categorical),\n backgroundColor: 'transparent',\n\n axisPointer: {\n crossStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n label: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n },\n },\n // We use a custom legend so this does not affect anything\n legend: {},\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n // We are not using the echarts title so this does not affect anything\n title: {},\n toolbox: {},\n\n dataZoom: {\n backgroundColor: 'transparent',\n borderColor: tokens.theme[theme].color.neutral.border.weak,\n borderRadius: parseInt(tokens.borderRadius.sm.replace('px', '')),\n dataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg.default,\n opacity: 1,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.weak,\n opacity: 1,\n width: 1,\n },\n },\n emphasis: {\n handleLabel: {},\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1,\n },\n moveHandleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n },\n },\n fillerColor: `rgb( from ${tokens.theme[theme].color.neutral.hover} r g b / 0.1)`,\n handleIcon:\n 'M2 0.5h4s1.5 0 1.5 1.5v16s0 1.5 -1.5 1.5h-4s-1.5 0 -1.5 -1.5v-16s0 -1.5 1.5 -1.5',\n handleSize: '80%',\n handleStyle: {\n borderColor: tokens.theme[theme].color.neutral.border.strong,\n color: tokens.theme[theme].color.neutral.bg.weak,\n\n // borderRadius: 0, // Doesn't work\n },\n moveHandleSize: 6,\n moveHandleStyle: {\n backgroundColor: tokens.theme[theme].color.neutral.bg.strong,\n color: tokens.theme[theme].color.neutral.bg.strong,\n opacity: 1, // 0.3,\n },\n selectedDataBackground: {\n areaStyle: {\n color: tokens.theme[theme].color.neutral.bg['on-bg-weak'],\n opacity: 1,\n shadowBlur: 0,\n },\n lineStyle: {\n color: tokens.theme[theme].color.neutral.border.strong,\n opacity: 1,\n width: 1,\n },\n },\n textStyle: {\n color: tokens.theme[theme].color.neutral.text.weaker,\n },\n },\n // Not implemented\n visualMap: {},\n // Not implemented\n timeline: {},\n // Not implemented\n calendar: {},\n timeAxis: axisCommon(theme),\n logAxis: axisCommon(theme),\n valueAxis: axisCommon(theme),\n categoryAxis: axisCommon(theme),\n line: {\n symbol: 'circle',\n },\n // Not implemented\n graph: {},\n // Not implemented\n gauge: {},\n // Not implemented\n candlestick: {},\n };\n};\n"]}
|
|
@@ -23,8 +23,9 @@ import { tokens } from '@neo4j-ndl/base';
|
|
|
23
23
|
import { renderToString } from 'react-dom/server';
|
|
24
24
|
import { ChartTooltip } from './ChartTooltip';
|
|
25
25
|
import { defaultThresholdLineSeriesOption } from './defaults';
|
|
26
|
-
const
|
|
27
|
-
export const mergeSeries = (series, theme = 'light', userOption) => {
|
|
26
|
+
const defaultColors = Object.values(tokens.categorical);
|
|
27
|
+
export const mergeSeries = (series, theme = 'light', userOption, palette) => {
|
|
28
|
+
const colors = palette !== null && palette !== void 0 ? palette : defaultColors;
|
|
28
29
|
return series.map((option, index = 0) => {
|
|
29
30
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
30
31
|
if (option === undefined) {
|
|
@@ -32,7 +33,7 @@ export const mergeSeries = (series, theme = 'light', userOption) => {
|
|
|
32
33
|
}
|
|
33
34
|
const color = Array.isArray(option.color)
|
|
34
35
|
? option.color[index]
|
|
35
|
-
: ((_a = option.color) !== null && _a !== void 0 ? _a : colors[index]);
|
|
36
|
+
: ((_a = option.color) !== null && _a !== void 0 ? _a : colors[index % colors.length]);
|
|
36
37
|
if (option.type === 'thresholdLine') {
|
|
37
38
|
const { notificationType } = option;
|
|
38
39
|
// Needed to differentiate between normal lines and threshold lines
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAoB,EACpB,QAA0B,OAAO,EACjC,UAGC,EACc,EAAE;IACjB,OAAO,MAAM,CAAC,GAAG,CACf,CACE,MAGuC,EACvC,QAAgB,CAAC,EACH,EAAE;;QAChB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YACvC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAEpC,IA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AI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n type EchartsSeries,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\n\nconst colors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n): EchartsSeries => {\n return series.map(\n (\n option:\n | SeriesOption\n | ThresholdLineSeriesOption<'warning'>\n | ThresholdLineSeriesOption<'danger'>,\n index: number = 0,\n ): SeriesOption => {\n if (option === undefined) {\n return {};\n }\n\n const color = Array.isArray(option.color)\n ? option.color[index]\n : (option.color ?? colors[index]);\n\n if (option.type === 'thresholdLine') {\n const { notificationType } = option;\n // Needed to differentiate between normal lines and threshold lines\n // as we are unable to inject custom properties into echarts series lines.\n const thresholdLineName = `thresholdLine-${notificationType}`;\n return {\n symbolSize: 9,\n symbol: 'none',\n condition: defaultThresholdLineSeriesOption.condition,\n ...option,\n lineStyle: {\n width: 2,\n type: 'dashed',\n ...option.lineStyle,\n },\n name: thresholdLineName,\n type: 'line',\n data: [\n [option.xAxis[0], option.yAxis],\n [option.xAxis[1], option.yAxis],\n ],\n };\n }\n\n if (option.type === 'line') {\n const shadow = tokens.theme[theme].boxShadow.raised;\n const shadowParts = shadow.split(/ (?=\\d+px|rgba?\\()/);\n\n return {\n type: 'line',\n symbolSize: 9,\n color,\n symbol: 'none',\n ...option,\n lineStyle: {\n width: 2,\n type: 'solid' as const,\n ...option.lineStyle,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n shadowOffsetX: parseInt(shadowParts[0]),\n shadowOffsetY: parseInt(shadowParts[1]),\n shadowBlur: parseInt(shadowParts[2]),\n shadowColor: shadowParts[4],\n ...option.emphasis?.itemStyle,\n },\n label: { show: false },\n ...option.emphasis,\n },\n };\n }\n\n if (option.type === 'pie') {\n return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n },\n },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"user-option-utils.js","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;A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AAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,uBACE,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,CAAC,CAAC,CAAC,EACf,gBAAgB,EAAE,KAAK,IACpB,QAAQ,EACX;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAAiC,EACP,EAAE;;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,YAAY,CAAC,MAAM,CAAC,CACO,CAAC;IAChC,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,gCACN,UAAU,EAAE,KAAK,IACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,QAAQ,KAC7B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;oBACJ,+BAA+B;oBAC/B,yDAAyD;oBACzD,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,GAAG;iBACV,GACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { type EChartsOption, type SeriesOption } from 'echarts';\nimport { renderToString } from 'react-dom/server';\n\nimport {\n type EchartsSeries,\n type HexColor,\n type NeedleSeries,\n type ThresholdLineSeriesOption,\n} from './chart-types';\nimport { ChartTooltip } from './ChartTooltip';\nimport { defaultThresholdLineSeriesOption } from './defaults';\n\nconst defaultColors = Object.values(tokens.categorical);\n\nexport const mergeSeries = (\n series: NeedleSeries,\n theme: 'light' | 'dark' = 'light',\n userOption?: Omit<\n EChartsOption,\n 'series' | 'dataset' | 'legend' | 'xAxis' | 'yAxis'\n >,\n 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 return {\n animationDuration: 600,\n animationType: 'scale',\n selectedMode: 'single',\n ...option,\n // Blur opacity is set to 1 to prevent other slices from\n // being opacitated when hovering a slice where the emphasis is enabled (used for scale effect)\n blur: {\n itemStyle: {\n opacity: 1,\n ...option.blur?.itemStyle,\n },\n label: {\n opacity: 1,\n ...option.blur?.label,\n },\n ...option.blur,\n },\n // Emphasis is enabled and used to apply the scale effect when hovering the pie chart slices.\n emphasis: {\n disabled: false,\n focus: 'self',\n scale: true,\n scaleSize: 5,\n ...option.emphasis,\n },\n itemStyle: {\n borderColor: tokens.theme[theme].color.neutral.bg.weak,\n borderWidth: 1,\n ...option.itemStyle,\n },\n label: {\n formatter: '{d}%',\n backgroundColor: 'transparent',\n color: tokens.theme[theme].color.neutral.text.weak,\n ...option.label,\n },\n labelLine: {\n length: 5,\n show: true,\n ...option.labelLine,\n },\n tooltip: {\n trigger: 'item',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={\n firstParam?.value[0] ?? firstParam.seriesName\n }\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n if (option.type === 'bar') {\n return {\n barMaxWidth: 16,\n ...option,\n blur: {\n itemStyle: {\n opacity: 0.3,\n ...option.blur?.itemStyle,\n },\n ...option.blur,\n },\n emphasis: {\n disabled: true,\n focus: 'series',\n ...option.emphasis,\n },\n itemStyle: {\n color,\n borderWidth: 20,\n ...option.itemStyle,\n },\n markLine: {\n emphasis: {\n disabled: true,\n lineStyle: {\n width: 20,\n ...option.markLine?.emphasis?.lineStyle,\n },\n ...option.markLine?.emphasis,\n },\n lineStyle: {\n width: 20,\n ...option.markLine?.lineStyle,\n },\n },\n tooltip: {\n trigger: 'axis',\n confine: true,\n // Reset the default tooltip css styling\n padding: 0,\n borderRadius: 0,\n borderWidth: 0,\n extraCssText: 'box-shadow: none; background-color: transparent;',\n formatter: function (params: unknown) {\n const paramsArray = Array.isArray(params) ? params : [params];\n const firstParam = paramsArray[0];\n let valueFormatter = (value: unknown) => `${value}`;\n if (\n typeof userOption?.tooltip === 'object' &&\n userOption.tooltip !== null &&\n 'valueFormatter' in userOption.tooltip\n ) {\n valueFormatter = userOption.tooltip.valueFormatter as (\n value: unknown,\n ) => string;\n }\n return `${renderToString(\n <span className=\"ndl-charts-chart-tooltip\">\n <ChartTooltip.Title>{firstParam.name}</ChartTooltip.Title>\n <ChartTooltip.Content\n key={firstParam?.value[0] ?? firstParam.seriesName}\n leadingElement={firstParam.seriesName}\n trailingElement={valueFormatter(\n Array.isArray(firstParam.value)\n ? firstParam.value[1]\n : firstParam.value,\n )}\n indentSquareColor={firstParam.color}\n />\n </span>,\n )}`;\n },\n ...option.tooltip,\n },\n };\n }\n\n return option;\n },\n );\n};\n\nexport const mergeXAxis = (\n xAxis: EChartsOption['xAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['xAxis'] => {\n if (xAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(xAxis)) {\n return xAxis.map((x) => mergeXAxis(x, theme)) as EChartsOption['xAxis'];\n }\n\n const baseXAxis: typeof xAxis = {\n ...xAxis,\n splitLine: { show: false, ...xAxis?.splitLine },\n axisLine: {\n lineStyle: {\n ...xAxis?.axisLine?.lineStyle,\n },\n ...xAxis?.axisLine,\n },\n axisTick: {\n ...xAxis?.axisTick,\n lineStyle: {\n ...xAxis?.axisTick?.lineStyle,\n },\n show: true,\n ...xAxis?.axisTick,\n },\n axisLabel: {\n margin: 16,\n formatter: {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}',\n day: '{dd} {MMM}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n // @ts-expect-error the type is not correct none is used when no other format works.\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}',\n },\n overflow: 'truncate',\n ...xAxis?.axisLabel,\n },\n };\n\n if (xAxis.type === 'time') {\n const timeXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseXAxis.axisLabel,\n },\n };\n\n return timeXAxis;\n }\n\n if (xAxis.type === 'value' || xAxis.type === 'log') {\n const valueXAxis: typeof baseXAxis = {\n ...baseXAxis,\n };\n\n return valueXAxis;\n }\n\n if (xAxis.type === 'category') {\n const categoryXAxis: typeof baseXAxis = {\n ...baseXAxis,\n axisTick: {\n alignWithLabel: true,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisTick),\n },\n axisLabel: {\n width: 80,\n ...(Array.isArray(baseXAxis) ? {} : baseXAxis?.axisLabel),\n },\n };\n return categoryXAxis;\n }\n\n return baseXAxis;\n};\n\nexport const mergeYAxis = (\n yAxis: EChartsOption['yAxis'],\n theme: 'light' | 'dark' = 'light',\n): EChartsOption['yAxis'] => {\n if (yAxis === undefined) {\n return [];\n }\n\n if (Array.isArray(yAxis)) {\n return yAxis.map((y) => mergeYAxis(y, theme)) as EChartsOption['yAxis'];\n }\n\n const baseYAxis: typeof yAxis = {\n ...yAxis,\n axisLine: {\n ...yAxis?.axisLine,\n lineStyle: {\n ...yAxis?.axisLine?.lineStyle,\n },\n show: true,\n },\n axisTick: {\n show: false,\n ...yAxis?.axisTick,\n lineStyle: {\n width: 1,\n ...yAxis?.axisTick?.lineStyle,\n },\n },\n axisLabel: {\n margin: 8,\n overflow: 'truncate',\n ...yAxis?.axisLabel,\n },\n splitLine: { show: true, ...yAxis?.splitLine },\n };\n\n if (yAxis.type === 'time') {\n const timeYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return timeYAxis;\n }\n\n if (yAxis.type === 'value' || yAxis.type === 'log') {\n const valueYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n hideOverlap: true,\n ...baseYAxis.axisLabel,\n },\n splitLine: { show: false, ...baseYAxis?.splitLine },\n };\n\n return valueYAxis;\n }\n\n if (yAxis.type === 'category') {\n const categoryYAxis: typeof baseYAxis = {\n ...baseYAxis,\n axisLabel: {\n width: 100,\n ...(Array.isArray(baseYAxis) ? {} : baseYAxis?.axisLabel),\n },\n };\n\n return categoryYAxis;\n }\n\n return baseYAxis;\n};\n\nexport const mergeDataZoom = (\n dataZoom: EChartsOption['dataZoom'],\n): EChartsOption['dataZoom'] => {\n if (Array.isArray(dataZoom)) {\n return dataZoom.map((option) =>\n mergeDataZoom(option),\n ) as EChartsOption['dataZoom'];\n }\n\n const isSlider = dataZoom?.type === 'slider';\n const isInside = dataZoom?.type === 'inside';\n\n if (isSlider) {\n return {\n bottom: 10,\n height: 28,\n left: 50,\n right: 50,\n show: true,\n type: 'slider',\n ...dataZoom,\n };\n } else if (isInside) {\n return {\n filterMode: 'none',\n xAxisIndex: [0],\n zoomOnMouseWheel: false,\n ...dataZoom,\n };\n }\n\n return dataZoom;\n};\n\nexport const mergeToolbox = (\n toolbox: EChartsOption['toolbox'],\n): EChartsOption['toolbox'] => {\n if (Array.isArray(toolbox)) {\n return toolbox.map((option) =>\n mergeToolbox(option),\n ) as EChartsOption['toolbox'];\n }\n\n return {\n feature: {\n dataZoom: {\n yAxisIndex: false,\n ...toolbox?.feature?.dataZoom,\n show: true,\n icon: {\n // This hack removes the icons.\n // Due to: https://github.com/apache/echarts/issues/10274\n back: '-',\n zoom: '-',\n },\n },\n },\n };\n};\n"]}
|
|
@@ -33,5 +33,5 @@ import { type ChartProps } from './chart-types';
|
|
|
33
33
|
* </div>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export declare function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis, series: propsSeries, style, settings, isLoading, isChartZoomDisabled, legend, callbacks, }: ChartProps): React.JSX.Element;
|
|
36
|
+
export declare function Chart({ dataset, option: userOption, xAxis: propXAxis, yAxis: propYAxis, series: propsSeries, style, settings, isLoading, isChartZoomDisabled, legend, callbacks, palette, }: ChartProps): React.JSX.Element;
|
|
37
37
|
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgBH,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,eAAe,CAAC;AAiFvB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,EACnB,KAAK,EACL,QAIC,EACD,SAAS,EACT,mBAA2B,EAC3B,MAAM,EACN,SAAS,
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgBH,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,eAAe,CAAC;AAiFvB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,EACnB,KAAK,EACL,QAIC,EACD,SAAS,EACT,mBAA2B,EAC3B,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAyhBhC"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { type EChartsOption, type LineSeriesOption, type RegisteredSeriesOption, type SetOptionOpts } from 'echarts';
|
|
22
|
+
export type HexColor = `#${string}`;
|
|
22
23
|
export type Condition = 'greater' | 'greaterOrEqual' | 'less' | 'lessOrEqual' | 'equal' | 'notEqual';
|
|
23
24
|
export type Values<T> = T[keyof T];
|
|
24
25
|
export type SeriesOption = Values<RegisteredSeriesOption>;
|
|
@@ -72,6 +73,8 @@ export interface ChartProps {
|
|
|
72
73
|
dataZoom?: EChartsOption['dataZoom'];
|
|
73
74
|
/** Whether the zoom in the chart is disabled */
|
|
74
75
|
isChartZoomDisabled?: boolean;
|
|
76
|
+
/** Custom color palette that overrides the default categorical colors. */
|
|
77
|
+
palette?: HexColor[];
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
77
80
|
* Chart tooltip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-types.d.ts","sourceRoot":"","sources":["../../../src/charts/chart-types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,gBAAgB,GAChB,MAAM,GACN,a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C;IACJ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjD;+DAC2D;IAC3D,WAAW,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,wBAAwB,CAAC,EAAE,CACzB,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,OAAO,EAC5B,aAAa,EAAE,OAAO,EACtB,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,KACzC,IAAI,CAAC;IACV,sBAAsB,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,IAAI,CAAC;IAC5E,sBAAsB,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,IAAI,CAAC;CAC7E"}
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
import { type HexColor } from '../chart-types';
|
|
23
|
+
export declare const ndlEchartsTheme: (theme: "light" | "dark", palette?: HexColor[]) => {
|
|
23
24
|
darkMode: boolean;
|
|
24
25
|
color: string[];
|
|
25
26
|
backgroundColor: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndl-echarts-theme.d.ts","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ndl-echarts-theme.d.ts","sourceRoot":"","sources":["../../../../src/charts/themes/ndl-echarts-theme.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAwC/C,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,GAAG,MAAM,EACvB,UAAU,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GrB,CAAC"}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { type EChartsOption } from 'echarts';
|
|
22
|
-
import { type EchartsSeries, type NeedleSeries } from './chart-types';
|
|
23
|
-
export declare const mergeSeries: (series: NeedleSeries, theme?: "light" | "dark", userOption?: Omit<EChartsOption, "series" | "dataset" | "legend" | "xAxis" | "yAxis"
|
|
22
|
+
import { type EchartsSeries, type HexColor, type NeedleSeries } from './chart-types';
|
|
23
|
+
export declare const mergeSeries: (series: NeedleSeries, theme?: "light" | "dark", userOption?: Omit<EChartsOption, "series" | "dataset" | "legend" | "xAxis" | "yAxis">, palette?: HexColor[]) => EchartsSeries;
|
|
24
24
|
export declare const mergeXAxis: (xAxis: EChartsOption["xAxis"], theme?: "light" | "dark") => EChartsOption["xAxis"];
|
|
25
25
|
export declare const mergeYAxis: (yAxis: EChartsOption["yAxis"], theme?: "light" | "dark") => EChartsOption["yAxis"];
|
|
26
26
|
export declare const mergeDataZoom: (dataZoom: EChartsOption["dataZoom"]) => EChartsOption["dataZoom"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-option-utils.d.ts","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,SAAS,CAAC;AAGhE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,WAAW,GACtB,QAAQ,YAAY,EACpB,QAAO,OAAO,GAAG,MAAgB,EACjC,aAAa,IAAI,CACf,aAAa,EACb,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CACpD,
|
|
1
|
+
{"version":3,"file":"user-option-utils.d.ts","sourceRoot":"","sources":["../../../src/charts/user-option-utils.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,SAAS,CAAC;AAGhE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,WAAW,GACtB,QAAQ,YAAY,EACpB,QAAO,OAAO,GAAG,MAAgB,EACjC,aAAa,IAAI,CACf,aAAa,EACb,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CACpD,EACD,UAAU,QAAQ,EAAE,KACnB,aAkPF,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAO,OAAO,GAAG,MAAgB,KAChC,aAAa,CAAC,OAAO,CAgFvB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B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