@neo4j-ndl/react-charts 1.0.114 → 1.0.116
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 +23 -9
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/Legend.js +20 -3
- package/lib/cjs/charts/Legend.js.map +1 -1
- package/lib/cjs/charts/chart-types.js.map +1 -1
- package/lib/cjs/charts/tests/PieChartWithRerender.js +46 -0
- package/lib/cjs/charts/tests/PieChartWithRerender.js.map +1 -0
- package/lib/cjs/charts/tests/chart-test-utils.js +22 -16
- package/lib/cjs/charts/tests/chart-test-utils.js.map +1 -1
- package/lib/esm/charts/Chart.js +23 -9
- package/lib/esm/charts/Chart.js.map +1 -1
- package/lib/esm/charts/Legend.js +20 -3
- package/lib/esm/charts/Legend.js.map +1 -1
- package/lib/esm/charts/chart-types.js.map +1 -1
- package/lib/esm/charts/tests/PieChartWithRerender.js +43 -0
- package/lib/esm/charts/tests/PieChartWithRerender.js.map +1 -0
- package/lib/esm/charts/tests/chart-test-utils.js +20 -15
- package/lib/esm/charts/tests/chart-test-utils.js.map +1 -1
- package/lib/types/charts/Chart.d.ts.map +1 -1
- package/lib/types/charts/Legend.d.ts +1 -1
- package/lib/types/charts/Legend.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/tests/PieChartWithRerender.d.ts +29 -0
- package/lib/types/charts/tests/PieChartWithRerender.d.ts.map +1 -0
- package/lib/types/charts/tests/chart-test-utils.d.ts +11 -10
- package/lib/types/charts/tests/chart-test-utils.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.js","sourceRoot":"","sources":["../../../src/charts/Legend.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA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AC,kBAAkB,CAAC,EAE5C,iBAAiB,EAAE,GAAG,EAAE;gCACtB,MAAM,oBAAoB,GACxB,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;gCAEvD,MAAM,0BAA0B,GAC9B,oBAAoB,KAAK,kBAAkB,CAAC,MAAM;oCAClD,kBAAkB,CAAC,KAAK,CACtB,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,cAAc,CAAC,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAA,EAAA,CAC1C,CAAC;gCAEJ,IAAI,0BAA0B,EAAE,CAAC;oCAC/B,eAAe,EAAE,CAAC;oCAClB,OAAO;gCACT,CAAC;gCAED,kBAAkB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oCACzC,MAAM,mBAAmB,GACvB,oBAAoB,KAAK,MAAM,CAAC,MAAM,IAAI,KAAK,KAAK,CAAC,CAAC;oCAExD,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CACtB,IAAI,CAAC,IAAI,EACT,mBAAmB,EACnB,KAAK,EACL,MAAM,CACP,CAAC;gCACJ,CAAC,CAAC,CAAC;4BACL,CAAC,aAEA,kBAAkB,CAAC,MAAM,aACf,GACG,EAClB,KAAC,OAAO,CAAC,OAAO,cACb,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAChC,sBAAoB,IAAI,CAAC,IAAI,IAArB,IAAI,CAAC,IAAI,CAAiB,CACnC,CAAC,GACc,IACV,CACX,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n ConditionalWrap,\n Tooltip,\n Typography,\n useResizeObserver,\n} from '@neo4j-ndl/react';\nimport { CheckIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { type EChartsType, getInstanceByDom } from 'echarts';\nimport type React from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n type LegendItemProps,\n type LegendOverflowProps,\n type LegendProps,\n} from './chart-types';\nimport {\n getComputedElementWidth,\n highlightOrDownplaySeries,\n isThresholdLine,\n resetAllSeriesHighlight,\n useLegendVisibility,\n} from './legend-utils';\nimport { type CommonProps } from './types';\n\nconst LegendItem = function LegendItemComponent({\n children,\n as,\n className,\n name,\n selected,\n deSelected,\n onLegendItemClick,\n color,\n hasButtons = true,\n ref,\n onLegendItemMouseEnter,\n onLegendItemMouseLeave,\n ...restProps\n}: LegendItemProps) {\n const Component = as ?? (hasButtons ? 'button' : 'div');\n\n const classes = classNames(\n 'ndl-chart-legend-item',\n {\n 'ndl-chart-legend-item-deselected': deSelected,\n 'ndl-chart-legend-item-selected': selected,\n },\n className,\n );\n\n // We don't want to display threshold lines in the legend\n if (isThresholdLine(name) ?? false) {\n return null;\n }\n\n return (\n <Component\n className={classes}\n ref={ref}\n data-labelname={name}\n title={name}\n onClick={hasButtons ? onLegendItemClick : undefined}\n onMouseEnter={onLegendItemMouseEnter}\n onMouseLeave={onLegendItemMouseLeave}\n {...restProps}\n >\n <span\n className=\"ndl-chart-legend-item-square\"\n style={\n {\n '--ndl-chart-legend-item-color': color,\n backgroundColor: deSelected === true ? 'transparent' : color,\n } as React.CSSProperties\n }\n >\n {selected === true && (\n <CheckIconOutline className=\"ndl-chart-legend-item-square-checkmark\" />\n )}\n </span>\n <Typography variant=\"body-medium\" className=\"ndl-chart-legend-item-text\">\n {children}\n </Typography>\n </Component>\n );\n};\n\nexport const Legend = function LegendComponent({\n className,\n wrappingType = 'wrapping',\n series,\n chartRef,\n ref,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', LegendProps>) {\n const [selectedSeries, setSelectedSeries] = useState<Record<string, boolean>>(\n Object.fromEntries(series.map((s) => [s.name ?? '', true])),\n );\n\n const highlightTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const downplayTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hoverTimeOut = 80;\n\n const highlightSeries = (\n seriesToUpdate: { name: string; color: string }[],\n ) => {\n // Clear the downplay timeout when a new item is hovered\n if (downplayTimeOut.current) {\n clearTimeout(downplayTimeOut.current);\n }\n\n // Delay the highlight to avoid flickering when quickly hovering the legend items\n highlightTimeOut.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartRef,\n series,\n selectedSeries,\n seriesToUpdate,\n 'highlight',\n );\n }, hoverTimeOut);\n };\n\n const downplaySeries = (\n seriesToUpdate: { name: string; color: string }[],\n ) => {\n // Clear the highlight timeout when the mouse is leaving the legend item\n if (highlightTimeOut.current) {\n clearTimeout(highlightTimeOut.current);\n }\n\n // Delay the downplay to avoid flickering when moving the highlight between legend items (no downplay needed in between)\n downplayTimeOut.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartRef,\n series,\n selectedSeries,\n seriesToUpdate,\n 'downplay',\n );\n }, hoverTimeOut);\n };\n\n useEffect(() => {\n setSelectedSeries(\n Object.fromEntries(series.map((s) => [s.name ?? '', true])),\n );\n\n if (chartRef.current === null) {\n return;\n }\n const chart = getInstanceByDom(chartRef.current);\n\n const eventTypes = [\n 'legendselectchanged',\n 'legendselectall',\n 'legendselected',\n 'legendunselected',\n ] as const;\n\n eventTypes.forEach((eventType) => {\n chart?.on(eventType, (params) => {\n if (\n typeof params === 'object' &&\n params !== null &&\n 'selected' in params &&\n params.selected !== null\n ) {\n const selected = params.selected ?? {};\n const filteredSelected = Object.fromEntries(\n Object.entries(selected).filter(\n ([key]) => !(isThresholdLine(key) ?? false),\n ),\n );\n\n // Reset the series highlight to avoid series to stay blurred on selection change\n if (eventType === 'legendselectchanged') {\n resetAllSeriesHighlight(chart as EChartsType);\n }\n\n setSelectedSeries(filteredSelected);\n }\n });\n });\n\n return () => {\n eventTypes.forEach((eventType) => {\n chart?.off(eventType);\n });\n };\n }, [chartRef, series]);\n\n const classes = classNames(\n `ndl-chart-legend`,\n {\n 'ndl-chart-legend-truncation': wrappingType === 'truncation',\n 'ndl-chart-legend-wrapping': wrappingType === 'wrapping',\n },\n className,\n );\n\n const { toggleLegendVisibility, setAllVisible } = useLegendVisibility(\n chartRef,\n selectedSeries,\n );\n\n return (\n <div\n ref={ref}\n className=\"ndl-chart-legend-container\"\n {...restProps}\n {...htmlAttributes}\n >\n {wrappingType === 'truncation' || wrappingType === 'wrapping' ? (\n <div className={classes}>\n {series.map((currentSeries, index) => {\n const hasMoreThanOneItem = series.length > 1;\n\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const isAllSeriesVisible = selectedSeriesLength === series.length;\n\n const color = currentSeries.color;\n\n const isDeselected =\n currentSeries.name === undefined\n ? false\n : !selectedSeries[currentSeries.name];\n\n return (\n <ConditionalWrap\n key={index}\n shouldWrap={wrappingType === 'truncation'}\n wrap={(children) => (\n <Tooltip type=\"simple\" key={index}>\n <Tooltip.Trigger hasButtonWrapper>\n {children}\n </Tooltip.Trigger>\n </Tooltip>\n )}\n >\n <LegendItem\n name={currentSeries.name}\n color={color}\n hasButtons={\n hasMoreThanOneItem && currentSeries.name !== undefined\n }\n onLegendItemMouseEnter={() => {\n !isDeselected && highlightSeries([currentSeries]);\n }}\n onLegendItemMouseLeave={() => {\n !isDeselected && downplaySeries([currentSeries]);\n }}\n onLegendItemClick={() => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length;\n\n const isOnlyVisible =\n selectedSeries[currentSeries.name ?? ''] &&\n selectedSeriesLength === 1;\n\n toggleLegendVisibility(\n currentSeries.name,\n isAllSeriesSelected,\n isOnlyVisible,\n );\n }}\n selected={\n !isAllSeriesVisible &&\n selectedSeries[currentSeries.name ?? '']\n }\n deSelected={isDeselected}\n >\n {currentSeries.name ?? `Series ${index}`}\n </LegendItem>\n </ConditionalWrap>\n );\n })}\n </div>\n ) : (\n <LegendOverflowType\n className={classes}\n selectedSeries={selectedSeries}\n wrappingType={wrappingType}\n chartRef={chartRef}\n series={series}\n onSetAllVisible={setAllVisible}\n onLegendItemMouseEnter={(seriesToUpdate) =>\n highlightSeries(seriesToUpdate)\n }\n onLegendItemMouseLeave={(seriesToUpdate) =>\n downplaySeries(seriesToUpdate)\n }\n onToggleLegendVisibility={(\n name,\n isAllSeriesSelected,\n isOnlyVisible,\n ) => {\n toggleLegendVisibility(name, isAllSeriesSelected, isOnlyVisible);\n }}\n />\n )}\n </div>\n );\n};\n\nconst LegendOverflowType = function LegendOverflow({\n className,\n series,\n onSetAllVisible,\n onToggleLegendVisibility,\n selectedSeries,\n onLegendItemMouseEnter,\n onLegendItemMouseLeave,\n}: LegendOverflowProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [nonOverflowItemsNames, setNonOverflowItemsNames] = useState<string[]>(\n series.map((s) => s.name),\n );\n\n useEffect(() => {\n setNonOverflowItemsNames(series.map((s) => s.name));\n }, [series]);\n\n const overflowItemsNames = series.filter(\n (item) => !nonOverflowItemsNames.includes(item.name),\n );\n\n const [width, setWidth] = useState(Infinity);\n useResizeObserver({\n // TODO: remove type cast. use-hooks.ts 3.1.1 has a type issue with the ref, it should be HTMLElement | null\n // https://github.com/juliencrn/usehooks-ts/pull/680\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n if (width < entry.width) {\n setNonOverflowItemsNames(series.map((s) => s.name));\n }\n setWidth(entry.width);\n },\n ref: containerRef as React.RefObject<HTMLElement>,\n });\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n let elements = Array.from(container.children);\n if (elements.length === 0 || series.length === 0) {\n return;\n }\n\n let totalWidth = 0;\n\n if (overflowItemsNames.length > 0) {\n const lastElementItem = elements[elements.length - 1];\n const lastItemWidth = getComputedElementWidth(lastElementItem);\n\n elements = elements.slice(0, elements.length - 1);\n totalWidth += lastItemWidth;\n }\n\n elements.forEach((element) => {\n const elementWidth = getComputedElementWidth(element);\n totalWidth += elementWidth;\n const textContent = element.textContent;\n if (!textContent) {\n return;\n }\n const itemName = element.getAttribute('data-labelname');\n if (itemName === null) {\n return;\n }\n if (totalWidth > width) {\n setNonOverflowItemsNames((oldNames) =>\n oldNames.filter((name) => name !== itemName),\n );\n }\n });\n }, [overflowItemsNames.length, series.length, width]);\n\n const classes = classNames(\n {\n 'ndl-chart-legend-calculating': width === Infinity,\n },\n className,\n );\n\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const hasMoreThanOneItem = nonOverflowItemsNames.length > 1;\n const isAllSeriesVisible = selectedSeriesLength === series.length;\n\n const isOverflowItemsDeselected = overflowItemsNames.every(\n (item) => !selectedSeries[item.name ?? ''],\n );\n\n return (\n <div className={classes} ref={containerRef}>\n {nonOverflowItemsNames.map((name) => {\n const currentSeries = series.find((s) => s.name === name);\n if (currentSeries === undefined) {\n return null;\n }\n\n const isDeselected =\n currentSeries.name === undefined\n ? false\n : !selectedSeries[currentSeries.name];\n\n return (\n <LegendItem\n key={name}\n name={name}\n color={currentSeries.color}\n onLegendItemMouseEnter={() =>\n !isDeselected && onLegendItemMouseEnter([currentSeries])\n }\n onLegendItemMouseLeave={() =>\n !isDeselected && onLegendItemMouseLeave([currentSeries])\n }\n onLegendItemClick={() => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length;\n\n const isOnlyVisible =\n selectedSeries[name ?? ''] && selectedSeriesLength === 1;\n\n onToggleLegendVisibility?.(\n name,\n isAllSeriesSelected,\n isOnlyVisible,\n series,\n );\n }}\n hasButtons={hasMoreThanOneItem}\n selected={\n !isAllSeriesVisible && selectedSeries[currentSeries.name ?? '']\n }\n deSelected={isDeselected}\n >\n {name}\n </LegendItem>\n );\n })}\n\n {overflowItemsNames.length > 0 && (\n <Tooltip type=\"simple\">\n <Tooltip.Trigger hasButtonWrapper>\n <LegendItem\n name=\"ndl-overflow-items\"\n color={tokens.palette.neutral[30]}\n selected={\n !isAllSeriesVisible &&\n overflowItemsNames.every(\n (item) => selectedSeries[item.name ?? ''],\n )\n }\n deSelected={isOverflowItemsDeselected}\n onLegendItemMouseEnter={() =>\n !isOverflowItemsDeselected &&\n onLegendItemMouseEnter(overflowItemsNames)\n }\n onLegendItemMouseLeave={() =>\n !isOverflowItemsDeselected &&\n onLegendItemMouseLeave(overflowItemsNames)\n }\n onLegendItemClick={() => {\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const isOnlyOverflowItemsVisible =\n selectedSeriesLength === overflowItemsNames.length &&\n overflowItemsNames.every(\n (item) => selectedSeries[item.name ?? ''],\n );\n\n if (isOnlyOverflowItemsVisible) {\n onSetAllVisible();\n return;\n }\n\n overflowItemsNames.forEach((item, index) => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length && index === 0;\n\n onToggleLegendVisibility?.(\n item.name,\n isAllSeriesSelected,\n false,\n series,\n );\n });\n }}\n >\n {overflowItemsNames.length} more\n </LegendItem>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {overflowItemsNames.map((item) => (\n <p key={item.name}>{item.name}</p>\n ))}\n </Tooltip.Content>\n </Tooltip>\n )}\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Legend.js","sourceRoot":"","sources":["../../../src/charts/Legend.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,eAAe,EACf,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,OAAO,cACb,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAChC,sBAAoB,IAAI,CAAC,IAAI,IAArB,IAAI,CAAC,IAAI,CAAiB,CACnC,CAAC,GACc,IACV,CACX,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n ConditionalWrap,\n Tooltip,\n Typography,\n useResizeObserver,\n} from '@neo4j-ndl/react';\nimport { CheckIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { type EChartsType, getInstanceByDom } from 'echarts';\nimport type React from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n type LegendItemProps,\n type LegendOverflowProps,\n type LegendProps,\n} from './chart-types';\nimport {\n getComputedElementWidth,\n highlightOrDownplaySeries,\n isThresholdLine,\n resetAllSeriesHighlight,\n useLegendVisibility,\n} from './legend-utils';\nimport { type CommonProps } from './types';\n\nconst LegendItem = function LegendItemComponent({\n children,\n as,\n className,\n name,\n selected,\n deSelected,\n onLegendItemClick,\n color,\n hasButtons = true,\n ref,\n onLegendItemMouseEnter,\n onLegendItemMouseLeave,\n ...restProps\n}: LegendItemProps) {\n const Component = as ?? (hasButtons ? 'button' : 'div');\n\n const classes = classNames(\n 'ndl-chart-legend-item',\n {\n 'ndl-chart-legend-item-deselected': deSelected,\n 'ndl-chart-legend-item-selected': selected,\n },\n className,\n );\n\n // We don't want to display threshold lines in the legend\n if (isThresholdLine(name) ?? false) {\n return null;\n }\n\n return (\n <Component\n className={classes}\n ref={ref}\n data-labelname={name}\n title={name}\n onClick={hasButtons ? onLegendItemClick : undefined}\n onMouseEnter={onLegendItemMouseEnter}\n onMouseLeave={onLegendItemMouseLeave}\n {...restProps}\n >\n <span\n className=\"ndl-chart-legend-item-square\"\n style={\n {\n '--ndl-chart-legend-item-color': color,\n backgroundColor: deSelected === true ? 'transparent' : color,\n } as React.CSSProperties\n }\n >\n {selected === true && (\n <CheckIconOutline className=\"ndl-chart-legend-item-square-checkmark\" />\n )}\n </span>\n <Typography variant=\"body-medium\" className=\"ndl-chart-legend-item-text\">\n {children}\n </Typography>\n </Component>\n );\n};\n\nexport const Legend = function LegendComponent({\n className,\n wrappingType = 'wrapping',\n series,\n chartRef,\n selectedRef,\n ref,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', LegendProps>) {\n const initialSelected = Object.fromEntries(\n series.map((s) => [s.name ?? '', true]),\n );\n const [selectedSeries, setSelectedSeries] =\n useState<Record<string, boolean>>(initialSelected);\n\n // Keep the shared ref in sync so Chart can read the latest selection state\n // when building setOption. This is the single source of truth for legend filters.\n useEffect(() => {\n if (selectedRef) {\n selectedRef.current = selectedSeries;\n }\n }, [selectedRef, selectedSeries]);\n\n const highlightTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const downplayTimeOut = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hoverTimeOut = 80;\n\n const highlightSeries = (\n seriesToUpdate: { name: string; color: string }[],\n ) => {\n // Clear the downplay timeout when a new item is hovered\n if (downplayTimeOut.current) {\n clearTimeout(downplayTimeOut.current);\n }\n\n // Delay the highlight to avoid flickering when quickly hovering the legend items\n highlightTimeOut.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartRef,\n series,\n selectedSeries,\n seriesToUpdate,\n 'highlight',\n );\n }, hoverTimeOut);\n };\n\n const downplaySeries = (\n seriesToUpdate: { name: string; color: string }[],\n ) => {\n // Clear the highlight timeout when the mouse is leaving the legend item\n if (highlightTimeOut.current) {\n clearTimeout(highlightTimeOut.current);\n }\n\n // Delay the downplay to avoid flickering when moving the highlight between legend items (no downplay needed in between)\n downplayTimeOut.current = setTimeout(() => {\n highlightOrDownplaySeries(\n chartRef,\n series,\n selectedSeries,\n seriesToUpdate,\n 'downplay',\n );\n }, hoverTimeOut);\n };\n\n useEffect(() => {\n // Preserve existing legend selection state across re-renders.\n // Only new series default to visible (true); removed series are dropped.\n const prev = selectedRef?.current ?? {};\n const next: Record<string, boolean> = {};\n for (const s of series) {\n const name = s.name ?? '';\n next[name] = prev[name] ?? true;\n }\n setSelectedSeries(next);\n\n if (chartRef.current === null) {\n return;\n }\n const chart = getInstanceByDom(chartRef.current);\n\n const eventTypes = [\n 'legendselectchanged',\n 'legendselectall',\n 'legendselected',\n 'legendunselected',\n ] as const;\n\n eventTypes.forEach((eventType) => {\n chart?.on(eventType, (params) => {\n if (\n typeof params === 'object' &&\n params !== null &&\n 'selected' in params &&\n params.selected !== null\n ) {\n const selected = params.selected ?? {};\n const filteredSelected = Object.fromEntries(\n Object.entries(selected).filter(\n ([key]) => !(isThresholdLine(key) ?? false),\n ),\n );\n\n // Reset the series highlight to avoid series to stay blurred on selection change\n if (eventType === 'legendselectchanged') {\n resetAllSeriesHighlight(chart as EChartsType);\n }\n\n setSelectedSeries(filteredSelected);\n }\n });\n });\n\n return () => {\n eventTypes.forEach((eventType) => {\n chart?.off(eventType);\n });\n };\n }, [chartRef, series]);\n\n const classes = classNames(\n `ndl-chart-legend`,\n {\n 'ndl-chart-legend-truncation': wrappingType === 'truncation',\n 'ndl-chart-legend-wrapping': wrappingType === 'wrapping',\n },\n className,\n );\n\n const { toggleLegendVisibility, setAllVisible } = useLegendVisibility(\n chartRef,\n selectedSeries,\n );\n\n return (\n <div\n ref={ref}\n className=\"ndl-chart-legend-container\"\n {...restProps}\n {...htmlAttributes}\n >\n {wrappingType === 'truncation' || wrappingType === 'wrapping' ? (\n <div className={classes}>\n {series.map((currentSeries, index) => {\n const hasMoreThanOneItem = series.length > 1;\n\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const isAllSeriesVisible = selectedSeriesLength === series.length;\n\n const color = currentSeries.color;\n\n const isDeselected =\n currentSeries.name === undefined\n ? false\n : !selectedSeries[currentSeries.name];\n\n return (\n <ConditionalWrap\n key={index}\n shouldWrap={wrappingType === 'truncation'}\n wrap={(children) => (\n <Tooltip type=\"simple\" key={index}>\n <Tooltip.Trigger hasButtonWrapper>\n {children}\n </Tooltip.Trigger>\n </Tooltip>\n )}\n >\n <LegendItem\n name={currentSeries.name}\n color={color}\n hasButtons={\n hasMoreThanOneItem && currentSeries.name !== undefined\n }\n onLegendItemMouseEnter={() => {\n !isDeselected && highlightSeries([currentSeries]);\n }}\n onLegendItemMouseLeave={() => {\n !isDeselected && downplaySeries([currentSeries]);\n }}\n onLegendItemClick={() => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length;\n\n const isOnlyVisible =\n selectedSeries[currentSeries.name ?? ''] &&\n selectedSeriesLength === 1;\n\n toggleLegendVisibility(\n currentSeries.name,\n isAllSeriesSelected,\n isOnlyVisible,\n );\n }}\n selected={\n !isAllSeriesVisible &&\n selectedSeries[currentSeries.name ?? '']\n }\n deSelected={isDeselected}\n >\n {currentSeries.name ?? `Series ${index}`}\n </LegendItem>\n </ConditionalWrap>\n );\n })}\n </div>\n ) : (\n <LegendOverflowType\n className={classes}\n selectedSeries={selectedSeries}\n wrappingType={wrappingType}\n chartRef={chartRef}\n series={series}\n onSetAllVisible={setAllVisible}\n onLegendItemMouseEnter={(seriesToUpdate) =>\n highlightSeries(seriesToUpdate)\n }\n onLegendItemMouseLeave={(seriesToUpdate) =>\n downplaySeries(seriesToUpdate)\n }\n onToggleLegendVisibility={(\n name,\n isAllSeriesSelected,\n isOnlyVisible,\n ) => {\n toggleLegendVisibility(name, isAllSeriesSelected, isOnlyVisible);\n }}\n />\n )}\n </div>\n );\n};\n\nconst LegendOverflowType = function LegendOverflow({\n className,\n series,\n onSetAllVisible,\n onToggleLegendVisibility,\n selectedSeries,\n onLegendItemMouseEnter,\n onLegendItemMouseLeave,\n}: LegendOverflowProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [nonOverflowItemsNames, setNonOverflowItemsNames] = useState<string[]>(\n series.map((s) => s.name),\n );\n\n useEffect(() => {\n setNonOverflowItemsNames(series.map((s) => s.name));\n }, [series]);\n\n const overflowItemsNames = series.filter(\n (item) => !nonOverflowItemsNames.includes(item.name),\n );\n\n const [width, setWidth] = useState(Infinity);\n useResizeObserver({\n // TODO: remove type cast. use-hooks.ts 3.1.1 has a type issue with the ref, it should be HTMLElement | null\n // https://github.com/juliencrn/usehooks-ts/pull/680\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n if (width < entry.width) {\n setNonOverflowItemsNames(series.map((s) => s.name));\n }\n setWidth(entry.width);\n },\n ref: containerRef as React.RefObject<HTMLElement>,\n });\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n let elements = Array.from(container.children);\n if (elements.length === 0 || series.length === 0) {\n return;\n }\n\n let totalWidth = 0;\n\n if (overflowItemsNames.length > 0) {\n const lastElementItem = elements[elements.length - 1];\n const lastItemWidth = getComputedElementWidth(lastElementItem);\n\n elements = elements.slice(0, elements.length - 1);\n totalWidth += lastItemWidth;\n }\n\n elements.forEach((element) => {\n const elementWidth = getComputedElementWidth(element);\n totalWidth += elementWidth;\n const textContent = element.textContent;\n if (!textContent) {\n return;\n }\n const itemName = element.getAttribute('data-labelname');\n if (itemName === null) {\n return;\n }\n if (totalWidth > width) {\n setNonOverflowItemsNames((oldNames) =>\n oldNames.filter((name) => name !== itemName),\n );\n }\n });\n }, [overflowItemsNames.length, series.length, width]);\n\n const classes = classNames(\n {\n 'ndl-chart-legend-calculating': width === Infinity,\n },\n className,\n );\n\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const hasMoreThanOneItem = nonOverflowItemsNames.length > 1;\n const isAllSeriesVisible = selectedSeriesLength === series.length;\n\n const isOverflowItemsDeselected = overflowItemsNames.every(\n (item) => !selectedSeries[item.name ?? ''],\n );\n\n return (\n <div className={classes} ref={containerRef}>\n {nonOverflowItemsNames.map((name) => {\n const currentSeries = series.find((s) => s.name === name);\n if (currentSeries === undefined) {\n return null;\n }\n\n const isDeselected =\n currentSeries.name === undefined\n ? false\n : !selectedSeries[currentSeries.name];\n\n return (\n <LegendItem\n key={name}\n name={name}\n color={currentSeries.color}\n onLegendItemMouseEnter={() =>\n !isDeselected && onLegendItemMouseEnter([currentSeries])\n }\n onLegendItemMouseLeave={() =>\n !isDeselected && onLegendItemMouseLeave([currentSeries])\n }\n onLegendItemClick={() => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length;\n\n const isOnlyVisible =\n selectedSeries[name ?? ''] && selectedSeriesLength === 1;\n\n onToggleLegendVisibility?.(\n name,\n isAllSeriesSelected,\n isOnlyVisible,\n series,\n );\n }}\n hasButtons={hasMoreThanOneItem}\n selected={\n !isAllSeriesVisible && selectedSeries[currentSeries.name ?? '']\n }\n deSelected={isDeselected}\n >\n {name}\n </LegendItem>\n );\n })}\n\n {overflowItemsNames.length > 0 && (\n <Tooltip type=\"simple\">\n <Tooltip.Trigger hasButtonWrapper>\n <LegendItem\n name=\"ndl-overflow-items\"\n color={tokens.palette.neutral[30]}\n selected={\n !isAllSeriesVisible &&\n overflowItemsNames.every(\n (item) => selectedSeries[item.name ?? ''],\n )\n }\n deSelected={isOverflowItemsDeselected}\n onLegendItemMouseEnter={() =>\n !isOverflowItemsDeselected &&\n onLegendItemMouseEnter(overflowItemsNames)\n }\n onLegendItemMouseLeave={() =>\n !isOverflowItemsDeselected &&\n onLegendItemMouseLeave(overflowItemsNames)\n }\n onLegendItemClick={() => {\n const selectedSeriesLength =\n Object.values(selectedSeries).filter(Boolean).length;\n\n const isOnlyOverflowItemsVisible =\n selectedSeriesLength === overflowItemsNames.length &&\n overflowItemsNames.every(\n (item) => selectedSeries[item.name ?? ''],\n );\n\n if (isOnlyOverflowItemsVisible) {\n onSetAllVisible();\n return;\n }\n\n overflowItemsNames.forEach((item, index) => {\n const isAllSeriesSelected =\n selectedSeriesLength === series.length && index === 0;\n\n onToggleLegendVisibility?.(\n item.name,\n isAllSeriesSelected,\n false,\n series,\n );\n });\n }}\n >\n {overflowItemsNames.length} more\n </LegendItem>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {overflowItemsNames.map((item) => (\n <p key={item.name}>{item.name}</p>\n ))}\n </Tooltip.Content>\n </Tooltip>\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 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 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"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { Chart } from '@neo4j-ndl/react-charts';
|
|
23
|
+
import { useRef, useState } from 'react';
|
|
24
|
+
export function PieChartWithRerenderComponent({ dataset1, dataset2, datasetNewCategories, }) {
|
|
25
|
+
const [renderCount, setRenderCount] = useState(0);
|
|
26
|
+
const [shouldUseNewCategories, setShouldUseNewCategories] = useState(false);
|
|
27
|
+
const chartRenderCount = useRef(0);
|
|
28
|
+
chartRenderCount.current += 1;
|
|
29
|
+
const currentDataset = shouldUseNewCategories
|
|
30
|
+
? datasetNewCategories
|
|
31
|
+
: renderCount % 2 === 0
|
|
32
|
+
? dataset1
|
|
33
|
+
: dataset2;
|
|
34
|
+
return (_jsxs("div", { children: [_jsxs("div", { style: { display: 'flex', gap: '8px', marginBottom: '12px' }, children: [_jsx("button", { type: "button", "data-testid": "rerender-button", onClick: () => setRenderCount((c) => c + 1), children: "Re-render" }), _jsx("button", { type: "button", "data-testid": "switch-categories-button", onClick: () => setShouldUseNewCategories((v) => !v), children: "Switch categories" }), _jsx("span", { "data-testid": "render-count", children: chartRenderCount.current })] }), _jsx("div", { style: { height: '350px', width: '100%' }, children: _jsx(Chart, { legend: { show: true }, series: [
|
|
35
|
+
{
|
|
36
|
+
center: ['50%', '50%'],
|
|
37
|
+
encode: { itemName: 'product', value: '2015' },
|
|
38
|
+
radius: '90%',
|
|
39
|
+
type: 'pie',
|
|
40
|
+
},
|
|
41
|
+
], dataset: currentDataset }) })] }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=PieChartWithRerender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieChartWithRerender.js","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQzC,MAAM,UAAU,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACM;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACnC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAC;IAE9B,MAAM,cAAc,GAAG,sBAAsB;QAC3C,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,WAAW,GAAG,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,QAAQ,CAAC;IAEf,OAAO,CACL,0BACE,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAC/D,iBACE,IAAI,EAAC,QAAQ,iBACD,iBAAiB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,0BAGpC,EACT,iBACE,IAAI,EAAC,QAAQ,iBACD,0BAA0B,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,kCAG5C,EACT,8BAAkB,cAAc,YAAE,gBAAgB,CAAC,OAAO,GAAQ,IAC9D,EACN,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5C,KAAC,KAAK,IACJ,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EACtB,MAAM,EAAE;wBACN;4BACE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;4BACtB,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;4BAC9C,MAAM,EAAE,KAAK;4BACb,IAAI,EAAE,KAAK;yBACZ;qBACF,EACD,OAAO,EAAE,cAAc,GACvB,GACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport type { EChartsOption } from 'echarts';\nimport { useRef, useState } from 'react';\n\ntype PieChartWithRerenderProps = {\n dataset1: EChartsOption['dataset'];\n dataset2: EChartsOption['dataset'];\n datasetNewCategories: EChartsOption['dataset'];\n};\n\nexport function PieChartWithRerenderComponent({\n dataset1,\n dataset2,\n datasetNewCategories,\n}: PieChartWithRerenderProps) {\n const [renderCount, setRenderCount] = useState(0);\n const [shouldUseNewCategories, setShouldUseNewCategories] = useState(false);\n const chartRenderCount = useRef(0);\n chartRenderCount.current += 1;\n\n const currentDataset = shouldUseNewCategories\n ? datasetNewCategories\n : renderCount % 2 === 0\n ? dataset1\n : dataset2;\n\n return (\n <div>\n <div style={{ display: 'flex', gap: '8px', marginBottom: '12px' }}>\n <button\n type=\"button\"\n data-testid=\"rerender-button\"\n onClick={() => setRenderCount((c) => c + 1)}\n >\n Re-render\n </button>\n <button\n type=\"button\"\n data-testid=\"switch-categories-button\"\n onClick={() => setShouldUseNewCategories((v) => !v)}\n >\n Switch categories\n </button>\n <span data-testid=\"render-count\">{chartRenderCount.current}</span>\n </div>\n <div style={{ height: '350px', width: '100%' }}>\n <Chart\n legend={{ show: true }}\n series={[\n {\n center: ['50%', '50%'],\n encode: { itemName: 'product', value: '2015' },\n radius: '90%',\n type: 'pie',\n },\n ]}\n dataset={currentDataset}\n />\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -60,13 +60,19 @@ export const chartColorsAfterHighlighting = {
|
|
|
60
60
|
9: 'rgb(240,210,70)',
|
|
61
61
|
};
|
|
62
62
|
export const pieChartProps = (seriesName, value, rgbSeriesColor) => ({
|
|
63
|
+
dataset: [
|
|
64
|
+
{
|
|
65
|
+
source: [
|
|
66
|
+
['product', '2012'],
|
|
67
|
+
[seriesName, value],
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
63
71
|
legend: {
|
|
64
72
|
show: true,
|
|
65
73
|
},
|
|
66
74
|
series: [
|
|
67
75
|
{
|
|
68
|
-
type: 'pie',
|
|
69
|
-
radius: '90%',
|
|
70
76
|
center: ['50%', '50%'],
|
|
71
77
|
encode: {
|
|
72
78
|
itemName: 'product',
|
|
@@ -75,36 +81,30 @@ export const pieChartProps = (seriesName, value, rgbSeriesColor) => ({
|
|
|
75
81
|
itemStyle: {
|
|
76
82
|
color: rgbSeriesColor,
|
|
77
83
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
dataset: [
|
|
81
|
-
{
|
|
82
|
-
source: [
|
|
83
|
-
['product', '2012'],
|
|
84
|
-
[seriesName, value],
|
|
85
|
-
],
|
|
84
|
+
radius: '90%',
|
|
85
|
+
type: 'pie',
|
|
86
86
|
},
|
|
87
87
|
],
|
|
88
88
|
});
|
|
89
89
|
export const barChartProps = (seriesName, value, rgbSeriesColor) => ({
|
|
90
|
-
legend: {
|
|
91
|
-
show: true,
|
|
92
|
-
},
|
|
93
90
|
dataset: {
|
|
94
91
|
dimensions: ['Country', 'Sales'],
|
|
95
92
|
source: [['Finland', value]],
|
|
96
93
|
},
|
|
94
|
+
legend: {
|
|
95
|
+
show: true,
|
|
96
|
+
},
|
|
97
97
|
series: [
|
|
98
98
|
{
|
|
99
99
|
encode: {
|
|
100
100
|
x: 'Country',
|
|
101
101
|
y: 'Sales',
|
|
102
102
|
},
|
|
103
|
-
name: seriesName,
|
|
104
|
-
type: 'bar',
|
|
105
103
|
itemStyle: {
|
|
106
104
|
color: rgbSeriesColor,
|
|
107
105
|
},
|
|
106
|
+
name: seriesName,
|
|
107
|
+
type: 'bar',
|
|
108
108
|
},
|
|
109
109
|
],
|
|
110
110
|
xAxis: {
|
|
@@ -326,4 +326,9 @@ export const expectFormattedTooltipToBeVisible = (page, seriesName, value, rgbSe
|
|
|
326
326
|
const tooltip = page.getByText(`${seriesName}formatted ${value}`);
|
|
327
327
|
yield expect(tooltip).toBeVisible();
|
|
328
328
|
});
|
|
329
|
+
export const waitForAnimationEnd = (page, selector) => {
|
|
330
|
+
return page
|
|
331
|
+
.locator(selector)
|
|
332
|
+
.evaluate((element) => Promise.all(element.getAnimations().map((animation) => animation.finished)));
|
|
333
|
+
};
|
|
329
334
|
//# sourceMappingURL=chart-test-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAI3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;IACtC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE/C,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KAAK,EAAE,CAAC;IAC/D,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,IAAU,EACV,UAAkB,EAClB,KAAa,EACb,cAAsB,EACtB,EAAE;IACF,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEzD,MAAM,MAAM,CACV,IAAI;SACD,OAAO,CAAC,cAAc,cAAc,IAAI,CAAC;SACzC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,aAAa,IAAI,CAAC,CAAC,CACvD,CAAC,WAAW,EAAE,CAAC;IAChB,MAAM,IAAI;SACP,OAAO,CAAC,cAAc,cAAc,IAAI,CAAC;SACzC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,aAAa,IAAI,CAAC,CAAC;SACnD,KAAK,EAAE,CAAC;IACX,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,aAAa,KAAK,EAAE,CAAC,CAAC;IAClE,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACtC,CAAC,CAAA,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { expect } from '@playwright/experimental-ct-react';\nimport { type Page } from '@playwright/test';\nimport { type ComponentProps } from 'react';\n\nimport { ChartWrapperWithTooltipFormatter } from './ChartWrapperWithTooltipFormatter';\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nconst convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const chartColorsAfterHighlighting: Record<number, string> = {\n 1: 'rgb(93,207,216)',\n 10: 'rgb(210,126,49)',\n 11: 'rgb(78,151,121)',\n 12: 'rgb(190,255,117)',\n 2: 'rgb(84,80,223)',\n 3: 'rgb(242,152,62)',\n 4: 'rgb(221,75,155)',\n 5: 'rgb(156,154,255)',\n 6: 'rgb(132,244,136)',\n 7: 'rgb(69,140,249)',\n 8: 'rgb(113,69,188)',\n 9: 'rgb(240,210,70)',\n};\n\nexport const pieChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n legend: {\n show: true,\n },\n series: [\n {\n type: 'pie' as const,\n radius: '90%',\n center: ['50%', '50%'],\n encode: {\n itemName: 'product',\n value: '2012',\n },\n itemStyle: {\n color: rgbSeriesColor,\n },\n },\n ],\n dataset: [\n {\n source: [\n ['product', '2012'],\n [seriesName, value],\n ],\n },\n ],\n});\n\nexport const barChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n legend: {\n show: true,\n },\n dataset: {\n dimensions: ['Country', 'Sales'],\n source: [['Finland', value]],\n },\n series: [\n {\n encode: {\n x: 'Country',\n y: 'Sales',\n },\n name: seriesName,\n type: 'bar' as const,\n itemStyle: {\n color: rgbSeriesColor,\n },\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n});\n\nexport const multiSeriesChartProps = {\n dataset: {\n dimensions: ['day', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth'],\n source: [\n ['Monday', 20, 40, 60, 80, 100, 120],\n ['Tuesday', 30, 50, 70, 90, 110, 130],\n ['Wednesday', 25, 45, 65, 85, 105, 125],\n ['Thursday', 35, 55, 75, 95, 115, 135],\n ['Friday', 40, 60, 80, 100, 120, 140],\n ],\n },\n legend: {\n show: true,\n wrappingType: 'wrapping' as const,\n },\n option: {},\n series: [\n {\n encode: { x: 'day', y: 'first' },\n name: 'First Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'second' },\n name: 'Second Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'third' },\n name: 'Third Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fourth' },\n name: 'Fourth Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fifth' },\n name: 'Fifth Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'sixth' },\n name: 'Sixth Series',\n type: 'line' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n};\n\nexport const multiSeriesChart = ({\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n}) => (\n <div style={{ height, width }} className=\"ndl-chart\">\n <Chart {...multiSeriesChartProps} {...chartProps} />\n </div>\n);\n\nexport const pieChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...pieChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg')).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nconst SELECTORS = {\n CHECKMARK: '.ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `[data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `[data-labelname=\"${name}\"].ndl-chart-legend-item-deselected`,\n} as const;\n\nconst getGraphPaletteColorFromSeriesIndex = (index: string): string => {\n const hexColor = tokens.categorical[index as keyof typeof tokens.categorical];\n if (!hexColor) {\n throw new Error(`Categorical palette index ${index} not found`);\n }\n\n return hexColor;\n};\n\n/**\n * Checks so a single series is not blurred.\n */\nexport const expectSingleSeriesNotToBeBlurred = async (\n page: Page,\n seriesName: string,\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n const seriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === seriesName) +\n 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[seriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n seriesIndex.toString(),\n );\n\n // More flexible color matching - try both with and without spaces\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n // Wait for the element to be attached to the DOM before checking its attributes\n await expect(pathLocator).toBeAttached({ timeout: 10000 });\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n};\n\n/**\n * Checks so that the seriesNamesToBeHighlighted are visible in the chart and that other series are blurred.\n */\nexport const expectLegendSeriesToBeHighlightedInChart = async (\n page: Page,\n seriesNamesToBeHighlighted: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n for (const name of seriesNamesToBeHighlighted) {\n const highlightedSeriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[highlightedSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n highlightedSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n }\n\n const seriesToBeBlurred = allChartSeries.filter(\n (series) => !seriesNamesToBeHighlighted.includes(series.name),\n );\n\n for (const series of seriesToBeBlurred) {\n const blurredSeriesIndex =\n allChartSeries.findIndex(\n (seriesItem) => seriesItem.name === series.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[blurredSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n blurredSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).toHaveAttribute('stroke-opacity');\n }\n};\n\n/**\n * Identifies if the series are visible / not visible in the chart by checking for a path with the series color (lacks other unique identifiers)\n * Apache Echarts displays the path color in both hex, rgb and a slightly adjusted rgb when highlighted, therefor we need to check for all three when looking for the series in the chart.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n // Check so that the series that should be visible are present in the chart\n for (const name of seriesNamesToBeVisible) {\n const visibleSeriesIndex =\n allChartSeries.findIndex((series) => series.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[visibleSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n visibleSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`)),\n ).toBeVisible({ timeout: 10000 });\n }\n\n // Check so that the other series are not present in the chart\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenSeriesIndex =\n allChartSeries.findIndex(\n (allChartSeriesItem) =>\n hiddenSeriesItem.name === allChartSeriesItem.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[hiddenSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n hiddenSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are selected -> has checkmark and no strike-through classes\nexport const expectLegendsSelected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesCheckmark(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesDeselected(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are deselected -> has strike-through and no checkmark classes\nexport const expectLegendsDeselected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesDeselected(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesCheckmark(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so all legends are neutral -> no checkmark and no strike-through classes\nexport const expectAllLegendsNeutral = async (page: Page) => {\n await expect(page.locator(SELECTORS.CHECKMARK)).not.toBeVisible();\n await expect(page.locator(SELECTORS.DESELECTED)).not.toBeVisible();\n};\n\n/**\n * Clicks the series legend item and hover the chart to make sure no blur effect exists on other series in the chart.\n * This is needed to make sure the series has the correct color when looking for them in the chart in later steps.\n */\nexport const clickSeries = async (page: Page, seriesName: string) => {\n await page.locator(`[data-labelname=\"${seriesName}\"]`).click();\n await page.hover('.ndl-chart');\n};\n\nexport const expectFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n await expect(\n page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`)),\n ).toBeVisible();\n await page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`))\n .hover();\n const tooltip = page.getByText(`${seriesName}formatted ${value}`);\n await expect(tooltip).toBeVisible();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"chart-test-utils.js","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAI3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;IACtC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CA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AE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC/D,CACF,CAAC;AACN,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { Chart } from '@neo4j-ndl/react-charts';\nimport { expect } from '@playwright/experimental-ct-react';\nimport { type Page } from '@playwright/test';\nimport { type ComponentProps } from 'react';\n\nimport { ChartWrapperWithTooltipFormatter } from './ChartWrapperWithTooltipFormatter';\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nconst convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const chartColorsAfterHighlighting: Record<number, string> = {\n 1: 'rgb(93,207,216)',\n 10: 'rgb(210,126,49)',\n 11: 'rgb(78,151,121)',\n 12: 'rgb(190,255,117)',\n 2: 'rgb(84,80,223)',\n 3: 'rgb(242,152,62)',\n 4: 'rgb(221,75,155)',\n 5: 'rgb(156,154,255)',\n 6: 'rgb(132,244,136)',\n 7: 'rgb(69,140,249)',\n 8: 'rgb(113,69,188)',\n 9: 'rgb(240,210,70)',\n};\n\nexport const pieChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: [\n {\n source: [\n ['product', '2012'],\n [seriesName, value],\n ],\n },\n ],\n legend: {\n show: true,\n },\n series: [\n {\n center: ['50%', '50%'],\n encode: {\n itemName: 'product',\n value: '2012',\n },\n itemStyle: {\n color: rgbSeriesColor,\n },\n radius: '90%',\n type: 'pie' as const,\n },\n ],\n});\n\nexport const barChartProps = (\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => ({\n dataset: {\n dimensions: ['Country', 'Sales'],\n source: [['Finland', value]],\n },\n legend: {\n show: true,\n },\n series: [\n {\n encode: {\n x: 'Country',\n y: 'Sales',\n },\n itemStyle: {\n color: rgbSeriesColor,\n },\n name: seriesName,\n type: 'bar' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n});\n\nexport const multiSeriesChartProps = {\n dataset: {\n dimensions: ['day', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth'],\n source: [\n ['Monday', 20, 40, 60, 80, 100, 120],\n ['Tuesday', 30, 50, 70, 90, 110, 130],\n ['Wednesday', 25, 45, 65, 85, 105, 125],\n ['Thursday', 35, 55, 75, 95, 115, 135],\n ['Friday', 40, 60, 80, 100, 120, 140],\n ],\n },\n legend: {\n show: true,\n wrappingType: 'wrapping' as const,\n },\n option: {},\n series: [\n {\n encode: { x: 'day', y: 'first' },\n name: 'First Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'second' },\n name: 'Second Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'third' },\n name: 'Third Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fourth' },\n name: 'Fourth Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'fifth' },\n name: 'Fifth Series',\n type: 'line' as const,\n },\n {\n encode: { x: 'day', y: 'sixth' },\n name: 'Sixth Series',\n type: 'line' as const,\n },\n ],\n xAxis: {\n type: 'category' as const,\n },\n yAxis: {\n type: 'value' as const,\n },\n};\n\nexport const multiSeriesChart = ({\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n}) => (\n <div style={{ height, width }} className=\"ndl-chart\">\n <Chart {...multiSeriesChartProps} {...chartProps} />\n </div>\n);\n\nexport const pieChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...pieChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const barChartWithTooltipFormatter = ({\n seriesName,\n value,\n rgbSeriesColor,\n chartProps,\n width = '100%',\n height = '400px',\n}: {\n chartProps?: Partial<ComponentProps<typeof Chart>>;\n width?: string;\n height?: string;\n seriesName: string;\n value: number;\n rgbSeriesColor: string;\n}) => (\n <div style={{ height, width }}>\n <ChartWrapperWithTooltipFormatter\n {...barChartProps(seriesName, value, rgbSeriesColor)}\n {...chartProps}\n />\n </div>\n);\n\nexport const expectChartElementVisible = async (page: Page) => {\n await expect(page.locator('svg')).toBeVisible();\n await expect(page.locator('.ndl-chart-legend')).toBeVisible();\n};\n\nconst SELECTORS = {\n CHECKMARK: '.ndl-chart-legend-item-square-checkmark',\n DESELECTED: '.ndl-chart-legend-item-deselected',\n seriesCheckmark: (name: string) =>\n `[data-labelname=\"${name}\"] .ndl-chart-legend-item-square-checkmark`,\n seriesDeselected: (name: string) =>\n `[data-labelname=\"${name}\"].ndl-chart-legend-item-deselected`,\n} as const;\n\nconst getGraphPaletteColorFromSeriesIndex = (index: string): string => {\n const hexColor = tokens.categorical[index as keyof typeof tokens.categorical];\n if (!hexColor) {\n throw new Error(`Categorical palette index ${index} not found`);\n }\n\n return hexColor;\n};\n\n/**\n * Checks so a single series is not blurred.\n */\nexport const expectSingleSeriesNotToBeBlurred = async (\n page: Page,\n seriesName: string,\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n const seriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === seriesName) +\n 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[seriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n seriesIndex.toString(),\n );\n\n // More flexible color matching - try both with and without spaces\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n // Wait for the element to be attached to the DOM before checking its attributes\n await expect(pathLocator).toBeAttached({ timeout: 10000 });\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n};\n\n/**\n * Checks so that the seriesNamesToBeHighlighted are visible in the chart and that other series are blurred.\n */\nexport const expectLegendSeriesToBeHighlightedInChart = async (\n page: Page,\n seriesNamesToBeHighlighted: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n for (const name of seriesNamesToBeHighlighted) {\n const highlightedSeriesIndex =\n allChartSeries.findIndex((seriesItem) => seriesItem.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[highlightedSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n highlightedSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).not.toHaveAttribute('stroke-opacity');\n }\n\n const seriesToBeBlurred = allChartSeries.filter(\n (series) => !seriesNamesToBeHighlighted.includes(series.name),\n );\n\n for (const series of seriesToBeBlurred) {\n const blurredSeriesIndex =\n allChartSeries.findIndex(\n (seriesItem) => seriesItem.name === series.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[blurredSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n blurredSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n const pathLocator = page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`));\n\n await expect(pathLocator).toHaveAttribute('stroke-opacity');\n }\n};\n\n/**\n * Identifies if the series are visible / not visible in the chart by checking for a path with the series color (lacks other unique identifiers)\n * Apache Echarts displays the path color in both hex, rgb and a slightly adjusted rgb when highlighted, therefor we need to check for all three when looking for the series in the chart.\n */\nexport const expectLegendSeriesToBeVisibleInChart = async (\n page: Page,\n seriesNamesToBeVisible: string[],\n) => {\n const allChartSeries = multiSeriesChartProps.series;\n\n // Check so that the series that should be visible are present in the chart\n for (const name of seriesNamesToBeVisible) {\n const visibleSeriesIndex =\n allChartSeries.findIndex((series) => series.name === name) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[visibleSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n visibleSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`)),\n ).toBeVisible({ timeout: 10000 });\n }\n\n // Check so that the other series are not present in the chart\n const hiddenSeries = multiSeriesChartProps.series.filter(\n (series) => !seriesNamesToBeVisible.includes(series.name),\n );\n\n for (const hiddenSeriesItem of hiddenSeries) {\n const hiddenSeriesIndex =\n allChartSeries.findIndex(\n (allChartSeriesItem) =>\n hiddenSeriesItem.name === allChartSeriesItem.name,\n ) + 1;\n\n const rgbSeriesColor = chartColorsAfterHighlighting[hiddenSeriesIndex];\n const hexSeriesColor = getGraphPaletteColorFromSeriesIndex(\n hiddenSeriesIndex.toString(),\n );\n\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n const hexRgb = convertHexToRGB(hexSeriesColor);\n const rgbWithoutSpaces = hexRgb.replace(/, /g, ',');\n\n await expect(\n page\n .locator(`path[stroke=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`path[stroke=\"${rgbWithSpaces}\"]`))\n .or(page.locator(`path[stroke=\"${hexSeriesColor}\"]`))\n .or(page.locator(`path[stroke=\"${convertHexToRGB(hexSeriesColor)}\"]`))\n .or(page.locator(`path[stroke=\"${rgbWithoutSpaces}\"]`)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are selected -> has checkmark and no strike-through classes\nexport const expectLegendsSelected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesCheckmark(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesDeselected(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so legends are deselected -> has strike-through and no checkmark classes\nexport const expectLegendsDeselected = async (\n page: Page,\n seriesNames: string[],\n) => {\n for (const name of seriesNames) {\n await expect(page.locator(SELECTORS.seriesDeselected(name))).toBeVisible();\n await expect(\n page.locator(SELECTORS.seriesCheckmark(name)),\n ).not.toBeVisible();\n }\n};\n\n// Check so all legends are neutral -> no checkmark and no strike-through classes\nexport const expectAllLegendsNeutral = async (page: Page) => {\n await expect(page.locator(SELECTORS.CHECKMARK)).not.toBeVisible();\n await expect(page.locator(SELECTORS.DESELECTED)).not.toBeVisible();\n};\n\n/**\n * Clicks the series legend item and hover the chart to make sure no blur effect exists on other series in the chart.\n * This is needed to make sure the series has the correct color when looking for them in the chart in later steps.\n */\nexport const clickSeries = async (page: Page, seriesName: string) => {\n await page.locator(`[data-labelname=\"${seriesName}\"]`).click();\n await page.hover('.ndl-chart');\n};\n\nexport const expectFormattedTooltipToBeVisible = async (\n page: Page,\n seriesName: string,\n value: number,\n rgbSeriesColor: string,\n) => {\n const rgbWithSpaces = rgbSeriesColor.replace(/,/g, ', ');\n\n await expect(\n page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`)),\n ).toBeVisible();\n await page\n .locator(`path[fill=\"${rgbSeriesColor}\"]`)\n .or(page.locator(`fill[stroke=\"${rgbWithSpaces}\"]`))\n .hover();\n const tooltip = page.getByText(`${seriesName}formatted ${value}`);\n await expect(tooltip).toBeVisible();\n};\n\nexport const waitForAnimationEnd = (page: Page, selector: string) => {\n return page\n .locator(selector)\n .evaluate((element) =>\n Promise.all(\n element.getAnimations().map((animation) => animation.finished),\n ),\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAeH,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,eAAe,CAAC;AAiFvB,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,GACV,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAeH,OAAO,EACL,KAAK,UAAU,EAKhB,MAAM,eAAe,CAAC;AAiFvB,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,GACV,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8gBhC"}
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { type LegendProps } from './chart-types';
|
|
22
22
|
import { type CommonProps } from './types';
|
|
23
|
-
export declare const Legend: ({ className, wrappingType, series, chartRef, ref, htmlAttributes, ...restProps }: CommonProps<"div", LegendProps>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Legend: ({ className, wrappingType, series, chartRef, selectedRef, ref, htmlAttributes, ...restProps }: CommonProps<"div", LegendProps>) => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
//# sourceMappingURL=Legend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.d.ts","sourceRoot":"","sources":["../../../src/charts/Legend.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAeH,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAgE3C,eAAO,MAAM,MAAM,GAA4B,
|
|
1
|
+
{"version":3,"file":"Legend.d.ts","sourceRoot":"","sources":["../../../src/charts/Legend.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAeH,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAgE3C,eAAO,MAAM,MAAM,GAA4B,+FAS5C,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,4CAmOjC,CAAC"}
|
|
@@ -125,6 +125,9 @@ export type LegendProps = {
|
|
|
125
125
|
color: string;
|
|
126
126
|
}[];
|
|
127
127
|
chartRef: React.RefObject<HTMLDivElement | null>;
|
|
128
|
+
/** Shared ref for legend selection state. Chart reads this when building
|
|
129
|
+
* setOption so that legend filters survive re-renders. */
|
|
130
|
+
selectedRef?: React.MutableRefObject<Record<string, boolean>>;
|
|
128
131
|
ref?: React.Ref<HTMLDivElement>;
|
|
129
132
|
};
|
|
130
133
|
export interface LegendOverflowProps extends LegendProps {
|
|
@@ -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,C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AAE,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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import type { EChartsOption } from 'echarts';
|
|
22
|
+
type PieChartWithRerenderProps = {
|
|
23
|
+
dataset1: EChartsOption['dataset'];
|
|
24
|
+
dataset2: EChartsOption['dataset'];
|
|
25
|
+
datasetNewCategories: EChartsOption['dataset'];
|
|
26
|
+
};
|
|
27
|
+
export declare function PieChartWithRerenderComponent({ dataset1, dataset2, datasetNewCategories, }: PieChartWithRerenderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=PieChartWithRerender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieChartWithRerender.d.ts","sourceRoot":"","sources":["../../../../src/charts/tests/PieChartWithRerender.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,oBAAoB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACrB,EAAE,yBAAyB,2CA+C3B"}
|
|
@@ -23,12 +23,13 @@ import { type Page } from '@playwright/test';
|
|
|
23
23
|
import { type ComponentProps } from 'react';
|
|
24
24
|
export declare const chartColorsAfterHighlighting: Record<number, string>;
|
|
25
25
|
export declare const pieChartProps: (seriesName: string, value: number, rgbSeriesColor: string) => {
|
|
26
|
+
dataset: {
|
|
27
|
+
source: (string | number)[][];
|
|
28
|
+
}[];
|
|
26
29
|
legend: {
|
|
27
30
|
show: boolean;
|
|
28
31
|
};
|
|
29
32
|
series: {
|
|
30
|
-
type: "pie";
|
|
31
|
-
radius: string;
|
|
32
33
|
center: string[];
|
|
33
34
|
encode: {
|
|
34
35
|
itemName: string;
|
|
@@ -37,29 +38,28 @@ export declare const pieChartProps: (seriesName: string, value: number, rgbSerie
|
|
|
37
38
|
itemStyle: {
|
|
38
39
|
color: string;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
source: (string | number)[][];
|
|
41
|
+
radius: string;
|
|
42
|
+
type: "pie";
|
|
43
43
|
}[];
|
|
44
44
|
};
|
|
45
45
|
export declare const barChartProps: (seriesName: string, value: number, rgbSeriesColor: string) => {
|
|
46
|
-
legend: {
|
|
47
|
-
show: boolean;
|
|
48
|
-
};
|
|
49
46
|
dataset: {
|
|
50
47
|
dimensions: string[];
|
|
51
48
|
source: (string | number)[][];
|
|
52
49
|
};
|
|
50
|
+
legend: {
|
|
51
|
+
show: boolean;
|
|
52
|
+
};
|
|
53
53
|
series: {
|
|
54
54
|
encode: {
|
|
55
55
|
x: string;
|
|
56
56
|
y: string;
|
|
57
57
|
};
|
|
58
|
-
name: string;
|
|
59
|
-
type: "bar";
|
|
60
58
|
itemStyle: {
|
|
61
59
|
color: string;
|
|
62
60
|
};
|
|
61
|
+
name: string;
|
|
62
|
+
type: "bar";
|
|
63
63
|
}[];
|
|
64
64
|
xAxis: {
|
|
65
65
|
type: "category";
|
|
@@ -137,4 +137,5 @@ export declare const expectAllLegendsNeutral: (page: Page) => Promise<void>;
|
|
|
137
137
|
*/
|
|
138
138
|
export declare const clickSeries: (page: Page, seriesName: string) => Promise<void>;
|
|
139
139
|
export declare const expectFormattedTooltipToBeVisible: (page: Page, seriesName: string, value: number, rgbSeriesColor: string) => Promise<void>;
|
|
140
|
+
export declare const waitForAnimationEnd: (page: Page, selector: string) => Promise<Animation[]>;
|
|
140
141
|
//# sourceMappingURL=chart-test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-test-utils.d.ts","sourceRoot":"","sources":["../../../../src/charts/tests/chart-test-utils.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAoB5C,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAa/D,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,OAAO,MAAM,EACb,gBAAgB,MAAM;;;;;;;;;;;;;;;;;;;CA2BtB,CAAC;AAEH,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,OAAO,MAAM,EACb,gBAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CA4BtB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;CAsDjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,gCAI9B;IACD,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,4CAIA,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,mEAO1C;IACD,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,C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