Skip to main content

DonutChart

Donut Chart component (Pie chart with inner radius).

Example

"use client";

import { DonutChart } from "@databricks/appkit-ui/react";

export default function DonutChartExample() {
return (
<DonutChart
data={[
{ name: "Engineering", value: 450 },
{ name: "Marketing", value: 250 },
{ name: "Sales", value: 300 },
{ name: "Operations", value: 200 },
]}
height={300}
/>
);
}

DonutChart

Donut Chart component (Pie chart with inner radius).

Important: This component uses Apache ECharts architecture. Configure it via props, not by passing child components.

Best Practice: Use the built-in data fetching by passing queryKey and parameters props instead of pre-fetching data with useAnalyticsQuery.

Supports both query mode (queryKey + parameters) and data mode (static data).

Source: packages/appkit-ui/src/react/charts/pie/index.tsx

Props

PropTypeRequiredDefaultDescription
queryKeystring-Analytics query key registered with analytics plugin
parametersRecord<string, unknown>-Query parameters passed to the analytics endpoint
formatenum"auto"Data format to use - "json": Use JSON format (smaller payloads, simpler) - "arrow": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size
transformer(<T>(data: T) => T)-Transform raw data before rendering
dataChartData-Arrow Table or JSON array
titlestring-Chart title
showLegendboolean-Show legend
colorPaletteenum-Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values
colorsstring[]-Custom colors for series (overrides colorPalette)
heightnumber300Chart height in pixels
classNamestring-Additional CSS classes
xKeystring-X-axis field key. Auto-detected from schema if not provided.
yKeystring | string[]-Y-axis field key(s). Auto-detected from schema if not provided.
ariaLabelstring-Accessibility label for screen readers
testIdstring-Test ID for automated testing
optionsRecord<string, unknown>-Additional ECharts options to merge
innerRadiusnumber0Inner radius for donut charts (0-100%)
showLabelsbooleantrueShow labels on slices
labelPositionenum"outside"Label position

Usage

import { DonutChart } from '@databricks/appkit-ui';

<DonutChart /* props */ />