@exegia/corpora-ui 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/composed/chat/chart/chart-atom.d.ts +30 -0
- package/dist-lib/components/composed/chat/chart/chart-context.d.ts +2 -0
- package/dist-lib/components/composed/chat/chart/chart-legend.d.ts +4 -0
- package/dist-lib/components/composed/chat/chart/chart-plot.d.ts +3 -0
- package/dist-lib/components/composed/chat/chart/chart-root.d.ts +3 -0
- package/dist-lib/components/composed/chat/chart/chart-tooltip.d.ts +4 -0
- package/dist-lib/components/composed/chat/chart/constants.d.ts +3 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-area-chart.d.ts +93 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-bar-chart.d.ts +86 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-brush.d.ts +65 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-chart.d.ts +44 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-dot.d.ts +16 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-legend.d.ts +24 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-line-chart.d.ts +90 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-pie-chart.d.ts +73 -0
- package/dist-lib/components/composed/chat/chart/evilcharts/echarts-tooltip.d.ts +29 -0
- package/dist-lib/components/composed/chat/chart/index.d.ts +6 -0
- package/dist-lib/components/composed/chat/chart/type.d.ts +80 -0
- package/dist-lib/components/composed/chat/chart/use-chart-state.d.ts +3 -0
- package/dist-lib/components/composed/chat/chart/use-chart.d.ts +6 -0
- package/dist-lib/components/composed/chat/chart/utils.d.ts +5 -0
- package/dist-lib/components/composed/chat/chart.d.ts +1 -44
- package/dist-lib/components/composed/chat/index.d.ts +1 -1
- package/dist-lib/components/stories/chart.story.d.ts +39 -2
- package/dist-lib/components/stories/insight-cards.story.d.ts +30 -1
- package/dist-lib/index.js +10020 -5549
- package/dist-lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/composed/chat/__tests__/chart.test.tsx +255 -1
- package/src/components/composed/chat/chart/chart-atom.ts +55 -0
- package/src/components/composed/chat/chart/chart-context.ts +9 -0
- package/src/components/composed/chat/chart/chart-legend.tsx +75 -0
- package/src/components/composed/chat/chart/chart-plot.tsx +233 -0
- package/src/components/composed/chat/chart/chart-root.tsx +229 -0
- package/src/components/composed/chat/chart/chart-tooltip.tsx +74 -0
- package/src/components/composed/chat/chart/constants.ts +8 -0
- package/src/components/composed/chat/chart/evilcharts/LICENSE +21 -0
- package/src/components/composed/chat/chart/evilcharts/README.md +8 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-area-chart.tsx +2358 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-bar-chart.tsx +2261 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-brush.tsx +233 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-chart.tsx +214 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-dot.tsx +111 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-legend.tsx +131 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-line-chart.tsx +2112 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-pie-chart.tsx +1235 -0
- package/src/components/composed/chat/chart/evilcharts/echarts-tooltip.tsx +125 -0
- package/src/components/composed/chat/chart/index.ts +13 -0
- package/src/components/composed/chat/chart/type.ts +88 -0
- package/src/components/composed/chat/chart/use-chart-state.ts +22 -0
- package/src/components/composed/chat/chart/use-chart.ts +70 -0
- package/src/components/composed/chat/chart/utils.ts +47 -0
- package/src/components/composed/chat/chart.tsx +2 -400
- package/src/components/composed/chat/index.ts +1 -7
- package/src/components/stories/chart.story.tsx +16 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { indicatorBackground, type ResolvedColors } from "./echarts-chart";
|
|
2
|
+
import type { TooltipComponentOption } from "echarts/components";
|
|
3
|
+
|
|
4
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
// Tooltip — the shared HTML shell/row primitives and the chart-agnostic option
|
|
6
|
+
// fields. The tooltip DOM lives inside `[data-chart={id}]`, so the injected
|
|
7
|
+
// `--color-*` vars and Tailwind classes resolve directly (no color read). Each
|
|
8
|
+
// chart composes its own rows but shares the shell/styling and base option.
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export type TooltipVariant = "default" | "frosted-glass";
|
|
12
|
+
export type TooltipRoundness = "sm" | "md" | "lg" | "xl";
|
|
13
|
+
// Tooltip anchoring: "variable" follows both axes (ECharts default, current
|
|
14
|
+
// behavior); "fixed" tracks the pointer's X (centered) but stays pinned near
|
|
15
|
+
// the top (fixed Y).
|
|
16
|
+
export type TooltipPosition = "fixed" | "variable";
|
|
17
|
+
|
|
18
|
+
export const roundnessClass: Record<TooltipRoundness, string> = {
|
|
19
|
+
sm: "rounded-sm",
|
|
20
|
+
md: "rounded-md",
|
|
21
|
+
lg: "rounded-lg",
|
|
22
|
+
xl: "rounded-xl",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const tooltipVariantClass: Record<TooltipVariant, string> = {
|
|
26
|
+
default: "bg-background",
|
|
27
|
+
"frosted-glass": "bg-background/50 backdrop-blur-md",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// The standard series indicator swatch — a rounded square filled with the
|
|
31
|
+
// series' solid var or multi-stop gradient (indicatorBackground). A chart drops
|
|
32
|
+
// this into a tooltipRow's `indicatorHtml`.
|
|
33
|
+
export function tooltipIndicatorHtml(key: string, colorsCount: number): string {
|
|
34
|
+
return `<div class="h-2.5 w-2.5 shrink-0 rounded-[2px]" style="background:${indicatorBackground(key, colorsCount)}"></div>`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// One tooltip row: indicator swatch + label/value pair. `dimmed` is a class
|
|
38
|
+
// fragment (e.g. " opacity-30") appended to the row so the selection/hover dim
|
|
39
|
+
// stays byte-identical to the inlined markup.
|
|
40
|
+
export function tooltipRow({
|
|
41
|
+
indicatorHtml,
|
|
42
|
+
labelText,
|
|
43
|
+
valueText,
|
|
44
|
+
dimmed,
|
|
45
|
+
}: {
|
|
46
|
+
indicatorHtml: string;
|
|
47
|
+
labelText: string;
|
|
48
|
+
valueText: string;
|
|
49
|
+
dimmed: string;
|
|
50
|
+
}): string {
|
|
51
|
+
return `<div class="flex w-full flex-wrap items-center gap-2${dimmed}">
|
|
52
|
+
${indicatorHtml}
|
|
53
|
+
<div class="flex flex-1 items-center justify-between gap-4 leading-none">
|
|
54
|
+
<span class="text-muted-foreground">${labelText}</span>
|
|
55
|
+
<span class="text-foreground font-mono font-medium tabular-nums">${valueText}</span>
|
|
56
|
+
</div>
|
|
57
|
+
</div>`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The outer tooltip surface — border, padding, shadow, roundness + variant
|
|
61
|
+
// classes — wrapping the axis label and the composed rows.
|
|
62
|
+
export function tooltipShell({
|
|
63
|
+
label,
|
|
64
|
+
body,
|
|
65
|
+
roundness,
|
|
66
|
+
variant,
|
|
67
|
+
}: {
|
|
68
|
+
label: string;
|
|
69
|
+
body: string;
|
|
70
|
+
roundness: TooltipRoundness;
|
|
71
|
+
variant: TooltipVariant;
|
|
72
|
+
}): string {
|
|
73
|
+
return `<div class="grid min-w-32 items-start gap-1.5 border border-border/50 px-2.5 py-1.5 text-xs shadow-xl ${roundnessClass[roundness]} ${tooltipVariantClass[variant]}">
|
|
74
|
+
<div class="font-medium text-primary">${label}</div>
|
|
75
|
+
<div class="grid gap-1.5">${body}</div>
|
|
76
|
+
</div>`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Maps the TooltipPosition prop onto the ECharts tooltip `position` field.
|
|
80
|
+
// "variable" → undefined (default follow-both-axes, current behavior); "fixed" →
|
|
81
|
+
// a callback that centers the tooltip on the pointer's X but pins it near the
|
|
82
|
+
// top (fixed Y).
|
|
83
|
+
export function resolveTooltipPosition(
|
|
84
|
+
position: TooltipPosition,
|
|
85
|
+
): TooltipComponentOption["position"] {
|
|
86
|
+
if (position === "variable") return undefined;
|
|
87
|
+
return (point, _params, _dom, _rect, size) => [point[0] - size.contentSize[0] / 2, 8];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// The chart-agnostic tooltip option fields (show, trigger, confine,
|
|
91
|
+
// background/border/padding/extraCssText, axisPointer, position). The chart
|
|
92
|
+
// supplies only `formatter` and spreads this in. `axisPointerColor` is the
|
|
93
|
+
// pre-resolved cursor-line color, so this helper needs no live token read.
|
|
94
|
+
export function tooltipBaseOption(params: {
|
|
95
|
+
present: boolean;
|
|
96
|
+
cursor: boolean;
|
|
97
|
+
tokens: ResolvedColors["tokens"];
|
|
98
|
+
position: TooltipPosition;
|
|
99
|
+
axisPointerColor: string;
|
|
100
|
+
strokeWidth: number;
|
|
101
|
+
}): TooltipComponentOption {
|
|
102
|
+
const { present, cursor, position, axisPointerColor, strokeWidth } = params;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
show: present,
|
|
106
|
+
trigger: "axis",
|
|
107
|
+
confine: true,
|
|
108
|
+
displayTransition: false,
|
|
109
|
+
backgroundColor: "transparent",
|
|
110
|
+
borderWidth: 0,
|
|
111
|
+
padding: 0,
|
|
112
|
+
extraCssText: "box-shadow:none;",
|
|
113
|
+
axisPointer: cursor
|
|
114
|
+
? {
|
|
115
|
+
type: "line",
|
|
116
|
+
lineStyle: {
|
|
117
|
+
color: axisPointerColor,
|
|
118
|
+
width: strokeWidth,
|
|
119
|
+
type: [3, 3] as [number, number],
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
: { type: "none" },
|
|
123
|
+
position: resolveTooltipPosition(position),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { ChartRoot as Chart, ChartRoot } from "./chart-root"
|
|
2
|
+
export { useChartContext } from "./chart-context"
|
|
3
|
+
export { useChartActions, useChartState } from "./use-chart-state"
|
|
4
|
+
export {
|
|
5
|
+
chartSelectedKeyAtom,
|
|
6
|
+
chartStateAtom,
|
|
7
|
+
selectChartKeyAtom,
|
|
8
|
+
toggleChartKeyAtom,
|
|
9
|
+
resetChartAtom,
|
|
10
|
+
removeChartInstance,
|
|
11
|
+
} from "./chart-atom"
|
|
12
|
+
export { CHART_TYPE_LABEL, CHART_DEFAULT_HEIGHT } from "./constants"
|
|
13
|
+
export type * from "./type"
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { useRender } from "@base-ui/react/use-render"
|
|
2
|
+
import type * as React from "react"
|
|
3
|
+
import type { Reference } from "@/components/atoms/reference"
|
|
4
|
+
import type {
|
|
5
|
+
AreaProps,
|
|
6
|
+
CurveType,
|
|
7
|
+
TooltipProps,
|
|
8
|
+
XAxisProps,
|
|
9
|
+
YAxisProps,
|
|
10
|
+
} from "./evilcharts/echarts-area-chart"
|
|
11
|
+
import type { BarProps } from "./evilcharts/echarts-bar-chart"
|
|
12
|
+
import type { LineProps } from "./evilcharts/echarts-line-chart"
|
|
13
|
+
import type { PieProps } from "./evilcharts/echarts-pie-chart"
|
|
14
|
+
import type { BrushProps } from "./evilcharts/echarts-brush"
|
|
15
|
+
import type { EChartsRenderer } from "./evilcharts/echarts-chart"
|
|
16
|
+
|
|
17
|
+
export type TChartType = "pie" | "area" | "line" | "bar"
|
|
18
|
+
export type TChartVariant =
|
|
19
|
+
"default" | "stacked" | "percent" | "donut" | "horizontal"
|
|
20
|
+
export type TChartInstanceId = string
|
|
21
|
+
export type TChartDatum = {
|
|
22
|
+
label: string
|
|
23
|
+
[key: string]: string | number | null
|
|
24
|
+
}
|
|
25
|
+
export interface IChartSeries {
|
|
26
|
+
key: string
|
|
27
|
+
label: React.ReactNode
|
|
28
|
+
color?: string
|
|
29
|
+
format?: (value: number) => React.ReactNode
|
|
30
|
+
area?: Omit<AreaProps, "dataKey" | "children">
|
|
31
|
+
line?: Omit<LineProps, "dataKey" | "children">
|
|
32
|
+
bar?: Omit<BarProps, "dataKey">
|
|
33
|
+
}
|
|
34
|
+
export interface IChartState {
|
|
35
|
+
selectedKey: string | null
|
|
36
|
+
}
|
|
37
|
+
export interface IChartStateActions {
|
|
38
|
+
select: (key: string | null) => void
|
|
39
|
+
toggle: (key: string) => void
|
|
40
|
+
clearSelection: () => void
|
|
41
|
+
reset: () => void
|
|
42
|
+
}
|
|
43
|
+
export interface IChartProps extends Omit<
|
|
44
|
+
React.ComponentPropsWithoutRef<"div">,
|
|
45
|
+
"title"
|
|
46
|
+
> {
|
|
47
|
+
type: TChartType
|
|
48
|
+
/** Unique within the current Jotai store. Omit for an isolated generated id. */
|
|
49
|
+
chartId?: TChartInstanceId
|
|
50
|
+
title?: React.ReactNode
|
|
51
|
+
subtitle?: React.ReactNode
|
|
52
|
+
badge?: React.ReactNode
|
|
53
|
+
reference?: React.ComponentProps<typeof Reference>
|
|
54
|
+
data: TChartDatum[]
|
|
55
|
+
series: IChartSeries[]
|
|
56
|
+
center?: { value: React.ReactNode; label?: React.ReactNode }
|
|
57
|
+
headerless?: boolean
|
|
58
|
+
/** Outer component width. Numbers are pixels; CSS lengths such as "100%" work. */
|
|
59
|
+
width?: React.CSSProperties["width"]
|
|
60
|
+
/** Outer component height, including header and legend. Plot fills remaining space. */
|
|
61
|
+
height?: React.CSSProperties["height"]
|
|
62
|
+
/** Explicit plot height takes precedence over filling the outer height. */
|
|
63
|
+
plotHeight?: React.CSSProperties["height"]
|
|
64
|
+
/** Replace the outer element using the coss/Base UI render API. */
|
|
65
|
+
render?: useRender.ComponentProps<"div">["render"]
|
|
66
|
+
/** stacked/percent: area or bar; horizontal: bar; donut: pie. */
|
|
67
|
+
variant?: TChartVariant
|
|
68
|
+
renderer?: EChartsRenderer
|
|
69
|
+
animation?: boolean
|
|
70
|
+
loading?: boolean
|
|
71
|
+
emptyContent?: React.ReactNode
|
|
72
|
+
showLegend?: boolean
|
|
73
|
+
interactive?: boolean
|
|
74
|
+
selectedKey?: string | null
|
|
75
|
+
defaultSelectedKey?: string | null
|
|
76
|
+
onSelectionChange?: (key: string | null) => void
|
|
77
|
+
curveType?: CurveType
|
|
78
|
+
grid?: boolean
|
|
79
|
+
xAxis?: boolean | XAxisProps
|
|
80
|
+
yAxis?: boolean | YAxisProps
|
|
81
|
+
tooltip?: boolean | TooltipProps
|
|
82
|
+
brush?: boolean | BrushProps
|
|
83
|
+
pie?: Omit<PieProps, "children">
|
|
84
|
+
/** ECharts options override generated options at the top level. */
|
|
85
|
+
chartOptions?: Record<string, unknown>
|
|
86
|
+
/** Selection methods; also available via useChartActions(chartId). */
|
|
87
|
+
ref?: React.Ref<IChartStateActions>
|
|
88
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { useMemo } from "react"
|
|
3
|
+
import { useAtomValue, useSetAtom } from "jotai"
|
|
4
|
+
import {
|
|
5
|
+
chartStateAtom,
|
|
6
|
+
selectChartKeyAtom,
|
|
7
|
+
toggleChartKeyAtom,
|
|
8
|
+
resetChartAtom,
|
|
9
|
+
} from "./chart-atom"
|
|
10
|
+
import type { IChartStateActions, TChartInstanceId } from "./type"
|
|
11
|
+
export function useChartState(id: TChartInstanceId) {
|
|
12
|
+
return useAtomValue(chartStateAtom(id))
|
|
13
|
+
}
|
|
14
|
+
export function useChartActions(id: TChartInstanceId): IChartStateActions {
|
|
15
|
+
const select = useSetAtom(selectChartKeyAtom(id))
|
|
16
|
+
const toggle = useSetAtom(toggleChartKeyAtom(id))
|
|
17
|
+
const reset = useSetAtom(resetChartAtom(id))
|
|
18
|
+
return useMemo(
|
|
19
|
+
() => ({ select, toggle, reset, clearSelection: () => select(null) }),
|
|
20
|
+
[select, toggle, reset]
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import {
|
|
3
|
+
useEffect,
|
|
4
|
+
useId,
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from "react"
|
|
10
|
+
import { useStore } from "jotai"
|
|
11
|
+
import {
|
|
12
|
+
chartConfigAtom,
|
|
13
|
+
chartSelectedKeyAtom,
|
|
14
|
+
removeChartInstance,
|
|
15
|
+
} from "./chart-atom"
|
|
16
|
+
import { useChartActions, useChartState } from "./use-chart-state"
|
|
17
|
+
import type { IChartProps } from "./type"
|
|
18
|
+
const useClientLayoutEffect =
|
|
19
|
+
typeof window === "undefined" ? useEffect : useLayoutEffect
|
|
20
|
+
export function useChart(props: IChartProps) {
|
|
21
|
+
const generatedId = useId()
|
|
22
|
+
const id = props.chartId ?? generatedId
|
|
23
|
+
const store = useStore()
|
|
24
|
+
const [initial] = useState(props.defaultSelectedKey ?? null)
|
|
25
|
+
const lifecycle = useRef(0)
|
|
26
|
+
const keys = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
props.type === "pie"
|
|
29
|
+
? props.data.map((row) => row.label)
|
|
30
|
+
: props.series.map((s) => s.key),
|
|
31
|
+
[props.type, props.data, props.series]
|
|
32
|
+
)
|
|
33
|
+
const state = useChartState(id)
|
|
34
|
+
const actions = useChartActions(id)
|
|
35
|
+
useClientLayoutEffect(() => {
|
|
36
|
+
const generation = ++lifecycle.current
|
|
37
|
+
store.set(chartSelectedKeyAtom(id), initial)
|
|
38
|
+
// Named instances persist until removeChartInstance; generated ids have no external consumers.
|
|
39
|
+
return () => {
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
if (!props.chartId && lifecycle.current === generation)
|
|
42
|
+
removeChartInstance(id)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}, [id, store, initial, props.chartId])
|
|
46
|
+
useClientLayoutEffect(() => {
|
|
47
|
+
store.set(chartConfigAtom(id), {
|
|
48
|
+
controlled: props.selectedKey !== undefined,
|
|
49
|
+
initial,
|
|
50
|
+
keys,
|
|
51
|
+
onChange: props.onSelectionChange,
|
|
52
|
+
})
|
|
53
|
+
const current =
|
|
54
|
+
props.selectedKey !== undefined
|
|
55
|
+
? props.selectedKey
|
|
56
|
+
: store.get(chartSelectedKeyAtom(id))
|
|
57
|
+
store.set(
|
|
58
|
+
chartSelectedKeyAtom(id),
|
|
59
|
+
current !== null && keys.includes(current) ? current : null
|
|
60
|
+
)
|
|
61
|
+
}, [id, store, initial, keys, props.selectedKey, props.onSelectionChange])
|
|
62
|
+
const candidate =
|
|
63
|
+
props.selectedKey !== undefined ? props.selectedKey : state.selectedKey
|
|
64
|
+
return {
|
|
65
|
+
id,
|
|
66
|
+
selectedKey:
|
|
67
|
+
candidate !== null && keys.includes(candidate) ? candidate : null,
|
|
68
|
+
actions,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ChartConfig } from "./evilcharts/echarts-chart"
|
|
2
|
+
import type { IChartSeries, TChartDatum, TChartType } from "./type"
|
|
3
|
+
export function chartSeriesColor(series: IChartSeries, index: number) {
|
|
4
|
+
return series.color ?? `var(--chart-series-${(index % 5) + 1})`
|
|
5
|
+
}
|
|
6
|
+
export function formatChartValue(
|
|
7
|
+
series: IChartSeries | undefined,
|
|
8
|
+
value: unknown
|
|
9
|
+
) {
|
|
10
|
+
return typeof value === "number" && series?.format
|
|
11
|
+
? series.format(value)
|
|
12
|
+
: String(value ?? "—")
|
|
13
|
+
}
|
|
14
|
+
export function buildChartConfig(
|
|
15
|
+
type: TChartType,
|
|
16
|
+
data: TChartDatum[],
|
|
17
|
+
series: IChartSeries[]
|
|
18
|
+
): ChartConfig {
|
|
19
|
+
const entries =
|
|
20
|
+
type === "pie"
|
|
21
|
+
? data.map(
|
|
22
|
+
(row, index) =>
|
|
23
|
+
[
|
|
24
|
+
row.label,
|
|
25
|
+
{
|
|
26
|
+
label: row.label,
|
|
27
|
+
colors: { light: [`var(--chart-series-${(index % 5) + 1})`] },
|
|
28
|
+
},
|
|
29
|
+
] as const
|
|
30
|
+
)
|
|
31
|
+
: series.map(
|
|
32
|
+
(item, index) =>
|
|
33
|
+
[
|
|
34
|
+
item.key,
|
|
35
|
+
{
|
|
36
|
+
label: item.label,
|
|
37
|
+
colors: { light: [chartSeriesColor(item, index)] },
|
|
38
|
+
},
|
|
39
|
+
] as const
|
|
40
|
+
)
|
|
41
|
+
return Object.fromEntries(
|
|
42
|
+
entries.map(([key, value]) => [
|
|
43
|
+
key,
|
|
44
|
+
{ ...value, colors: { light: [...value.colors.light] } },
|
|
45
|
+
])
|
|
46
|
+
)
|
|
47
|
+
}
|