@galaxy-io/dls 1.2.7 → 1.3.1
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 +2 -0
- package/dist/avatar/Avatar.d.ts +2 -1
- package/dist/avatar/Avatar.js +103 -14
- package/dist/buttons/Button.d.ts +6 -1
- package/dist/buttons/Button.js +8 -4
- package/dist/charts/BarChart.d.ts +30 -20
- package/dist/charts/BarChart.js +183 -253
- package/dist/charts/ChartAxis.d.ts +47 -22
- package/dist/charts/ChartAxis.js +81 -60
- package/dist/charts/ChartCategoryTargets.d.ts +27 -0
- package/dist/charts/ChartCategoryTargets.js +75 -0
- package/dist/charts/ChartEmptyState.d.ts +17 -0
- package/dist/charts/ChartEmptyState.js +29 -0
- package/dist/charts/ChartFrame.d.ts +110 -0
- package/dist/charts/ChartFrame.js +143 -0
- package/dist/charts/ChartLegend.d.ts +27 -4
- package/dist/charts/ChartLegend.js +46 -23
- package/dist/charts/ChartPrimitives.d.ts +230 -0
- package/dist/charts/ChartPrimitives.js +305 -0
- package/dist/charts/ChartTooltip.d.ts +25 -4
- package/dist/charts/ChartTooltip.js +55 -49
- package/dist/charts/LineChart.d.ts +42 -20
- package/dist/charts/LineChart.js +175 -241
- package/dist/charts/PieChart.d.ts +48 -32
- package/dist/charts/PieChart.js +180 -170
- package/dist/charts/barChartGeometry.d.ts +120 -0
- package/dist/charts/barChartGeometry.js +210 -0
- package/dist/charts/barChartLegend.d.ts +25 -0
- package/dist/charts/barChartLegend.js +23 -0
- package/dist/charts/chartFormat.d.ts +27 -0
- package/dist/charts/chartFormat.js +71 -0
- package/dist/charts/chartScales.d.ts +120 -0
- package/dist/charts/chartScales.js +165 -0
- package/dist/charts/chartTheme.d.ts +18 -0
- package/dist/charts/chartTheme.js +26 -0
- package/dist/charts/constants.d.ts +241 -18
- package/dist/charts/constants.js +261 -32
- package/dist/charts/lineChartGeometry.d.ts +92 -0
- package/dist/charts/lineChartGeometry.js +134 -0
- package/dist/charts/pieChartGeometry.d.ts +60 -0
- package/dist/charts/pieChartGeometry.js +79 -0
- package/dist/charts/types.d.ts +428 -54
- package/dist/charts/types.js +155 -0
- package/dist/charts/useCartesianChartLayout.d.ts +70 -0
- package/dist/charts/useCartesianChartLayout.js +56 -0
- package/dist/charts/useChartDimensions.d.ts +47 -0
- package/dist/charts/useChartDimensions.js +63 -0
- package/dist/charts/useChartFormatters.d.ts +19 -0
- package/dist/charts/useChartFormatters.js +20 -0
- package/dist/charts/useChartInteraction.d.ts +76 -0
- package/dist/charts/useChartInteraction.js +126 -0
- package/dist/charts/useChartTooltipPosition.d.ts +53 -0
- package/dist/charts/useChartTooltipPosition.js +39 -0
- package/dist/charts/useSeriesColorResolver.d.ts +37 -0
- package/dist/charts/useSeriesColorResolver.js +27 -0
- package/dist/hooks/useElementClientSize.d.ts +20 -0
- package/dist/hooks/useElementClientSize.js +43 -0
- package/dist/inputs/CheckboxInput.d.ts +7 -2
- package/dist/inputs/CheckboxInput.js +30 -14
- package/dist/inputs/Input.d.ts +1 -1
- package/dist/inputs/Input.js +6 -2
- package/dist/inputs/MultiSelectInput.js +1 -1
- package/dist/inputs/RadioInput.js +7 -2
- package/dist/styles.css +69 -74
- package/dist/table/InfiniteSpreadsheet.d.ts +6 -0
- package/dist/table/InfiniteSpreadsheet.js +235 -0
- package/dist/table/InfiniteTable.d.ts +7 -88
- package/dist/table/InfiniteTable.js +366 -577
- package/dist/{spreadsheet → table}/SpreadsheetCell.d.ts +6 -4
- package/dist/table/SpreadsheetCell.js +71 -0
- package/dist/{spreadsheet → table}/SpreadsheetCellEditor.js +27 -21
- package/dist/table/SpreadsheetHeaderCell.d.ts +23 -0
- package/dist/table/SpreadsheetHeaderCell.js +91 -0
- package/dist/table/SpreadsheetMenuItem.d.ts +14 -0
- package/dist/table/SpreadsheetMenuItem.js +33 -0
- package/dist/table/SpreadsheetPrimitives.d.ts +172 -0
- package/dist/table/SpreadsheetPrimitives.js +105 -0
- package/dist/table/SpreadsheetRow.d.ts +33 -0
- package/dist/table/SpreadsheetRow.js +73 -0
- package/dist/{spreadsheet → table}/SpreadsheetRowActionCell.d.ts +5 -7
- package/dist/table/SpreadsheetRowActionCell.js +51 -0
- package/dist/table/TableExpandCell.d.ts +11 -0
- package/dist/table/TableExpandCell.js +24 -0
- package/dist/table/TableExpandedRow.d.ts +16 -0
- package/dist/table/TableExpandedRow.js +77 -0
- package/dist/table/TableHeaderCellContent.d.ts +30 -0
- package/dist/table/TableHeaderCellContent.js +48 -0
- package/dist/table/TablePrimitives.d.ts +307 -0
- package/dist/table/TablePrimitives.js +298 -0
- package/dist/table/TableSelectCell.d.ts +18 -0
- package/dist/table/TableSelectCell.js +26 -0
- package/dist/table/TableStatusRow.d.ts +18 -0
- package/dist/table/TableStatusRow.js +50 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +11 -27
- package/dist/table/VirtualizedInfiniteTable.js +182 -317
- package/dist/table/types.d.ts +249 -0
- package/dist/table/types.js +51 -0
- package/dist/table/useInfiniteScrollSentinel.d.ts +24 -0
- package/dist/table/useInfiniteScrollSentinel.js +53 -0
- package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.d.ts +1 -1
- package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.js +1 -1
- package/dist/table/useTableColumnLayout.d.ts +28 -0
- package/dist/table/useTableColumnLayout.js +63 -0
- package/dist/table/useTableColumnResize.d.ts +38 -0
- package/dist/table/useTableColumnResize.js +155 -0
- package/dist/table/useTableKeyboardNavigation.d.ts +25 -0
- package/dist/table/useTableKeyboardNavigation.js +83 -0
- package/dist/table/useTableRowExpansion.d.ts +24 -0
- package/dist/table/useTableRowExpansion.js +62 -0
- package/dist/table/useTableRowSelection.d.ts +27 -0
- package/dist/table/useTableRowSelection.js +94 -0
- package/dist/table/utils.d.ts +50 -0
- package/dist/table/utils.js +78 -0
- package/dist/text/MarkdownText.js +45 -27
- package/dist/theme/variants/dark.js +1 -1
- package/dist/widget/Widget.d.ts +2 -0
- package/dist/widget/Widget.js +14 -7
- package/package.json +1 -5
- package/dist/assets/components/enrichment/PerplexityIcon.d.ts +0 -3
- package/dist/assets/components/enrichment/PerplexityIcon.js +0 -35
- package/dist/assets/components/enrichment/TavilyIcon.d.ts +0 -3
- package/dist/assets/components/enrichment/TavilyIcon.js +0 -15
- package/dist/assets/components/onboarding/TenantSetupDark.d.ts +0 -3
- package/dist/assets/components/onboarding/TenantSetupDark.js +0 -498
- package/dist/assets/components/onboarding/TenantSetupLight.d.ts +0 -3
- package/dist/assets/components/onboarding/TenantSetupLight.js +0 -482
- package/dist/assets/components/onboarding/UserSetupDark.d.ts +0 -3
- package/dist/assets/components/onboarding/UserSetupDark.js +0 -1086
- package/dist/assets/components/onboarding/UserSetupLight.d.ts +0 -3
- package/dist/assets/components/onboarding/UserSetupLight.js +0 -1024
- package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.js +0 -466
- package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.js +0 -460
- package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.js +0 -336
- package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.js +0 -336
- package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.js +0 -153
- package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.d.ts +0 -3
- package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.js +0 -153
- package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.js +0 -117
- package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.js +0 -117
- package/dist/assets/components/projects/MappingMethodBlankDark.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodBlankDark.js +0 -150
- package/dist/assets/components/projects/MappingMethodBlankDarkHovered.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodBlankDarkHovered.js +0 -150
- package/dist/assets/components/projects/MappingMethodBlankLight.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodBlankLight.js +0 -150
- package/dist/assets/components/projects/MappingMethodBlankLightHovered.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodBlankLightHovered.js +0 -150
- package/dist/assets/components/projects/MappingMethodJsonDark.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodJsonDark.js +0 -90
- package/dist/assets/components/projects/MappingMethodJsonDarkHovered.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodJsonDarkHovered.js +0 -90
- package/dist/assets/components/projects/MappingMethodJsonLight.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodJsonLight.js +0 -90
- package/dist/assets/components/projects/MappingMethodJsonLightHovered.d.ts +0 -3
- package/dist/assets/components/projects/MappingMethodJsonLightHovered.js +0 -90
- package/dist/assets/components/projects/ProjectsEmptyStateDark.d.ts +0 -3
- package/dist/assets/components/projects/ProjectsEmptyStateDark.js +0 -454
- package/dist/assets/components/projects/ProjectsEmptyStateLight.d.ts +0 -3
- package/dist/assets/components/projects/ProjectsEmptyStateLight.js +0 -456
- package/dist/assets/components/root/CreateProjectActionCardDark.d.ts +0 -3
- package/dist/assets/components/root/CreateProjectActionCardDark.js +0 -1796
- package/dist/assets/components/root/CreateProjectActionCardDarkHovered.d.ts +0 -3
- package/dist/assets/components/root/CreateProjectActionCardDarkHovered.js +0 -1796
- package/dist/assets/components/root/CreateProjectActionCardLight.d.ts +0 -3
- package/dist/assets/components/root/CreateProjectActionCardLight.js +0 -1786
- package/dist/assets/components/root/CreateProjectActionCardLightHovered.d.ts +0 -3
- package/dist/assets/components/root/CreateProjectActionCardLightHovered.js +0 -1786
- package/dist/assets/components/root/CreateSourceActionCardDark.d.ts +0 -3
- package/dist/assets/components/root/CreateSourceActionCardDark.js +0 -879
- package/dist/assets/components/root/CreateSourceActionCardDarkHovered.d.ts +0 -3
- package/dist/assets/components/root/CreateSourceActionCardDarkHovered.js +0 -879
- package/dist/assets/components/root/CreateSourceActionCardLight.d.ts +0 -3
- package/dist/assets/components/root/CreateSourceActionCardLight.js +0 -889
- package/dist/assets/components/root/CreateSourceActionCardLightHovered.d.ts +0 -3
- package/dist/assets/components/root/CreateSourceActionCardLightHovered.js +0 -889
- package/dist/assets/components/sources/AttioIcon.d.ts +0 -3
- package/dist/assets/components/sources/AttioIcon.js +0 -11
- package/dist/assets/components/sources/BigquerySourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/BigquerySourceIcon.js +0 -39
- package/dist/assets/components/sources/BrowserbaseSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/BrowserbaseSourceIcon.js +0 -35
- package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.d.ts +0 -3
- package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.js +0 -13
- package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.d.ts +0 -3
- package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.js +0 -13
- package/dist/assets/components/sources/ConfluenceSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/ConfluenceSourceIcon.js +0 -30
- package/dist/assets/components/sources/GithubSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/GithubSourceIcon.js +0 -27
- package/dist/assets/components/sources/GoogleDriveIcon.d.ts +0 -3
- package/dist/assets/components/sources/GoogleDriveIcon.js +0 -45
- package/dist/assets/components/sources/HubspotSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/HubspotSourceIcon.js +0 -14
- package/dist/assets/components/sources/JiraSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/JiraSourceIcon.js +0 -54
- package/dist/assets/components/sources/LinearSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/LinearSourceIcon.js +0 -14
- package/dist/assets/components/sources/MysqlLogoSourceIconDark.d.ts +0 -3
- package/dist/assets/components/sources/MysqlLogoSourceIconDark.js +0 -17
- package/dist/assets/components/sources/NetsuiteSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/NetsuiteSourceIcon.js +0 -32
- package/dist/assets/components/sources/NotionIcon.d.ts +0 -3
- package/dist/assets/components/sources/NotionIcon.js +0 -20
- package/dist/assets/components/sources/PostgresqlIcon.d.ts +0 -3
- package/dist/assets/components/sources/PostgresqlIcon.js +0 -61
- package/dist/assets/components/sources/S3Icon.d.ts +0 -3
- package/dist/assets/components/sources/S3Icon.js +0 -76
- package/dist/assets/components/sources/SalesforceSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/SalesforceSourceIcon.js +0 -23
- package/dist/assets/components/sources/SlackIcon.d.ts +0 -3
- package/dist/assets/components/sources/SlackIcon.js +0 -32
- package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.d.ts +0 -3
- package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.js +0 -14
- package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.d.ts +0 -3
- package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.js +0 -14
- package/dist/assets/components/sources/WikipediaSourceIcon.d.ts +0 -3
- package/dist/assets/components/sources/WikipediaSourceIcon.js +0 -1490
- package/dist/avatar/AvatarEmpty.d.ts +0 -7
- package/dist/avatar/AvatarEmpty.js +0 -99
- package/dist/avatar/types.d.ts +0 -5
- package/dist/avatar/types.js +0 -9
- package/dist/charts/utils.d.ts +0 -29
- package/dist/charts/utils.js +0 -62
- package/dist/icons/BackIcon.d.ts +0 -3
- package/dist/icons/BackIcon.js +0 -13
- package/dist/icons/CloseIcon.d.ts +0 -3
- package/dist/icons/CloseIcon.js +0 -13
- package/dist/icons/CreateIcon.d.ts +0 -3
- package/dist/icons/CreateIcon.js +0 -13
- package/dist/icons/ForwardIcon.d.ts +0 -3
- package/dist/icons/ForwardIcon.js +0 -13
- package/dist/icons/HelpIcon.d.ts +0 -3
- package/dist/icons/HelpIcon.js +0 -14
- package/dist/icons/ProjectsIcon.d.ts +0 -3
- package/dist/icons/ProjectsIcon.js +0 -12
- package/dist/icons/SearchIcon.d.ts +0 -3
- package/dist/icons/SearchIcon.js +0 -12
- package/dist/icons/SourcesIcon.d.ts +0 -3
- package/dist/icons/SourcesIcon.js +0 -12
- package/dist/icons/TextIcon.d.ts +0 -4
- package/dist/icons/TextIcon.js +0 -22
- package/dist/icons/WebScrapeIcon.d.ts +0 -4
- package/dist/icons/WebScrapeIcon.js +0 -22
- package/dist/icons/WebhookIcon.d.ts +0 -4
- package/dist/icons/WebhookIcon.js +0 -22
- package/dist/icons/sources/AttioLogomark.d.ts +0 -4
- package/dist/icons/sources/AttioLogomark.js +0 -8
- package/dist/icons/sources/BrowserbaseLogomark.d.ts +0 -4
- package/dist/icons/sources/BrowserbaseLogomark.js +0 -8
- package/dist/icons/sources/ClickhouseLogomark.d.ts +0 -4
- package/dist/icons/sources/ClickhouseLogomark.js +0 -16
- package/dist/icons/sources/ConfluenceLogomark.d.ts +0 -4
- package/dist/icons/sources/ConfluenceLogomark.js +0 -8
- package/dist/icons/sources/GithubLogomark.d.ts +0 -4
- package/dist/icons/sources/GithubLogomark.js +0 -8
- package/dist/icons/sources/GoogleBigqueryLogomark.d.ts +0 -4
- package/dist/icons/sources/GoogleBigqueryLogomark.js +0 -8
- package/dist/icons/sources/GoogleDriveLogomark.d.ts +0 -4
- package/dist/icons/sources/GoogleDriveLogomark.js +0 -8
- package/dist/icons/sources/HubspotLogomark.d.ts +0 -4
- package/dist/icons/sources/HubspotLogomark.js +0 -8
- package/dist/icons/sources/JiraLogomark.d.ts +0 -4
- package/dist/icons/sources/JiraLogomark.js +0 -8
- package/dist/icons/sources/LinearLogomark.d.ts +0 -4
- package/dist/icons/sources/LinearLogomark.js +0 -8
- package/dist/icons/sources/MySQLLogomark.d.ts +0 -4
- package/dist/icons/sources/MySQLLogomark.js +0 -8
- package/dist/icons/sources/NetsuiteLogomark.d.ts +0 -4
- package/dist/icons/sources/NetsuiteLogomark.js +0 -8
- package/dist/icons/sources/NotionLogomark.d.ts +0 -4
- package/dist/icons/sources/NotionLogomark.js +0 -8
- package/dist/icons/sources/PostgresLogomark.d.ts +0 -4
- package/dist/icons/sources/PostgresLogomark.js +0 -8
- package/dist/icons/sources/S3Logomark.d.ts +0 -4
- package/dist/icons/sources/S3Logomark.js +0 -8
- package/dist/icons/sources/SalesforceLogomark.d.ts +0 -4
- package/dist/icons/sources/SalesforceLogomark.js +0 -8
- package/dist/icons/sources/SlackLogoIconmark.d.ts +0 -4
- package/dist/icons/sources/SlackLogoIconmark.js +0 -8
- package/dist/icons/sources/SnowflakeLogomark.d.ts +0 -4
- package/dist/icons/sources/SnowflakeLogomark.js +0 -16
- package/dist/icons/sources/WikipediaLogomark.d.ts +0 -4
- package/dist/icons/sources/WikipediaLogomark.js +0 -8
- package/dist/spreadsheet/InfiniteSpreadsheet.d.ts +0 -3
- package/dist/spreadsheet/InfiniteSpreadsheet.js +0 -265
- package/dist/spreadsheet/SpreadsheetAddColumnButton.d.ts +0 -6
- package/dist/spreadsheet/SpreadsheetAddColumnButton.js +0 -32
- package/dist/spreadsheet/SpreadsheetCell.js +0 -115
- package/dist/spreadsheet/SpreadsheetHeaderCell.d.ts +0 -18
- package/dist/spreadsheet/SpreadsheetHeaderCell.js +0 -141
- package/dist/spreadsheet/SpreadsheetRow.d.ts +0 -21
- package/dist/spreadsheet/SpreadsheetRow.js +0 -68
- package/dist/spreadsheet/SpreadsheetRowActionCell.js +0 -78
- package/dist/spreadsheet/hooks/useColumnResize.d.ts +0 -6
- package/dist/spreadsheet/hooks/useColumnResize.js +0 -46
- package/dist/spreadsheet/types.d.ts +0 -92
- package/dist/spreadsheet/types.js +0 -21
- /package/dist/{spreadsheet → table}/SpreadsheetCellEditor.d.ts +0 -0
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { BaseChartProps, ChartSeriesStyles, ChartSize, PieChartSliceDatum } from "./types";
|
|
3
|
+
export type PieChartProps<TSlice extends string> = BaseChartProps & ChartSize & {
|
|
4
|
+
/**
|
|
5
|
+
* Presentation for every slice, keyed by slice.
|
|
6
|
+
*
|
|
7
|
+
* `TSlice` is inferred from these keys alone — `slices` wraps it in
|
|
8
|
+
* `NoInfer` — so a mistyped key is a compile error rather than a slice that
|
|
9
|
+
* silently fails to draw.
|
|
10
|
+
*/
|
|
11
|
+
series: ChartSeriesStyles<TSlice>;
|
|
12
|
+
/** Slices, rendered clockwise from 12 o'clock in array order. */
|
|
13
|
+
slices: PieChartSliceDatum<NoInfer<TSlice>>[];
|
|
14
|
+
/**
|
|
15
|
+
* Hole size as a fraction of the outer radius, 0–1.
|
|
16
|
+
* `0` is a solid pie. Defaults to a donut.
|
|
17
|
+
*/
|
|
18
|
+
innerRadiusRatio?: number;
|
|
19
|
+
/** Gap between slices, in radians. */
|
|
16
20
|
padAngle?: number;
|
|
17
|
-
/**
|
|
21
|
+
/** Slice corner radius in px. */
|
|
18
22
|
cornerRadius?: number;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Slices below this share of the total are folded into one bucket.
|
|
25
|
+
* Set `0` to render every slice faithfully.
|
|
26
|
+
*/
|
|
27
|
+
minSliceShare?: number;
|
|
28
|
+
/** Label for the folded bucket. @default "Other" */
|
|
29
|
+
aggregatedLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Content for the donut hole — a total, a headline percentage.
|
|
32
|
+
* Ignored when `innerRadiusRatio` is 0.
|
|
33
|
+
*/
|
|
34
|
+
centerContent?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Notified when a slice is pinned or unpinned by a click.
|
|
37
|
+
*
|
|
38
|
+
* The index is a position in the *rendered* arcs, which excludes folded
|
|
39
|
+
* slices and may include the aggregated bucket.
|
|
40
|
+
*/
|
|
41
|
+
onPinnedChange?: (sliceIndex: number | null) => void;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Pie and donut chart.
|
|
45
|
+
*
|
|
46
|
+
* Unlike the cartesian charts there is no category axis to hit-test against, so
|
|
47
|
+
* each arc is its own target. Small slices are folded into an "Other" bucket by
|
|
48
|
+
* default, which keeps every remaining arc large enough to actually hit.
|
|
49
|
+
*/
|
|
50
|
+
declare const PieChart: <TSlice extends string>({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange, }: PieChartProps<TSlice>) => import("react").JSX.Element;
|
|
35
51
|
export default PieChart;
|
package/dist/charts/PieChart.js
CHANGED
|
@@ -1,183 +1,193 @@
|
|
|
1
|
-
import { useGalaxyTheme, withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
-
import Text, { TextSize, TextWeight } from "../text/Text.js";
|
|
3
1
|
import FlexWrapper, { AlignItems, FlexDirection, JustifyContent } from "../containers/FlexWrapper.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
2
|
+
import { ChartKind, ChartTargetShape } from "./types.js";
|
|
3
|
+
import { PIE_CHART_MARGIN, PIE_MIN_SLICE_SHARE } from "./constants.js";
|
|
4
|
+
import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
|
|
5
|
+
import { ChartTooltipVerticalAlign } from "./useChartTooltipPosition.js";
|
|
6
|
+
import { useChartInteraction } from "./useChartInteraction.js";
|
|
7
|
+
import { useChartFormatters } from "./useChartFormatters.js";
|
|
8
|
+
import { useChartDimensions } from "./useChartDimensions.js";
|
|
9
|
+
import { buildPieChartGeometry } from "./pieChartGeometry.js";
|
|
10
|
+
import { ChartArcPath, ChartCenterBox } from "./ChartPrimitives.js";
|
|
11
|
+
import ChartFrame from "./ChartFrame.js";
|
|
12
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
14
|
//#region src/charts/PieChart.tsx
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
propsAsIs: false,
|
|
25
|
-
vars: {
|
|
26
|
-
"c1ez9f1-0": [_exp()],
|
|
27
|
-
"c1ez9f1-1": [_exp2()]
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
var resolveSliceColor = (slice, index, palette) => slice.color ?? palette[index % palette.length];
|
|
31
|
-
var PieChart = ({ slices, width, height, fillWidth = false, aspectRatio, innerRadius = 0, padAngle = DEFAULT_PAD_ANGLE, cornerRadius = DEFAULT_CORNER_RADIUS, valueFormatter = defaultValueFormatter, labelFormatter = defaultLabelFormatter, tooltipRenderer, noTooltip = false, showLegend = true, showLabels = false, ariaLabel }) => {
|
|
32
|
-
const { theme } = useGalaxyTheme();
|
|
15
|
+
/**
|
|
16
|
+
* Pie and donut chart.
|
|
17
|
+
*
|
|
18
|
+
* Unlike the cartesian charts there is no category axis to hit-test against, so
|
|
19
|
+
* each arc is its own target. Small slices are folded into an "Other" bucket by
|
|
20
|
+
* default, which keeps every remaining arc large enough to actually hit.
|
|
21
|
+
*/
|
|
22
|
+
var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare = PIE_MIN_SLICE_SHARE, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange }) => {
|
|
33
23
|
const containerRef = useRef(null);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
const colors = useSeriesColorResolver(series);
|
|
25
|
+
const dimensions = useChartDimensions({
|
|
26
|
+
containerRef,
|
|
27
|
+
width,
|
|
28
|
+
height,
|
|
29
|
+
fillWidth,
|
|
30
|
+
fillHeight,
|
|
31
|
+
aspectRatio,
|
|
32
|
+
margin,
|
|
33
|
+
defaultMargin: PIE_CHART_MARGIN
|
|
34
|
+
});
|
|
35
|
+
const { plotWidth, plotHeight } = dimensions;
|
|
36
|
+
const { formatValue, formatLabel } = useChartFormatters({
|
|
37
|
+
valueFormatter,
|
|
38
|
+
valueUnit,
|
|
39
|
+
labelFormatter
|
|
40
|
+
});
|
|
41
|
+
const getSliceLabel = useCallback((sliceKey) => series[sliceKey]?.label ?? sliceKey, [series]);
|
|
42
|
+
const getSliceColor = useCallback((sliceKey) => series[sliceKey]?.color, [series]);
|
|
43
|
+
const resolveColor = useCallback(({ sliceKey, explicit }) => sliceKey === null ? colors.neutral : colors.resolve(sliceKey, explicit), [colors]);
|
|
44
|
+
const geometry = useMemo(() => buildPieChartGeometry({
|
|
45
|
+
slices,
|
|
46
|
+
plotWidth,
|
|
47
|
+
plotHeight,
|
|
48
|
+
innerRadiusRatio,
|
|
49
|
+
padAngle,
|
|
50
|
+
cornerRadius,
|
|
51
|
+
minSliceShare,
|
|
52
|
+
aggregatedLabel,
|
|
53
|
+
resolveColor,
|
|
54
|
+
getSliceColor,
|
|
55
|
+
getSliceLabel
|
|
56
|
+
}), [
|
|
57
|
+
slices,
|
|
58
|
+
plotWidth,
|
|
59
|
+
plotHeight,
|
|
60
|
+
innerRadiusRatio,
|
|
61
|
+
padAngle,
|
|
62
|
+
cornerRadius,
|
|
63
|
+
minSliceShare,
|
|
64
|
+
aggregatedLabel,
|
|
65
|
+
resolveColor,
|
|
66
|
+
getSliceColor,
|
|
67
|
+
getSliceLabel
|
|
49
68
|
]);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
const isEmpty = geometry.arcs.length === 0;
|
|
70
|
+
const legendItems = useMemo(() => geometry.arcs.map((chartArc) => ({
|
|
71
|
+
key: chartArc.id,
|
|
72
|
+
label: formatLabel(chartArc.label),
|
|
73
|
+
color: chartArc.color
|
|
74
|
+
})), [geometry.arcs, formatLabel]);
|
|
75
|
+
const legendKeys = useMemo(() => legendItems.map((item) => item.key), [legendItems]);
|
|
76
|
+
const interaction = useChartInteraction({
|
|
77
|
+
categoryCount: geometry.arcs.length,
|
|
78
|
+
seriesKeys: legendKeys,
|
|
79
|
+
disabled: noTooltip || isLoading || isEmpty,
|
|
80
|
+
isLoading,
|
|
81
|
+
onPinnedChange
|
|
82
|
+
});
|
|
83
|
+
const buildCategoryTooltip = useCallback((index) => {
|
|
84
|
+
const chartArc = geometry.arcs[index];
|
|
85
|
+
if (!chartArc) return null;
|
|
86
|
+
return {
|
|
87
|
+
label: formatLabel(chartArc.label),
|
|
88
|
+
rows: [{
|
|
89
|
+
key: chartArc.id,
|
|
90
|
+
label: `${Math.round(chartArc.share * 1e3) / 10}% of total`,
|
|
91
|
+
value: chartArc.value,
|
|
92
|
+
formattedValue: formatValue(chartArc.value),
|
|
93
|
+
color: chartArc.color
|
|
68
94
|
}],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
95
|
+
anchorX: chartArc.anchorX,
|
|
96
|
+
anchorY: chartArc.anchorY
|
|
97
|
+
};
|
|
72
98
|
}, [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
geometry.arcs,
|
|
100
|
+
formatValue,
|
|
101
|
+
formatLabel
|
|
76
102
|
]);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
key: s.label,
|
|
93
|
-
name: labelFormatter(s.label),
|
|
94
|
-
color: resolveSliceColor(s, i, palette)
|
|
95
|
-
})), [
|
|
96
|
-
slices,
|
|
97
|
-
palette,
|
|
98
|
-
labelFormatter
|
|
103
|
+
/**
|
|
104
|
+
* A slice reads better than the generic "label: row, row" sentence.
|
|
105
|
+
*
|
|
106
|
+
* The frame's default would render "Enterprise: 42.1% of total 1,240", which
|
|
107
|
+
* puts the share where a reader expects the value.
|
|
108
|
+
*/
|
|
109
|
+
const describeCategory = useCallback((index) => {
|
|
110
|
+
const chartArc = geometry.arcs[index];
|
|
111
|
+
if (!chartArc) return "";
|
|
112
|
+
const share = `${Math.round(chartArc.share * 1e3) / 10}% of total`;
|
|
113
|
+
return `${formatLabel(chartArc.label)}, ${formatValue(chartArc.value)}, ${share}`;
|
|
114
|
+
}, [
|
|
115
|
+
geometry.arcs,
|
|
116
|
+
formatValue,
|
|
117
|
+
formatLabel
|
|
99
118
|
]);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
justifyContent: JustifyContent.CENTER,
|
|
154
|
-
alignItems: AlignItems.CENTER,
|
|
155
|
-
fillWidth: true,
|
|
156
|
-
fillHeight: true,
|
|
157
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
158
|
-
size: TextSize.CAPTION,
|
|
159
|
-
weight: TextWeight.MEDIUM,
|
|
160
|
-
hex: theme.color.text.primaryAlt,
|
|
161
|
-
children: `${pct}%`
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
});
|
|
165
|
-
})()] }, d.data.label);
|
|
166
|
-
})
|
|
119
|
+
/**
|
|
120
|
+
* Targets reuse each arc's own `d`, drawn again transparent above the marks.
|
|
121
|
+
*
|
|
122
|
+
* The arcs themselves stop being interactive: hit testing, focus and the
|
|
123
|
+
* focus ring then work identically on all three charts, instead of the pie
|
|
124
|
+
* attaching handlers permanently and toggling `data-interactive` while the
|
|
125
|
+
* cartesian charts rendered their targets away.
|
|
126
|
+
*/
|
|
127
|
+
const categoryTargets = useMemo(() => geometry.arcs.map((chartArc) => ({
|
|
128
|
+
key: chartArc.id,
|
|
129
|
+
shape: ChartTargetShape.PATH,
|
|
130
|
+
d: chartArc.path
|
|
131
|
+
})), [geometry.arcs]);
|
|
132
|
+
const showCenter = centerContent && (innerRadiusRatio ?? .62) > 0;
|
|
133
|
+
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
134
|
+
containerRef,
|
|
135
|
+
dimensions,
|
|
136
|
+
fillWidth,
|
|
137
|
+
fillHeight,
|
|
138
|
+
interaction,
|
|
139
|
+
kind: ChartKind.PIE,
|
|
140
|
+
categoryCount: geometry.arcs.length,
|
|
141
|
+
ariaLabel,
|
|
142
|
+
ariaDescription,
|
|
143
|
+
noTooltip,
|
|
144
|
+
buildCategoryTooltip,
|
|
145
|
+
tooltipRenderer,
|
|
146
|
+
categoryTargets,
|
|
147
|
+
categoryTargetsTransform: `translate(${geometry.centerX}, ${geometry.centerY})`,
|
|
148
|
+
wrapCategoryNavigation: true,
|
|
149
|
+
describeCategory,
|
|
150
|
+
placeAwayFromX: geometry.centerX,
|
|
151
|
+
verticalAlign: ChartTooltipVerticalAlign.CENTERED,
|
|
152
|
+
isEmpty,
|
|
153
|
+
isLoading,
|
|
154
|
+
contentWhenEmpty,
|
|
155
|
+
showLegend,
|
|
156
|
+
legendItems,
|
|
157
|
+
legendInset: 0,
|
|
158
|
+
plotOverlay: showCenter && !isEmpty ? /* @__PURE__ */ jsx(ChartDonutCenter, {
|
|
159
|
+
centerX: dimensions.margin.left + geometry.centerX,
|
|
160
|
+
centerY: dimensions.margin.top + geometry.centerY,
|
|
161
|
+
diameter: geometry.innerRadius * 2,
|
|
162
|
+
children: centerContent
|
|
163
|
+
}) : null,
|
|
164
|
+
children: /* @__PURE__ */ jsx("g", {
|
|
165
|
+
transform: `translate(${geometry.centerX}, ${geometry.centerY})`,
|
|
166
|
+
children: geometry.arcs.map((chartArc, index) => /* @__PURE__ */ jsx(ChartArcPath, {
|
|
167
|
+
d: chartArc.path,
|
|
168
|
+
fill: chartArc.color,
|
|
169
|
+
"data-state": interaction.getMarkState({
|
|
170
|
+
categoryIndex: index,
|
|
171
|
+
seriesKey: chartArc.id
|
|
167
172
|
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
valueFormatter
|
|
171
|
-
}))]
|
|
172
|
-
}), showLegend && /* @__PURE__ */ jsx(FlexWrapper, {
|
|
173
|
-
direction: FlexDirection.ROW,
|
|
174
|
-
gap: 0,
|
|
175
|
-
children: /* @__PURE__ */ jsx(ChartLegend, {
|
|
176
|
-
series: legendSeries,
|
|
177
|
-
palette
|
|
178
|
-
})
|
|
179
|
-
})]
|
|
173
|
+
}, chartArc.id))
|
|
174
|
+
})
|
|
180
175
|
});
|
|
181
176
|
};
|
|
177
|
+
/** Positions arbitrary content inside the donut hole. */
|
|
178
|
+
var ChartDonutCenter = ({ centerX, centerY, diameter, children }) => /* @__PURE__ */ jsx(ChartCenterBox, {
|
|
179
|
+
$centerX: centerX,
|
|
180
|
+
$centerY: centerY,
|
|
181
|
+
$diameter: diameter,
|
|
182
|
+
children: /* @__PURE__ */ jsx(FlexWrapper, {
|
|
183
|
+
direction: FlexDirection.COLUMN,
|
|
184
|
+
justifyContent: JustifyContent.CENTER,
|
|
185
|
+
alignItems: AlignItems.CENTER,
|
|
186
|
+
gap: 2,
|
|
187
|
+
fillWidth: true,
|
|
188
|
+
fillHeight: true,
|
|
189
|
+
children
|
|
190
|
+
})
|
|
191
|
+
});
|
|
182
192
|
//#endregion
|
|
183
193
|
export { PieChart as default };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { buildValueScale } from "./chartScales";
|
|
2
|
+
import { BarChartNormalization, BarCorners } from "./types";
|
|
3
|
+
import type { BarChartGroupDatum, ChartPalette } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Rectangle with one pair of corners rounded.
|
|
6
|
+
*
|
|
7
|
+
* The radius is clamped to half the height as well as half the width, so a very
|
|
8
|
+
* short bar renders as a symmetric cap instead of a lopsided half-pill.
|
|
9
|
+
*/
|
|
10
|
+
export declare function roundedRectPath(x: number, y: number, width: number, height: number, radius: number, corners: BarCorners): string;
|
|
11
|
+
/**
|
|
12
|
+
* Signed value domain across every group.
|
|
13
|
+
*
|
|
14
|
+
* Percent-normalized charts always span 0–1, so the axis is stable no matter
|
|
15
|
+
* what the underlying totals are.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBarValueDomain<TMetric extends string, TComponentKey extends string>(groups: BarChartGroupDatum<TMetric, TComponentKey>[], normalization: BarChartNormalization): [number, number];
|
|
18
|
+
/**
|
|
19
|
+
* A single rendered rectangle.
|
|
20
|
+
*
|
|
21
|
+
* The geometry layer flattens the group/bar/component hierarchy into an array
|
|
22
|
+
* of these, so rendering is a plain `.map()` with no nested loops or
|
|
23
|
+
* accumulators in the component body.
|
|
24
|
+
*/
|
|
25
|
+
export interface BarChartRect<TMetric extends string, TComponentKey extends string = string> {
|
|
26
|
+
/**
|
|
27
|
+
* React key: `${groupIndex}:${barIndex}:${componentKey}`.
|
|
28
|
+
*
|
|
29
|
+
* Deliberately index-based rather than label-based — group labels are free to
|
|
30
|
+
* repeat, and duplicated keys would silently drop rectangles.
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
groupIndex: number;
|
|
34
|
+
metric: TMetric;
|
|
35
|
+
componentKey: TComponentKey;
|
|
36
|
+
/** The component's label, carried through for the tooltip. */
|
|
37
|
+
label: string;
|
|
38
|
+
/** The raw value, before any normalization. */
|
|
39
|
+
value: number;
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
/** Resolved from the theme — never a raw hex from consumer data. */
|
|
45
|
+
color: string;
|
|
46
|
+
/** Interior stack segments get {@link BarCorners.NONE}. */
|
|
47
|
+
corners: BarCorners;
|
|
48
|
+
/** Corner radius in px, reduced for narrow bars so the curve can't dominate. */
|
|
49
|
+
radius: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A category's invisible hit target and tooltip anchor.
|
|
53
|
+
*
|
|
54
|
+
* Hit testing happens per group rather than per rectangle: a two-pixel bar is
|
|
55
|
+
* then exactly as hoverable as a two-hundred-pixel one, and moving the pointer
|
|
56
|
+
* between segments inside one group fires nothing, so the tooltip stays put
|
|
57
|
+
* instead of jumping between segment tops.
|
|
58
|
+
*/
|
|
59
|
+
export interface BarChartGroupBand {
|
|
60
|
+
groupIndex: number;
|
|
61
|
+
label: string;
|
|
62
|
+
/** Tiles edge to edge with its neighbours, so there are no dead gutters. */
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
/** Group centre, at the top of its tallest bar. Stable while hovering. */
|
|
68
|
+
anchorX: number;
|
|
69
|
+
anchorY: number;
|
|
70
|
+
}
|
|
71
|
+
export interface BarChartGeometry<TMetric extends string, TComponentKey extends string = string> {
|
|
72
|
+
/** Every rendered rectangle, in draw order. */
|
|
73
|
+
rects: BarChartRect<TMetric, TComponentKey>[];
|
|
74
|
+
/** One hit target per group, tiling the plot with no gaps. */
|
|
75
|
+
bands: BarChartGroupBand[];
|
|
76
|
+
/** The resolved value scale, shared with the axis. */
|
|
77
|
+
valueScale: ReturnType<typeof buildValueScale>;
|
|
78
|
+
}
|
|
79
|
+
interface BuildBarChartGeometryArgs<TMetric extends string, TComponentKey extends string> {
|
|
80
|
+
groups: BarChartGroupDatum<TMetric, TComponentKey>[];
|
|
81
|
+
plotWidth: number;
|
|
82
|
+
plotHeight: number;
|
|
83
|
+
normalization: BarChartNormalization;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the chart as a whole is stacked.
|
|
86
|
+
*
|
|
87
|
+
* Chart-wide, not per bar, because it decides the *colour rule* and the legend
|
|
88
|
+
* lists one domain for the whole chart. Deriving it per bar would colour a
|
|
89
|
+
* single-component bar by metric while the legend named components.
|
|
90
|
+
*/
|
|
91
|
+
isStacked: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The final value domain, already overridden, zeroed and niced.
|
|
94
|
+
*
|
|
95
|
+
* Resolved by the caller rather than here, because the left gutter is sized
|
|
96
|
+
* from the tick labels and therefore needs the domain before the plot — and
|
|
97
|
+
* hence this builder — exists.
|
|
98
|
+
*/
|
|
99
|
+
domain: [number, number];
|
|
100
|
+
/**
|
|
101
|
+
* Maps one segment to a concrete color.
|
|
102
|
+
*
|
|
103
|
+
* The geometry deliberately does not decide the rule — it only reports what
|
|
104
|
+
* it knows about the segment. Whether a stack is coloured by component or a
|
|
105
|
+
* group by metric is a presentation question, and it needs the `series`
|
|
106
|
+
* record to answer, which this module has no business importing.
|
|
107
|
+
*/
|
|
108
|
+
resolveColor: (args: ResolveBarColorArgs<TMetric>) => string;
|
|
109
|
+
}
|
|
110
|
+
export interface ResolveBarColorArgs<TMetric extends string> {
|
|
111
|
+
metric: TMetric;
|
|
112
|
+
/** Index of the component within its bar. */
|
|
113
|
+
componentIndex: number;
|
|
114
|
+
/** True when the *chart* is stacked — see the option of the same name. */
|
|
115
|
+
isStacked: boolean;
|
|
116
|
+
/** The component's own palette override, if it declared one. */
|
|
117
|
+
explicit?: ChartPalette;
|
|
118
|
+
}
|
|
119
|
+
export declare function buildBarChartGeometry<TMetric extends string, TComponentKey extends string = string>({ groups, plotWidth, plotHeight, normalization, isStacked, domain, resolveColor, }: BuildBarChartGeometryArgs<TMetric, TComponentKey>): BarChartGeometry<TMetric, TComponentKey>;
|
|
120
|
+
export {};
|