@gridui/chart 0.0.0-stage → 1.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/README.md +65 -2
- package/dist/bar-chart/bar-chart.d.ts +12 -0
- package/dist/bar-series/bar-series.d.ts +17 -0
- package/dist/chart-cursor/chart-cursor.d.ts +13 -0
- package/dist/chart-grid/chart-grid.d.ts +18 -0
- package/dist/chart-plot/chart-plot.d.ts +13 -0
- package/dist/chart-tooltip/chart-tooltip.d.ts +14 -0
- package/dist/chart-tooltip/layout.d.ts +31 -0
- package/dist/chart-value-labels/chart-value-labels.d.ts +17 -0
- package/dist/chart-value-labels/layout.d.ts +28 -0
- package/dist/chart-x-axis/chart-x-axis.d.ts +12 -0
- package/dist/chart-y-axis/chart-y-axis.d.ts +12 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1276 -0
- package/dist/index.js.map +7 -0
- package/dist/line-chart/line-chart.d.ts +12 -0
- package/dist/line-series/line-series.d.ts +16 -0
- package/dist/shared/axis.d.ts +13 -0
- package/dist/shared/chart-root.d.ts +14 -0
- package/dist/shared/context.d.ts +38 -0
- package/dist/shared/datum-mark.d.ts +13 -0
- package/dist/shared/model.d.ts +13 -0
- package/dist/shared/ticks.d.ts +14 -0
- package/dist/shared/types.d.ts +46 -0
- package/dist/shared/use-measured-layout.d.ts +12 -0
- package/dist/styles.css +37 -0
- package/docs/catalog.json +168 -0
- package/docs/reference/README.md +14 -0
- package/docs/reference/bar-chart.md +97 -0
- package/docs/reference/bar-series.md +61 -0
- package/docs/reference/chart-cursor.md +39 -0
- package/docs/reference/chart-grid.md +61 -0
- package/docs/reference/chart-plot.md +37 -0
- package/docs/reference/chart-tooltip.md +37 -0
- package/docs/reference/chart-value-labels.md +57 -0
- package/docs/reference/chart-xaxis.md +71 -0
- package/docs/reference/chart-yaxis.md +71 -0
- package/docs/reference/line-chart.md +97 -0
- package/docs/reference/line-series.md +47 -0
- package/package.json +50 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/shared/context.ts", "../src/shared/model.ts", "../src/shared/chart-root.tsx", "../src/bar-chart/bar-chart.tsx", "../src/shared/datum-mark.tsx", "../src/bar-series/bar-series.tsx", "../src/chart-cursor/chart-cursor.tsx", "../src/shared/ticks.ts", "../src/chart-grid/chart-grid.tsx", "../src/chart-plot/chart-plot.tsx", "../src/shared/use-measured-layout.ts", "../src/chart-tooltip/layout.ts", "../src/chart-tooltip/chart-tooltip.tsx", "../src/chart-value-labels/layout.ts", "../src/chart-value-labels/chart-value-labels.tsx", "../src/shared/axis.tsx", "../src/chart-x-axis/chart-x-axis.tsx", "../src/chart-y-axis/chart-y-axis.tsx", "../src/line-chart/line-chart.tsx", "../src/line-series/line-series.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Context\n */\n\nimport type { ChartDatum, ChartScale } from \"./types\";\nimport { createContext, useContext } from \"react\";\n\nexport type ChartState = {\n readonly data: readonly ChartDatum[];\n readonly kind: \"line\" | \"bar\";\n readonly horizontal: boolean;\n readonly scale: ChartScale;\n readonly domain: readonly [number, number];\n readonly label: string;\n readonly height: number;\n readonly selectedId: string | null;\n readonly activeId: string | null;\n readonly interactive: boolean;\n readonly select: (id: string | null) => void;\n readonly activate: (id: string | null, source: \"pointer\" | \"focus\") => void;\n readonly dismiss: () => void;\n readonly formatDatum: (datum: ChartDatum) => string;\n};\n\nexport const ChartContext = createContext<ChartState | null>(null);\nexport const useChart = (): ChartState => {\n const state = useContext(ChartContext);\n if (!state) {\n throw new Error(\"Chart parts require a LineChart or BarChart.\");\n }\n return state;\n};\n\nexport type PlotState = {\n readonly width: number;\n readonly height: number;\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly bottom: number;\n readonly band: number;\n readonly category: (datum: ChartDatum) => number;\n readonly value: (value: number) => number;\n};\nexport const PlotContext = createContext<PlotState | null>(null);\nexport const usePlot = (): PlotState => {\n const state = useContext(PlotContext);\n if (!state) {\n throw new Error(\"Chart drawing parts require a ChartPlot.\");\n }\n return state;\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Model\n */\n\nimport type { ChartDatum, ChartScale } from \"./types\";\n\nexport const numericX = (value: ChartDatum[\"x\"], scale: ChartScale): number => {\n const parsed = scale === \"time\" && typeof value === \"string\" ? Date.parse(value) : value;\n const number = value instanceof Date ? value.getTime() : parsed;\n if (typeof number !== \"number\" || !Number.isFinite(number)) {\n throw new RangeError(\"Continuous chart coordinates must be finite numbers or valid dates.\");\n }\n return number;\n};\n\nexport const prepareData = (data: readonly ChartDatum[], scale: ChartScale): readonly ChartDatum[] => {\n const ids = new Set<string>();\n for (const datum of data) {\n if (!datum.id || ids.has(datum.id)) {\n throw new Error(\"Chart datum IDs must be nonempty and unique.\");\n }\n ids.add(datum.id);\n if (datum.y !== null && !Number.isFinite(datum.y)) {\n throw new RangeError(\"Chart values must be finite numbers or null.\");\n }\n if (scale !== \"category\") {\n numericX(datum.x, scale);\n }\n }\n return scale === \"category\" ? data : [...data].sort((a, b) => {\n return numericX(a.x, scale) - numericX(b.x, scale);\n });\n};\n\nexport const valueDomain = (data: readonly ChartDatum[], explicit?: readonly [number, number]): readonly [number, number] => {\n let min = 0;\n let max = 0;\n for (const datum of data) {\n if (datum.y !== null) {\n min = Math.min(min, datum.y);\n max = Math.max(max, datum.y);\n }\n }\n if (explicit) {\n if (!explicit.every(Number.isFinite) || explicit[0] >= explicit[1] || explicit[0] > min || explicit[1] < max) {\n throw new RangeError(\"Chart domains must be increasing, finite, and include zero and all values.\");\n }\n return explicit;\n }\n return min === max ? [\n 0,\n 1,\n ] : [\n min,\n max,\n ];\n};\n\nexport const valueTicks = (domain: readonly [number, number]): readonly number[] => {\n return [\n ...new Set([\n 0,\n ...Array.from({ length: 5 }, (_, index) => {\n return domain[0] + (domain[1] - domain[0]) * index / 4;\n }),\n ]),\n ].sort((a, b) => {\n return a - b;\n });\n};\n\nexport const linePath = (data: readonly ChartDatum[], x: (datum: ChartDatum) => number, y: (value: number) => number): string => {\n let connected = false;\n return data.map(datum => {\n if (datum.y === null) {\n connected = false;\n return \"\";\n }\n const command = connected ? \"L\" : \"M\";\n connected = true;\n return `${command}${x(datum)},${y(datum.y)}`;\n }).join(\" \");\n};\n\nexport const datumLabel = (datum: ChartDatum): string => {\n const x = datum.x instanceof Date ? datum.x.toISOString() : String(datum.x);\n return `${x}: ${datum.y === null ? \"\u2014\" : String(datum.y)}`;\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Chart Root\n */\n\nimport { ChartContext } from \"./context\";\nimport { datumLabel, prepareData, valueDomain } from \"./model\";\nimport type { ChartOptions, ChartScale } from \"./types\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\n\nexport type ChartRootProps = ChartOptions & {\n readonly kind: \"line\" | \"bar\";\n readonly horizontal: boolean;\n readonly scale: ChartScale;\n};\n\nexport const ChartRoot: FC<ChartRootProps> = (props: ChartRootProps) => {\n\n const {\n label, data, children, height = 300, yDomain, selectedId, defaultSelectedId,\n onSelectionChange, formatDatum = datumLabel, kind, horizontal, scale, className, ...rest\n } = props;\n const [\n localSelection,\n setLocalSelection,\n ] = useState<string | null>(defaultSelectedId ?? null);\n const [\n hoveredId,\n setHoveredId,\n ] = useState<string | null>(null);\n const [\n focusedId,\n setFocusedId,\n ] = useState<string | null>(null);\n const { ordered, domain, availableIds } = useMemo(() => {\n const prepared = prepareData(data, scale);\n return {\n ordered: prepared,\n domain: valueDomain(prepared, yDomain),\n availableIds: new Set(prepared.filter(datum => {\n return datum.y !== null;\n }).map(datum => {\n return datum.id;\n })),\n };\n }, [\n data,\n scale,\n yDomain,\n ]);\n useEffect(() => {\n setHoveredId(current => {\n return current !== null && availableIds.has(current) ? current : null;\n });\n setFocusedId(current => {\n return current !== null && availableIds.has(current) ? current : null;\n });\n }, [availableIds]);\n const activeId = [\n hoveredId,\n focusedId,\n ].find(id => {\n return id !== null && availableIds.has(id);\n }) ?? null;\n const activate = (id: string | null, source: \"pointer\" | \"focus\") => {\n if (source === \"pointer\") {\n setHoveredId(id);\n } else {\n setFocusedId(id);\n }\n };\n const dismiss = () => {\n setHoveredId(null);\n setFocusedId(null);\n };\n if (!Number.isFinite(height) || height < 160) {\n throw new RangeError(\"Chart height must be finite and at least 160 pixels.\");\n }\n const candidate = selectedId === undefined ? localSelection : selectedId;\n const selection = candidate !== null && availableIds.has(candidate) ? candidate : null;\n const select = (id: string | null) => {\n if (selectedId === undefined) {\n setLocalSelection(id);\n }\n onSelectionChange?.(id);\n };\n return (<div\n {...rest}\n role=\"group\"\n aria-label={label}\n className={cn(\"gridui-chart\", className)}\n >\n <ChartContext\n value={{\n data: ordered,\n kind,\n horizontal,\n scale,\n domain,\n label,\n height,\n selectedId: selection,\n activeId,\n interactive: onSelectionChange !== undefined || defaultSelectedId !== undefined,\n select,\n activate,\n dismiss,\n formatDatum,\n }}\n >\n {children}\n </ChartContext>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace BarChart\n * @description Bar Chart\n */\n\nimport { ChartRoot } from \"../shared/chart-root\";\nimport type { ChartOptions } from \"../shared/types\";\nimport type { FC } from \"react\";\n\nexport type BarChartProps = ChartOptions & {\n readonly orientation?: \"vertical\" | \"horizontal\";\n};\n\nexport const BarChart: FC<BarChartProps> = (props: BarChartProps) => {\n const { orientation = \"vertical\", ...restProps } = props;\n\n return (<ChartRoot\n {...restProps}\n kind=\"bar\"\n horizontal={orientation === \"horizontal\"}\n scale=\"category\"\n />);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Datum Mark\n */\n\nimport { useChart } from \"./context\";\nimport type { ChartDatum } from \"./types\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport type { FC, ReactNode } from \"react\";\n\nexport type DatumMarkProps = {\n readonly datum: ChartDatum;\n readonly children: ReactNode;\n};\n\nexport const DatumMark: FC<DatumMarkProps> = (props: DatumMarkProps) => {\n const { datum, children } = props;\n\n const chart = useChart();\n const selected = chart.selectedId === datum.id;\n return (<g\n className=\"gridui-chart-mark\"\n data-selected={selected || undefined}\n role={chart.interactive ? \"button\" : undefined}\n tabIndex={chart.interactive ? 0 : undefined}\n aria-label={chart.formatDatum(datum)}\n aria-pressed={chart.interactive ? selected : undefined}\n onPointerEnter={() => {\n return void chart.activate(datum.id, \"pointer\");\n }}\n onPointerLeave={() => {\n return void chart.activate(null, \"pointer\");\n }}\n onFocus={() => {\n return void chart.activate(datum.id, \"focus\");\n }}\n onBlur={() => {\n return void chart.activate(null, \"focus\");\n }}\n onClick={chart.interactive ? () => {\n return void chart.select(selected ? null : datum.id);\n } : undefined}\n onKeyDown={chart.interactive ? event => {\n if (isComposingKeyEvent(event.nativeEvent)) {\n return;\n }\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (!event.repeat) {\n chart.select(selected ? null : datum.id);\n }\n } else if (event.key === \"Escape\") {\n chart.dismiss();\n chart.select(null);\n }\n } : undefined}\n >\n {children}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace BarSeries\n * @description Bar Series\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport { DatumMark } from \"../shared/datum-mark\";\nimport type { CSSProperties, FC } from \"react\";\n\nexport type BarSeriesProps = {\n readonly color?: CSSProperties[\"color\"];\n readonly selectedColor?: CSSProperties[\"color\"];\n readonly width?: number;\n readonly widthRatio?: number;\n readonly gap?: number;\n readonly opacity?: number;\n readonly inactiveOpacity?: number;\n};\n\nexport const BarSeries: FC<BarSeriesProps> = (props: BarSeriesProps) => {\n const { color = \"var(--gridui-chart-series)\", selectedColor = \"var(--gridui-chart-selected)\", width, widthRatio = 0.7, gap = 4, opacity = 1, inactiveOpacity = 0.45 } = props;\n\n const chart = useChart();\n const plot = usePlot();\n if (chart.kind !== \"bar\") {\n throw new Error(\"BarSeries requires BarChart.\");\n }\n const invalidWidth = width !== undefined && (!Number.isFinite(width) || width <= 0);\n if (!Number.isFinite(widthRatio) || widthRatio <= 0 || widthRatio > 1 || !Number.isFinite(gap) || gap < 0 || invalidWidth) {\n throw new RangeError(\"Bar width must be positive, its ratio at most one, and gap nonnegative.\");\n }\n const thickness = Math.min(width ?? plot.band * widthRatio, Math.max(Math.min(1, plot.band), plot.band - gap));\n const baseline = plot.value(0);\n return (<g>\n {chart.data.map(datum => {\n if (datum.y === null) {\n return null;\n }\n const at = plot.category(datum);\n const end = plot.value(datum.y);\n const selected = chart.selectedId === datum.id;\n return (<DatumMark\n key={datum.id}\n datum={datum}\n >\n <rect\n className=\"gridui-chart-hit\"\n x={chart.horizontal ? plot.left : at - plot.band / 2}\n y={chart.horizontal ? at - plot.band / 2 : plot.top}\n width={chart.horizontal ? plot.right - plot.left : plot.band}\n height={chart.horizontal ? plot.band : plot.bottom - plot.top}\n fill=\"transparent\"\n />\n <rect\n x={chart.horizontal ? Math.min(end, baseline) : at - thickness / 2}\n y={chart.horizontal ? at - thickness / 2 : Math.min(end, baseline)}\n width={chart.horizontal ? Math.abs(end - baseline) : thickness}\n height={chart.horizontal ? thickness : Math.abs(end - baseline)}\n fill={selected ? selectedColor : color}\n opacity={chart.selectedId && !selected ? inactiveOpacity : opacity}\n pointerEvents=\"none\"\n />\n </DatumMark>);\n })}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartCursor\n * @description Chart Cursor\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport type { CSSProperties, FC } from \"react\";\n\nexport type ChartCursorProps = {\n readonly color?: CSSProperties[\"color\"];\n readonly strokeWidth?: number;\n readonly dashArray?: string;\n};\nexport const ChartCursor: FC<ChartCursorProps> = (props: ChartCursorProps) => {\n const { color = \"var(--gridui-chart-axis)\", strokeWidth = 1, dashArray = \"3 3\" } = props;\n\n const chart = useChart();\n const plot = usePlot();\n const datum = chart.data.find(item => {\n return item.id === (chart.activeId ?? chart.selectedId);\n });\n if (!datum || datum.y === null) {\n return null;\n }\n const at = plot.category(datum);\n return (<line\n aria-hidden=\"true\"\n pointerEvents=\"none\"\n x1={chart.horizontal ? plot.left : at}\n x2={chart.horizontal ? plot.right : at}\n y1={chart.horizontal ? at : plot.top}\n y2={chart.horizontal ? at : plot.bottom}\n stroke={color}\n strokeWidth={strokeWidth}\n strokeDasharray={dashArray}\n />);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Ticks\n */\n\nimport type { ChartState, PlotState } from \"./context\";\nimport { numericX, valueTicks } from \"./model\";\nimport type { ChartDatum, ChartTickOptions } from \"./types\";\n\nexport type ChartTick = {\n readonly key: string;\n readonly value: ChartDatum[\"x\"];\n readonly at: number;\n};\n\nexport const axisTicks = (chart: Pick<ChartState, \"data\" | \"horizontal\" | \"scale\" | \"domain\">, plot: PlotState, axis: \"x\" | \"y\", options: ChartTickOptions): readonly ChartTick[] => {\n const { tickCount, tickValues } = options;\n if (tickCount !== undefined && (!Number.isSafeInteger(tickCount) || tickCount < 2)) {\n throw new RangeError(\"Chart tickCount must be an integer of at least two.\");\n }\n const dataAxis = (axis === \"x\") !== chart.horizontal;\n const first = chart.data[0];\n const last = chart.data.at(-1);\n if (dataAxis && (!first || !last)) {\n return [];\n }\n if (dataAxis && chart.scale === \"category\") {\n const requested = tickValues && new Set(tickValues.map(value => {\n return value instanceof Date ? value.getTime() : value;\n }));\n const candidates = chart.data.filter(datum => {\n return !requested || requested.has(datum.x instanceof Date ? datum.x.getTime() : datum.x);\n });\n const indices = tickCount !== undefined && !requested && candidates.length > tickCount\n ? new Set(Array.from({ length: tickCount }, (_, index) => {\n return Math.round(index * (candidates.length - 1) / (tickCount - 1));\n })) : null;\n return candidates.flatMap((datum, index) => {\n return indices && !indices.has(index) ? [] : [\n {\n key: datum.id,\n value: datum.x,\n at: plot.category(datum),\n },\n ];\n });\n }\n const low = dataAxis && first ? numericX(first.x, chart.scale) : chart.domain[0];\n const high = dataAxis && last ? numericX(last.x, chart.scale) : chart.domain[1];\n const count = tickCount ?? 5;\n const generated = low === high ? [low] : Array.from({ length: count }, (_, index) => {\n return low + (high - low) * index / (count - 1);\n });\n const defaults = dataAxis ? chart.data.map(datum => {\n return datum.x;\n }) : valueTicks(chart.domain);\n const values = tickValues ?? (tickCount !== undefined ? generated : defaults);\n const seen = new Set<number>();\n return values.flatMap(value => {\n const number = numericX(value, dataAxis ? chart.scale : \"linear\");\n if (number < low || number > high || seen.has(number)) {\n return [];\n }\n seen.add(number);\n const formattedValue = dataAxis && chart.scale === \"time\" ? new Date(number) : number;\n return [\n {\n key: String(number),\n value: formattedValue,\n at: dataAxis ? plot.category({\n id: \"\",\n x: formattedValue,\n y: null,\n }) : plot.value(number),\n },\n ];\n }).sort((a, b) => {\n return a.at - b.at;\n });\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartGrid\n * @description Chart Grid\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport { axisTicks } from \"../shared/ticks\";\nimport type { ChartTickOptions } from \"../shared/types\";\nimport type { CSSProperties, FC } from \"react\";\n\nexport type ChartGridProps = {\n readonly xTicks?: ChartTickOptions;\n readonly yTicks?: ChartTickOptions;\n readonly horizontal?: boolean;\n readonly vertical?: boolean;\n readonly color?: CSSProperties[\"color\"];\n readonly strokeWidth?: number;\n readonly dashArray?: string;\n};\nexport const ChartGrid: FC<ChartGridProps> = (props: ChartGridProps) => {\n const { xTicks = {}, yTicks = {}, horizontal = true, vertical = false, color = \"var(--gridui-chart-grid)\", strokeWidth = 1, dashArray } = props;\n\n const chart = useChart();\n const plot = usePlot();\n const x = axisTicks(chart, plot, \"x\", xTicks);\n const y = axisTicks(chart, plot, \"y\", yTicks);\n return (<g\n className=\"gridui-chart-grid\"\n aria-hidden=\"true\"\n pointerEvents=\"none\"\n stroke={color}\n strokeWidth={strokeWidth}\n strokeDasharray={dashArray}\n >\n {horizontal && y.map(({ at }, index) => {\n return (<line\n key={`h-${index}`}\n x1={plot.left}\n x2={plot.right}\n y1={at}\n y2={at}\n />);\n })}\n {vertical && x.map(({ at }, index) => {\n return (<line\n key={`v-${index}`}\n x1={at}\n x2={at}\n y1={plot.top}\n y2={plot.bottom}\n />);\n })}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartPlot\n * @description Chart Plot\n */\n\nimport { PlotContext, useChart } from \"../shared/context\";\nimport { numericX } from \"../shared/model\";\nimport type { ChartDatum } from \"../shared/types\";\nimport type { CSSProperties, FC, ReactNode } from \"react\";\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\n\nexport type ChartPlotProps = {\n readonly children: ReactNode;\n readonly background?: CSSProperties[\"fill\"];\n readonly padding?: Partial<Record<\"top\" | \"right\" | \"bottom\" | \"left\", number>>;\n};\n\nexport const ChartPlot: FC<ChartPlotProps> = (props: ChartPlotProps) => {\n const { children, background = \"var(--gridui-chart-background)\", padding } = props;\n\n const chart = useChart();\n const ref = useRef<HTMLDivElement>(null);\n const [\n width,\n setWidth,\n ] = useState(640);\n const descriptionId = useId();\n useEffect(() => {\n const element = ref.current;\n if (!element) {\n return;\n }\n const observer = new ResizeObserver(entries => {\n const measured = entries[0]?.contentRect.width;\n if (measured && measured > 0) {\n setWidth(measured);\n }\n });\n observer.observe(element);\n return () => {\n return void observer.disconnect();\n };\n }, []);\n const inset = {\n left: padding?.left ?? (chart.horizontal ? 88 : 56),\n right: padding?.right ?? 24,\n top: padding?.top ?? 28,\n bottom: padding?.bottom ?? 48,\n };\n if (Object.values(inset).some(value => {\n return !Number.isFinite(value) || value < 0;\n })) {\n throw new RangeError(\"Chart padding must be finite and nonnegative.\");\n }\n const left = Math.min(width, inset.left);\n const right = Math.max(left, width - inset.right);\n const top = Math.min(chart.height, inset.top);\n const bottom = Math.max(top, chart.height - inset.bottom);\n const drawable = right > left && bottom > top;\n const plot = useMemo(() => {\n const extent = Math.max(1, chart.horizontal ? bottom - top : right - left);\n const start = chart.horizontal ? top : left;\n const count = chart.data.length;\n const band = extent / Math.max(1, count);\n const first = chart.data[0];\n const last = chart.data[count - 1];\n const low = first && chart.scale !== \"category\" ? numericX(first.x, chart.scale) : 0;\n const high = last && chart.scale !== \"category\" ? numericX(last.x, chart.scale) : 0;\n const indices = new Map(chart.data.map((datum, index) => {\n return [\n datum.id,\n index,\n ];\n }));\n const category = (datum: ChartDatum) => {\n const index = indices.get(datum.id) ?? 0;\n if (chart.scale !== \"category\") {\n return start + (high === low ? extent / 2 : (numericX(datum.x, chart.scale) - low) / (high - low) * extent);\n }\n const linePosition = count < 2 ? extent / 2 : index * extent / (count - 1);\n return start + (chart.kind === \"bar\" ? (index + 0.5) * band : linePosition);\n };\n const value = (number: number) => {\n const ratio = (number - chart.domain[0]) / (chart.domain[1] - chart.domain[0]);\n return chart.horizontal ? left + ratio * Math.max(1, right - left) : bottom - ratio * Math.max(1, bottom - top);\n };\n return {\n width,\n height: chart.height,\n left,\n right,\n top,\n bottom,\n band,\n category,\n value,\n };\n }, [\n chart.data,\n chart.domain,\n chart.height,\n chart.horizontal,\n chart.kind,\n chart.scale,\n bottom,\n left,\n right,\n top,\n width,\n ]);\n return (<div\n ref={ref}\n className=\"gridui-chart-plot\"\n >\n <svg\n width=\"100%\"\n height={chart.height}\n viewBox={`0 0 ${width} ${chart.height}`}\n role={chart.interactive ? \"group\" : \"img\"}\n aria-label={chart.label}\n aria-describedby={descriptionId}\n >\n <desc\n id={descriptionId}\n >\n {chart.data.map(chart.formatDatum).join(\"; \")}\n </desc>\n <rect\n x={left}\n y={top}\n width={Math.max(0, right - left)}\n height={Math.max(0, bottom - top)}\n fill={background}\n pointerEvents=\"none\"\n />\n <PlotContext\n value={plot}\n >\n {drawable ? children : null}\n </PlotContext>\n </svg>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Use Measured Layout\n */\n\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nexport type TextBounds = Pick<DOMRect, \"x\" | \"y\" | \"width\" | \"height\">;\nexport type MeasureText = (text: string) => TextBounds;\n\n// The empty SVG text ref is an imperative measurement surface, never visible content.\nexport const useMeasuredLayout = <T>(calculate: (measure: MeasureText) => T) => {\n const ref = useRef<SVGTextElement>(null);\n const [\n result,\n setResult,\n ] = useState<{\n calculate: typeof calculate;\n value: T;\n } | null>(null);\n useLayoutEffect(() => {\n const node = ref.current;\n if (!node) {\n return;\n }\n let disposed = false;\n const update = () => {\n if (disposed) {\n return;\n }\n const cache = new Map<string, TextBounds>();\n const value = calculate(text => {\n const cached = cache.get(text);\n if (cached) {\n return cached;\n }\n node.textContent = text;\n const box = node.getBBox();\n const bounds = {\n x: box.x,\n y: box.y,\n width: box.width,\n height: box.height,\n };\n cache.set(text, bounds);\n return bounds;\n });\n // A stable probe lets ResizeObserver detect inherited font changes.\n node.textContent = \"M\";\n setResult({\n calculate,\n value,\n });\n };\n update();\n const observer = new ResizeObserver(update);\n observer.observe(node);\n const fonts = node.ownerDocument.fonts;\n void fonts.ready.then(update);\n fonts.addEventListener(\"loadingdone\", update);\n return () => {\n disposed = true;\n observer.disconnect();\n fonts.removeEventListener(\"loadingdone\", update);\n };\n }, [calculate]);\n return {\n ref,\n layout: result?.calculate === calculate ? result.value : undefined,\n };\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartTooltip\n * @description Layout\n */\n\nimport type { PlotState } from \"../shared/context\";\nimport type { ChartDatum } from \"../shared/types\";\nimport type { MeasureText } from \"../shared/use-measured-layout\";\n\ntype TooltipLayout = {\n readonly lines: readonly {\n readonly text: string;\n readonly x: number;\n readonly y: number;\n }[];\n readonly width: number;\n readonly height: number;\n};\n\nconst PLOT_INSET = 4;\nconst POINT_GAP = 12;\nconst PADDING_INLINE = 10;\nconst PADDING_TOP = 8;\nconst PADDING_BOTTOM = 4;\nconst LINE_GAP = 4;\nconst MIN_LINE_HEIGHT = 18;\n\nconst fittingGraphemeCount = (segments: readonly string[], start: number, availableWidth: number, measure: MeasureText): number => {\n // Always consume one grapheme, even when it is wider than the available space.\n let low = 1;\n let high = segments.length - start;\n while (low < high) {\n const count = Math.ceil((low + high) / 2);\n if (measure(segments.slice(start, start + count).join(\"\")).width <= availableWidth) {\n low = count;\n } else {\n high = count - 1;\n }\n }\n return low;\n};\n\nconst wrapTooltipText = (text: string, availableWidth: number, measure: MeasureText): string[] => {\n const lines: string[] = [];\n const segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n for (const paragraph of text.split(\"\\n\")) {\n const segments = Array.from(segmenter.segment(paragraph), part => {\n return part.segment;\n });\n if (!segments.length) {\n lines.push(\"\");\n }\n let start = 0;\n while (start < segments.length) {\n let count = fittingGraphemeCount(segments, start, availableWidth, measure);\n if (start + count < segments.length) {\n const wordBreak = segments.slice(start, start + count).reduce((last, segment, index) => {\n return /\\s/u.test(segment) ? index : last;\n }, -1);\n if (wordBreak > 0) {\n count = wordBreak + 1;\n }\n }\n lines.push(segments.slice(start, start + count).join(\"\"));\n start += count;\n }\n }\n return lines;\n};\n\nexport const calculateTooltipLayout = (text: string | null, plotWidth: number, measure: MeasureText): TooltipLayout | null => {\n if (text === null) {\n return null;\n }\n const availableWidth = Math.max(1, plotWidth - 2 * (PLOT_INSET + PADDING_INLINE));\n const lines = wrapTooltipText(text, availableWidth, measure);\n const bounds = lines.map(measure);\n const lineHeight = Math.max(MIN_LINE_HEIGHT, ...bounds.map(box => {\n return box.height + LINE_GAP;\n }));\n return {\n lines: lines.map((line, index) => {\n const box = bounds[index];\n return {\n text: line,\n x: PADDING_INLINE - (box?.x ?? 0),\n y: PADDING_TOP + index * lineHeight - (box?.y ?? 0),\n };\n }),\n width: Math.max(PADDING_INLINE * 2, ...bounds.map(box => {\n return box.width + PADDING_INLINE * 2;\n })),\n height: lines.length * lineHeight + PADDING_TOP + PADDING_BOTTOM,\n };\n};\n\ntype TooltipPositionOptions = {\n readonly datum: ChartDatum | undefined;\n readonly horizontal: boolean;\n readonly plot: Pick<PlotState, \"width\" | \"height\" | \"category\" | \"value\">;\n readonly width: number;\n readonly height: number;\n};\n\nexport const calculateTooltipPosition = (options: TooltipPositionOptions): {\n readonly x: number;\n readonly y: number;\n} => {\n const { datum, horizontal, plot, width, height } = options;\n let pointX = 0;\n let pointY = 0;\n if (datum && datum.y !== null) {\n if (horizontal) {\n pointX = plot.value(datum.y);\n pointY = plot.category(datum);\n } else {\n pointX = plot.category(datum);\n pointY = plot.value(datum.y);\n }\n }\n return {\n x: Math.max(PLOT_INSET, Math.min(plot.width - width - PLOT_INSET, pointX - width / 2)),\n y: Math.max(PLOT_INSET, Math.min(plot.height - height - PLOT_INSET, pointY - height - POINT_GAP)),\n };\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartTooltip\n * @description Chart Tooltip\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport type { ChartDatum } from \"../shared/types\";\nimport { type MeasureText, useMeasuredLayout } from \"../shared/use-measured-layout\";\nimport { calculateTooltipLayout, calculateTooltipPosition } from \"./layout\";\nimport type { CSSProperties, FC } from \"react\";\nimport { useCallback } from \"react\";\n\nexport type ChartTooltipProps = {\n readonly format?: (datum: ChartDatum) => string;\n readonly background?: CSSProperties[\"color\"];\n readonly color?: CSSProperties[\"color\"];\n};\nexport const ChartTooltip: FC<ChartTooltipProps> = (props: ChartTooltipProps) => {\n const { format, background = \"var(--gridui-background)\", color = \"var(--gridui-foreground)\" } = props;\n\n const chart = useChart();\n const plot = usePlot();\n const datum = chart.data.find(item => {\n return item.id === chart.activeId;\n });\n const text = datum && datum.y !== null ? (format ?? chart.formatDatum)(datum) : null;\n const calculate = useCallback((measure: MeasureText) => {\n return calculateTooltipLayout(text, plot.width, measure);\n }, [\n text,\n plot.width,\n ]);\n const { ref, layout } = useMeasuredLayout(calculate);\n const { x, y } = calculateTooltipPosition({\n datum,\n horizontal: chart.horizontal,\n plot,\n width: layout?.width ?? 0,\n height: layout?.height ?? 0,\n });\n return (<g\n className={text === null ? undefined : \"gridui-chart-tooltip\"}\n aria-hidden=\"true\"\n pointerEvents=\"none\"\n fontSize={12}\n >\n <text\n ref={ref}\n visibility=\"hidden\"\n />\n {layout && (<g\n transform={`translate(${x} ${y})`}\n >\n <rect\n width={layout.width}\n height={layout.height}\n fill={background}\n stroke=\"var(--gridui-border)\"\n />\n <text\n fill={color}\n >\n {layout.lines.map((line, index) => {\n return (<tspan\n key={index}\n x={line.x}\n y={line.y}\n >\n {line.text}\n </tspan>);\n })}\n </text>\n </g>)}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartValueLabels\n * @description Layout\n */\n\nimport type { PlotState } from \"../shared/context\";\nimport type { ChartDatum } from \"../shared/types\";\nimport type { MeasureText, TextBounds } from \"../shared/use-measured-layout\";\n\ntype ValueLabelLayoutOptions = {\n readonly data: readonly ChartDatum[];\n readonly selectedId: string | null;\n readonly horizontal: boolean;\n readonly plot: Pick<PlotState, \"width\" | \"height\" | \"category\" | \"value\">;\n readonly visibility: \"all\" | \"selected\" | \"none\";\n readonly position: \"end\" | \"center\";\n readonly format: (value: number, datum: ChartDatum) => string;\n readonly offset: number;\n readonly measure: MeasureText;\n};\n\ntype ValueLabel = {\n readonly id: string;\n readonly text: string;\n readonly x: number;\n readonly y: number;\n};\n\nconst PLOT_INSET = 2;\nconst LABEL_GAP = 4;\n\nconst labelsOverlap = (left: TextBounds, right: TextBounds): boolean => {\n return left.x < right.x + right.width + LABEL_GAP\n && left.x + left.width + LABEL_GAP > right.x\n && left.y < right.y + right.height + LABEL_GAP\n && left.y + left.height + LABEL_GAP > right.y;\n};\n\nexport const calculateValueLabelLayout = (options: ValueLabelLayoutOptions): ValueLabel[] => {\n const { data, selectedId, horizontal, plot, visibility, position, format, offset, measure } = options;\n const occupied: TextBounds[] = [];\n const labels: ValueLabel[] = [];\n for (const datum of data) {\n if (visibility === \"none\" || datum.y === null || visibility === \"selected\" && datum.id !== selectedId) {\n continue;\n }\n const text = format(datum.y, datum);\n const box = measure(text);\n if (box.width > plot.width - PLOT_INSET * 2 || box.height > plot.height - PLOT_INSET * 2) {\n continue;\n }\n\n const categoryPosition = plot.category(datum);\n let valuePosition = plot.value(datum.y);\n if (position === \"center\") {\n valuePosition = (valuePosition + plot.value(0)) / 2;\n }\n let centerX = categoryPosition;\n let centerY = valuePosition;\n if (horizontal) {\n centerX = valuePosition;\n centerY = categoryPosition;\n }\n if (position === \"end\") {\n if (horizontal) {\n const direction = datum.y < 0 ? -1 : 1;\n centerX += direction * (offset + box.width / 2);\n } else {\n centerY -= Math.sign(datum.y || 1) * offset;\n }\n }\n\n const bounds: TextBounds = {\n x: Math.max(PLOT_INSET, Math.min(plot.width - box.width - PLOT_INSET, centerX - box.width / 2)),\n y: Math.max(PLOT_INSET, Math.min(plot.height - box.height - PLOT_INSET, centerY - box.height / 2)),\n width: box.width,\n height: box.height,\n };\n if (occupied.some(other => {\n return labelsOverlap(bounds, other);\n })) {\n continue;\n }\n occupied.push(bounds);\n labels.push({\n id: datum.id,\n text,\n x: bounds.x - box.x,\n y: bounds.y - box.y,\n });\n }\n return labels;\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartValueLabels\n * @description Chart Value Labels\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport type { ChartDatum } from \"../shared/types\";\nimport { type MeasureText, useMeasuredLayout } from \"../shared/use-measured-layout\";\nimport { calculateValueLabelLayout } from \"./layout\";\nimport type { CSSProperties, FC } from \"react\";\nimport { useCallback } from \"react\";\n\nexport type ChartValueLabelsProps = {\n readonly visibility?: \"all\" | \"selected\" | \"none\";\n readonly position?: \"end\" | \"center\";\n readonly format?: (value: number, datum: ChartDatum) => string;\n readonly color?: CSSProperties[\"color\"];\n readonly fontSize?: number;\n readonly offset?: number;\n};\n\nexport const ChartValueLabels: FC<ChartValueLabelsProps> = (props: ChartValueLabelsProps) => {\n const { visibility = \"selected\", position = \"end\", format = String, color = \"var(--gridui-chart-value)\", fontSize = 12, offset = 12 } = props;\n\n const chart = useChart();\n const plot = usePlot();\n const calculate = useCallback((measure: MeasureText) => {\n return calculateValueLabelLayout({\n data: chart.data,\n selectedId: chart.selectedId,\n horizontal: chart.horizontal,\n plot,\n visibility,\n position,\n format,\n offset,\n measure,\n });\n }, [\n chart,\n plot,\n visibility,\n position,\n format,\n offset,\n ]);\n const { ref, layout } = useMeasuredLayout(calculate);\n return (<g\n className=\"gridui-chart-values\"\n aria-hidden=\"true\"\n pointerEvents=\"none\"\n fill={color}\n fontSize={fontSize}\n >\n <text\n ref={ref}\n visibility=\"hidden\"\n />\n {layout?.map(label => {\n return (<text\n key={label.id}\n x={label.x}\n y={label.y}\n >\n {label.text}\n </text>);\n })}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace Shared\n * @description Axis\n */\n\nimport { useChart, usePlot } from \"./context\";\nimport { axisTicks } from \"./ticks\";\nimport type { ChartAxisOptions } from \"./types\";\nimport { type MeasureText, useMeasuredLayout } from \"./use-measured-layout\";\nimport type { FC } from \"react\";\nimport { useCallback, useMemo } from \"react\";\n\nexport type AxisProps = ChartAxisOptions & {\n readonly axis: \"x\" | \"y\";\n readonly position: \"start\" | \"end\";\n};\n\nexport const Axis: FC<AxisProps> = (props: AxisProps) => {\n const { axis, position, line = true, ticks = true, labels = true, title, tickFormat, tickCount, tickValues, color = \"var(--gridui-chart-axis)\", strokeWidth = 1, labelColor = \"var(--gridui-chart-label)\", fontSize = 12 } = props;\n\n const chart = useChart();\n const plot = usePlot();\n const { data, horizontal, scale, domain } = chart;\n const isX = axis === \"x\";\n const xEdge = position === \"start\" ? plot.top : plot.bottom;\n const yEdge = position === \"start\" ? plot.left : plot.right;\n const edge = isX ? xEdge : yEdge;\n const titleX = position === \"start\" ? 12 : plot.width - 12;\n const titleY = position === \"start\" ? 12 : plot.height - 2;\n const sign = position === \"start\" ? -1 : 1;\n const all = useMemo(() => {\n return axisTicks({\n data,\n horizontal,\n scale,\n domain,\n }, plot, axis, {\n ...(tickCount === undefined ? {} : { tickCount }),\n ...(tickValues === undefined ? {} : { tickValues }),\n });\n }, [\n data,\n horizontal,\n scale,\n domain,\n plot,\n axis,\n tickCount,\n tickValues,\n ]);\n const calculate = useCallback((measure: MeasureText) => {\n const occupied: {\n x: number;\n y: number;\n width: number;\n height: number;\n }[] = [];\n const shown = new Map<string, {\n text: string;\n x: number;\n y: number;\n }>();\n const ordered = all.length > 1 ? [\n all[0]!,\n all.at(-1)!,\n ...all.slice(1, -1),\n ] : all;\n for (const tick of ordered) {\n const defaultText = tick.value instanceof Date ? tick.value.toISOString().slice(0, 10) : String(tick.value);\n const text = tickFormat ? tickFormat(tick.value) : defaultText;\n const box = measure(text);\n if (box.width > plot.width - 4 || box.height > plot.height - 4) {\n continue;\n }\n const outsideX = position === \"start\" ? edge - 9 - box.width : edge + 9;\n const outsideY = position === \"start\" ? edge - 9 - box.height : edge + 9;\n const originX = isX ? tick.at - box.width / 2 : outsideX;\n const originY = isX ? outsideY : tick.at - box.height / 2;\n const x = Math.max(2, Math.min(plot.width - box.width - 2, originX));\n const y = Math.max(2, Math.min(plot.height - box.height - 2, originY));\n if (occupied.some(other => {\n return x < other.x + other.width + 4 && x + box.width + 4 > other.x && y < other.y + other.height + 4 && y + box.height + 4 > other.y;\n })) {\n continue;\n }\n occupied.push({\n x,\n y,\n width: box.width,\n height: box.height,\n });\n shown.set(tick.key, {\n text,\n x: x - box.x,\n y: y - box.y,\n });\n }\n return shown;\n }, [\n all,\n tickFormat,\n plot.width,\n plot.height,\n isX,\n position,\n edge,\n ]);\n const { ref, layout } = useMeasuredLayout(calculate);\n return (<g\n aria-hidden=\"true\"\n className=\"gridui-chart-axis\"\n data-axis={axis}\n >\n {line && (<line\n x1={isX ? plot.left : edge}\n y1={isX ? edge : plot.top}\n x2={isX ? plot.right : edge}\n y2={isX ? edge : plot.bottom}\n stroke={color}\n strokeWidth={strokeWidth}\n />)}\n <text\n ref={ref}\n visibility=\"hidden\"\n pointerEvents=\"none\"\n fontSize={fontSize}\n />\n {all.map(tick => {\n const label = layout?.get(tick.key);\n return (<g\n key={tick.key}\n >\n {ticks && (<line\n x1={isX ? tick.at : edge}\n y1={isX ? edge : tick.at}\n x2={isX ? tick.at : edge + sign * 4}\n y2={isX ? edge + sign * 4 : tick.at}\n stroke={color}\n strokeWidth={strokeWidth}\n />)}\n {labels && label && (<text\n x={label.x}\n y={label.y}\n fill={labelColor}\n fontSize={fontSize}\n >\n {label.text}\n </text>)}\n </g>);\n })}\n {title && (<text\n x={isX ? (plot.left + plot.right) / 2 : titleX}\n y={isX ? titleY : (plot.top + plot.bottom) / 2}\n transform={isX ? undefined : `rotate(-90 ${position === \"start\" ? 12 : plot.width - 12} ${(plot.top + plot.bottom) / 2})`}\n textAnchor=\"middle\"\n fill={labelColor}\n fontSize={fontSize}\n >\n {title}\n </text>)}\n </g>);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartXAxis\n * @description Chart X Axis\n */\n\nimport { Axis } from \"../shared/axis\";\nimport type { ChartAxisOptions } from \"../shared/types\";\nimport type { FC } from \"react\";\n\nexport type ChartXAxisProps = ChartAxisOptions & {\n readonly position?: \"top\" | \"bottom\";\n};\nexport const ChartXAxis: FC<ChartXAxisProps> = (props: ChartXAxisProps) => {\n const { position = \"bottom\", ...restProps } = props;\n\n return (<Axis\n {...restProps}\n axis=\"x\"\n position={position === \"top\" ? \"start\" : \"end\"}\n />);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace ChartYAxis\n * @description Chart Y Axis\n */\n\nimport { Axis } from \"../shared/axis\";\nimport type { ChartAxisOptions } from \"../shared/types\";\nimport type { FC } from \"react\";\n\nexport type ChartYAxisProps = ChartAxisOptions & {\n readonly position?: \"left\" | \"right\";\n};\nexport const ChartYAxis: FC<ChartYAxisProps> = (props: ChartYAxisProps) => {\n const { position = \"left\", ...restProps } = props;\n\n return (<Axis\n {...restProps}\n axis=\"y\"\n position={position === \"left\" ? \"start\" : \"end\"}\n />);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace LineChart\n * @description Line Chart\n */\n\nimport { ChartRoot } from \"../shared/chart-root\";\nimport type { ChartOptions, ChartScale } from \"../shared/types\";\nimport type { FC } from \"react\";\n\nexport type LineChartProps = ChartOptions & {\n readonly xScale?: ChartScale;\n};\n\nexport const LineChart: FC<LineChartProps> = (props: LineChartProps) => {\n const { xScale = \"category\", ...restProps } = props;\n\n return (<ChartRoot\n {...restProps}\n kind=\"line\"\n horizontal={false}\n scale={xScale}\n />);\n};\n", "/**\n * @author WMXPY\n * @package GridUI\n * @namespace LineSeries\n * @description Line Series\n */\n\nimport { useChart, usePlot } from \"../shared/context\";\nimport { DatumMark } from \"../shared/datum-mark\";\nimport { linePath } from \"../shared/model\";\nimport type { ChartPointOptions } from \"../shared/types\";\nimport type { CSSProperties, FC } from \"react\";\n\nexport type LineSeriesProps = {\n readonly color?: CSSProperties[\"color\"];\n readonly strokeWidth?: number;\n readonly dashArray?: string;\n readonly points?: ChartPointOptions;\n readonly selectedColor?: CSSProperties[\"color\"];\n};\n\nexport const LineSeries: FC<LineSeriesProps> = (props: LineSeriesProps) => {\n const { color = \"var(--gridui-chart-series)\", strokeWidth = 2, dashArray, points, selectedColor = \"var(--gridui-chart-selected)\" } = props;\n\n const chart = useChart();\n const plot = usePlot();\n if (chart.kind !== \"line\") {\n throw new Error(\"LineSeries requires LineChart.\");\n }\n const size = points?.size ?? 5;\n const shape = points?.shape ?? \"none\";\n return (<g>\n <path\n d={linePath(chart.data, plot.category, plot.value)}\n fill=\"none\"\n stroke={color}\n strokeWidth={strokeWidth}\n strokeDasharray={dashArray}\n strokeLinejoin=\"miter\"\n pointerEvents=\"none\"\n />\n {chart.data.map((datum, index) => {\n if (datum.y === null) {\n return null;\n }\n const selected = chart.selectedId === datum.id;\n const isolated = (chart.data[index - 1]?.y ?? null) === null && (chart.data[index + 1]?.y ?? null) === null;\n const visible = shape !== \"none\" || selected || isolated;\n const markSize = selected ? Math.max(8, size) : size;\n const pointColor = selected ? selectedColor : points?.color ?? color;\n const fill = points?.fill === \"hollow\" && !selected ? \"var(--gridui-chart-point-background)\" : pointColor;\n const x = plot.category(datum);\n const y = plot.value(datum.y);\n const previous = chart.data[index - 1];\n const next = chart.data[index + 1];\n const start = previous ? (plot.category(previous) + x) / 2 : plot.left;\n const end = next ? (plot.category(next) + x) / 2 : plot.right;\n return (<DatumMark\n key={datum.id}\n datum={datum}\n >\n <rect\n className=\"gridui-chart-hit\"\n x={start}\n y={plot.top}\n width={Math.max(1, end - start)}\n height={plot.bottom - plot.top}\n fill=\"transparent\"\n />\n {visible && (shape === \"square\" ? (<rect\n x={x - markSize / 2}\n y={y - markSize / 2}\n width={markSize}\n height={markSize}\n fill={fill}\n stroke={selected ? selectedColor : points?.color ?? color}\n strokeWidth={points?.strokeWidth ?? 1.5}\n pointerEvents=\"none\"\n />) : (<circle\n cx={x}\n cy={y}\n r={markSize / 2}\n fill={fill}\n stroke={selected ? selectedColor : points?.color ?? color}\n strokeWidth={points?.strokeWidth ?? 1.5}\n pointerEvents=\"none\"\n />))}\n </DatumMark>);\n })}\n </g>);\n};\n"],
|
|
5
|
+
"mappings": ";AAQA,SAAS,eAAe,kBAAkB;AAmBnC,IAAM,eAAe,cAAiC,IAAI;AAC1D,IAAM,WAAW,MAAkB;AACtC,QAAM,QAAQ,WAAW,YAAY;AACrC,MAAI,CAAC,OAAO;AACR,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAClE;AACA,SAAO;AACX;AAaO,IAAM,cAAc,cAAgC,IAAI;AACxD,IAAM,UAAU,MAAiB;AACpC,QAAM,QAAQ,WAAW,WAAW;AACpC,MAAI,CAAC,OAAO;AACR,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AACA,SAAO;AACX;;;AC7CO,IAAM,WAAW,CAAC,OAAwB,UAA8B;AAC3E,QAAM,SAAS,UAAU,UAAU,OAAO,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useCallback", "useMemo", "jsx", "jsxs", "jsx", "jsx", "jsx", "jsx", "jsxs"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace LineChart
|
|
5
|
+
* @description Line Chart
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartOptions, ChartScale } from "../shared/types";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type LineChartProps = ChartOptions & {
|
|
10
|
+
readonly xScale?: ChartScale;
|
|
11
|
+
};
|
|
12
|
+
export declare const LineChart: FC<LineChartProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace LineSeries
|
|
5
|
+
* @description Line Series
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartPointOptions } from "../shared/types";
|
|
8
|
+
import type { CSSProperties, FC } from "react";
|
|
9
|
+
export type LineSeriesProps = {
|
|
10
|
+
readonly color?: CSSProperties["color"];
|
|
11
|
+
readonly strokeWidth?: number;
|
|
12
|
+
readonly dashArray?: string;
|
|
13
|
+
readonly points?: ChartPointOptions;
|
|
14
|
+
readonly selectedColor?: CSSProperties["color"];
|
|
15
|
+
};
|
|
16
|
+
export declare const LineSeries: FC<LineSeriesProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Axis
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartAxisOptions } from "./types";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type AxisProps = ChartAxisOptions & {
|
|
10
|
+
readonly axis: "x" | "y";
|
|
11
|
+
readonly position: "start" | "end";
|
|
12
|
+
};
|
|
13
|
+
export declare const Axis: FC<AxisProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Chart Root
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartOptions, ChartScale } from "./types";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type ChartRootProps = ChartOptions & {
|
|
10
|
+
readonly kind: "line" | "bar";
|
|
11
|
+
readonly horizontal: boolean;
|
|
12
|
+
readonly scale: ChartScale;
|
|
13
|
+
};
|
|
14
|
+
export declare const ChartRoot: FC<ChartRootProps>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Context
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartDatum, ChartScale } from "./types";
|
|
8
|
+
export type ChartState = {
|
|
9
|
+
readonly data: readonly ChartDatum[];
|
|
10
|
+
readonly kind: "line" | "bar";
|
|
11
|
+
readonly horizontal: boolean;
|
|
12
|
+
readonly scale: ChartScale;
|
|
13
|
+
readonly domain: readonly [number, number];
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
readonly selectedId: string | null;
|
|
17
|
+
readonly activeId: string | null;
|
|
18
|
+
readonly interactive: boolean;
|
|
19
|
+
readonly select: (id: string | null) => void;
|
|
20
|
+
readonly activate: (id: string | null, source: "pointer" | "focus") => void;
|
|
21
|
+
readonly dismiss: () => void;
|
|
22
|
+
readonly formatDatum: (datum: ChartDatum) => string;
|
|
23
|
+
};
|
|
24
|
+
export declare const ChartContext: import("react").Context<ChartState | null>;
|
|
25
|
+
export declare const useChart: () => ChartState;
|
|
26
|
+
export type PlotState = {
|
|
27
|
+
readonly width: number;
|
|
28
|
+
readonly height: number;
|
|
29
|
+
readonly left: number;
|
|
30
|
+
readonly right: number;
|
|
31
|
+
readonly top: number;
|
|
32
|
+
readonly bottom: number;
|
|
33
|
+
readonly band: number;
|
|
34
|
+
readonly category: (datum: ChartDatum) => number;
|
|
35
|
+
readonly value: (value: number) => number;
|
|
36
|
+
};
|
|
37
|
+
export declare const PlotContext: import("react").Context<PlotState | null>;
|
|
38
|
+
export declare const usePlot: () => PlotState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Datum Mark
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartDatum } from "./types";
|
|
8
|
+
import type { FC, ReactNode } from "react";
|
|
9
|
+
export type DatumMarkProps = {
|
|
10
|
+
readonly datum: ChartDatum;
|
|
11
|
+
readonly children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare const DatumMark: FC<DatumMarkProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Model
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartDatum, ChartScale } from "./types";
|
|
8
|
+
export declare const numericX: (value: ChartDatum["x"], scale: ChartScale) => number;
|
|
9
|
+
export declare const prepareData: (data: readonly ChartDatum[], scale: ChartScale) => readonly ChartDatum[];
|
|
10
|
+
export declare const valueDomain: (data: readonly ChartDatum[], explicit?: readonly [number, number]) => readonly [number, number];
|
|
11
|
+
export declare const valueTicks: (domain: readonly [number, number]) => readonly number[];
|
|
12
|
+
export declare const linePath: (data: readonly ChartDatum[], x: (datum: ChartDatum) => number, y: (value: number) => number) => string;
|
|
13
|
+
export declare const datumLabel: (datum: ChartDatum) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Ticks
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartState, PlotState } from "./context";
|
|
8
|
+
import type { ChartDatum, ChartTickOptions } from "./types";
|
|
9
|
+
export type ChartTick = {
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly value: ChartDatum["x"];
|
|
12
|
+
readonly at: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const axisTicks: (chart: Pick<ChartState, "data" | "horizontal" | "scale" | "domain">, plot: PlotState, axis: "x" | "y", options: ChartTickOptions) => readonly ChartTick[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Types
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, CSSProperties, ReactNode } from "react";
|
|
8
|
+
export type ChartDatum = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly x: string | number | Date;
|
|
11
|
+
readonly y: number | null;
|
|
12
|
+
};
|
|
13
|
+
export type ChartScale = "category" | "linear" | "time";
|
|
14
|
+
export type ChartOptions = Omit<ComponentPropsWithRef<"div">, "children" | "onSelect"> & {
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly data: readonly ChartDatum[];
|
|
17
|
+
readonly children: ReactNode;
|
|
18
|
+
readonly height?: number;
|
|
19
|
+
readonly yDomain?: readonly [number, number];
|
|
20
|
+
readonly selectedId?: string | null;
|
|
21
|
+
readonly defaultSelectedId?: string;
|
|
22
|
+
readonly onSelectionChange?: (id: string | null) => void;
|
|
23
|
+
readonly formatDatum?: (datum: ChartDatum) => string;
|
|
24
|
+
};
|
|
25
|
+
export type ChartTickOptions = {
|
|
26
|
+
readonly tickCount?: number;
|
|
27
|
+
readonly tickValues?: readonly ChartDatum["x"][];
|
|
28
|
+
};
|
|
29
|
+
export type ChartAxisOptions = ChartTickOptions & {
|
|
30
|
+
readonly line?: boolean;
|
|
31
|
+
readonly ticks?: boolean;
|
|
32
|
+
readonly labels?: boolean;
|
|
33
|
+
readonly title?: string;
|
|
34
|
+
readonly tickFormat?: (value: ChartDatum["x"]) => string;
|
|
35
|
+
readonly color?: CSSProperties["color"];
|
|
36
|
+
readonly strokeWidth?: number;
|
|
37
|
+
readonly labelColor?: CSSProperties["color"];
|
|
38
|
+
readonly fontSize?: number;
|
|
39
|
+
};
|
|
40
|
+
export type ChartPointOptions = {
|
|
41
|
+
readonly shape?: "none" | "square" | "circle";
|
|
42
|
+
readonly size?: number;
|
|
43
|
+
readonly fill?: "solid" | "hollow";
|
|
44
|
+
readonly color?: CSSProperties["color"];
|
|
45
|
+
readonly strokeWidth?: number;
|
|
46
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package GridUI
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Use Measured Layout
|
|
6
|
+
*/
|
|
7
|
+
export type TextBounds = Pick<DOMRect, "x" | "y" | "width" | "height">;
|
|
8
|
+
export type MeasureText = (text: string) => TextBounds;
|
|
9
|
+
export declare const useMeasuredLayout: <T>(calculate: (measure: MeasureText) => T) => {
|
|
10
|
+
ref: import("react").RefObject<SVGTextElement | null>;
|
|
11
|
+
layout: T | undefined;
|
|
12
|
+
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer theme, base, components, utilities;
|
|
3
|
+
@layer utilities;
|
|
4
|
+
@layer components {
|
|
5
|
+
.gridui-chart {
|
|
6
|
+
--gridui-chart-background: transparent;
|
|
7
|
+
--gridui-chart-grid: var(--gridui-border);
|
|
8
|
+
--gridui-chart-axis: var(--gridui-border);
|
|
9
|
+
--gridui-chart-label: var(--gridui-muted);
|
|
10
|
+
--gridui-chart-value: var(--gridui-foreground);
|
|
11
|
+
--gridui-chart-series: var(--gridui-accent-background);
|
|
12
|
+
--gridui-chart-selected: var(--gridui-accent-background);
|
|
13
|
+
--gridui-chart-point-background: var(--gridui-background);
|
|
14
|
+
min-width: 0;
|
|
15
|
+
font-family: var(--gridui-font-body);
|
|
16
|
+
}
|
|
17
|
+
.gridui-chart-plot {
|
|
18
|
+
width: 100%;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
}
|
|
21
|
+
.gridui-chart-plot > svg {
|
|
22
|
+
display: block;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
overflow: visible;
|
|
25
|
+
}
|
|
26
|
+
.gridui-chart-values, .gridui-chart-tooltip {
|
|
27
|
+
font-family: var(--gridui-font-mono);
|
|
28
|
+
font-variant-numeric: tabular-nums;
|
|
29
|
+
}
|
|
30
|
+
.gridui-chart-mark[role="button"] {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
.gridui-chart-mark:focus-visible > .gridui-chart-hit {
|
|
34
|
+
stroke: var(--gridui-focus-color);
|
|
35
|
+
stroke-width: 2;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"name": "@gridui/chart",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"category": "data",
|
|
6
|
+
"description": "Composable GridUI line and bar charts",
|
|
7
|
+
"usage": "Composable line and bar charts in the Data family. Import components from `@gridui/chart` and load `@gridui/chart/styles.css` after Theme.",
|
|
8
|
+
"documentation": [
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/bar-chart.md",
|
|
12
|
+
"docs/reference/bar-series.md",
|
|
13
|
+
"docs/reference/chart-cursor.md",
|
|
14
|
+
"docs/reference/chart-grid.md",
|
|
15
|
+
"docs/reference/chart-plot.md",
|
|
16
|
+
"docs/reference/chart-tooltip.md",
|
|
17
|
+
"docs/reference/chart-value-labels.md",
|
|
18
|
+
"docs/reference/chart-xaxis.md",
|
|
19
|
+
"docs/reference/chart-yaxis.md",
|
|
20
|
+
"docs/reference/line-chart.md",
|
|
21
|
+
"docs/reference/line-series.md"
|
|
22
|
+
],
|
|
23
|
+
"exports": [
|
|
24
|
+
{
|
|
25
|
+
"name": "BarChart",
|
|
26
|
+
"kind": "component",
|
|
27
|
+
"importPath": "@gridui/chart"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "BarChartProps",
|
|
31
|
+
"kind": "type",
|
|
32
|
+
"importPath": "@gridui/chart"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "BarSeries",
|
|
36
|
+
"kind": "component",
|
|
37
|
+
"importPath": "@gridui/chart"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "BarSeriesProps",
|
|
41
|
+
"kind": "type",
|
|
42
|
+
"importPath": "@gridui/chart"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "ChartCursor",
|
|
46
|
+
"kind": "component",
|
|
47
|
+
"importPath": "@gridui/chart"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "ChartCursorProps",
|
|
51
|
+
"kind": "type",
|
|
52
|
+
"importPath": "@gridui/chart"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "ChartDatum",
|
|
56
|
+
"kind": "type",
|
|
57
|
+
"importPath": "@gridui/chart"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "ChartGrid",
|
|
61
|
+
"kind": "component",
|
|
62
|
+
"importPath": "@gridui/chart"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "ChartGridProps",
|
|
66
|
+
"kind": "type",
|
|
67
|
+
"importPath": "@gridui/chart"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "ChartPlot",
|
|
71
|
+
"kind": "component",
|
|
72
|
+
"importPath": "@gridui/chart"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "ChartPlotProps",
|
|
76
|
+
"kind": "type",
|
|
77
|
+
"importPath": "@gridui/chart"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "ChartPointOptions",
|
|
81
|
+
"kind": "type",
|
|
82
|
+
"importPath": "@gridui/chart"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "ChartScale",
|
|
86
|
+
"kind": "type",
|
|
87
|
+
"importPath": "@gridui/chart"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "ChartTickOptions",
|
|
91
|
+
"kind": "type",
|
|
92
|
+
"importPath": "@gridui/chart"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "ChartTooltip",
|
|
96
|
+
"kind": "component",
|
|
97
|
+
"importPath": "@gridui/chart"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "ChartTooltipProps",
|
|
101
|
+
"kind": "type",
|
|
102
|
+
"importPath": "@gridui/chart"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "ChartValueLabels",
|
|
106
|
+
"kind": "component",
|
|
107
|
+
"importPath": "@gridui/chart"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "ChartValueLabelsProps",
|
|
111
|
+
"kind": "type",
|
|
112
|
+
"importPath": "@gridui/chart"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "ChartXAxis",
|
|
116
|
+
"kind": "component",
|
|
117
|
+
"importPath": "@gridui/chart"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "ChartXAxisProps",
|
|
121
|
+
"kind": "type",
|
|
122
|
+
"importPath": "@gridui/chart"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "ChartYAxis",
|
|
126
|
+
"kind": "component",
|
|
127
|
+
"importPath": "@gridui/chart"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "ChartYAxisProps",
|
|
131
|
+
"kind": "type",
|
|
132
|
+
"importPath": "@gridui/chart"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "LineChart",
|
|
136
|
+
"kind": "component",
|
|
137
|
+
"importPath": "@gridui/chart"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "LineChartProps",
|
|
141
|
+
"kind": "type",
|
|
142
|
+
"importPath": "@gridui/chart"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "LineSeries",
|
|
146
|
+
"kind": "component",
|
|
147
|
+
"importPath": "@gridui/chart"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "LineSeriesProps",
|
|
151
|
+
"kind": "type",
|
|
152
|
+
"importPath": "@gridui/chart"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"styles": [
|
|
156
|
+
"@gridui/theme/styles.css",
|
|
157
|
+
"@gridui/chart/styles.css"
|
|
158
|
+
],
|
|
159
|
+
"examples": [
|
|
160
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/comparison.mdx",
|
|
161
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/elements.mdx",
|
|
162
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/getting-started.mdx",
|
|
163
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/inspection.mdx",
|
|
164
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/trends.mdx",
|
|
165
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/bar-chart.stories.tsx",
|
|
166
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/chart/stories/line-chart.stories.tsx"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- Generated by pnpm docs:storybook. -->
|
|
2
|
+
# Component reference
|
|
3
|
+
|
|
4
|
+
- [BarChart](bar-chart.md)
|
|
5
|
+
- [BarSeries](bar-series.md)
|
|
6
|
+
- [ChartCursor](chart-cursor.md)
|
|
7
|
+
- [ChartGrid](chart-grid.md)
|
|
8
|
+
- [ChartPlot](chart-plot.md)
|
|
9
|
+
- [ChartTooltip](chart-tooltip.md)
|
|
10
|
+
- [ChartValueLabels](chart-value-labels.md)
|
|
11
|
+
- [ChartXAxis](chart-xaxis.md)
|
|
12
|
+
- [ChartYAxis](chart-yaxis.md)
|
|
13
|
+
- [LineChart](line-chart.md)
|
|
14
|
+
- [LineSeries](line-series.md)
|