Phi
Charts
@dicehub/phiv1.0.0-beta.1

Charts

Chart components and utilities built on Apache ECharts.

Installation

Charts require ECharts. Consumers register only the ECharts modules they use.

pnpm add echarts
import * as echarts from "echarts/core";
import { BarChart, LineChart, PieChart } from "echarts/charts";
import {
  AriaComponent,
  AxisPointerComponent,
  BrushComponent,
  GridComponent,
  MarkLineComponent,
  ToolboxComponent,
  TooltipComponent,
} from "echarts/components";
import { CanvasRenderer } from "echarts/renderers";

echarts.use([
  BarChart,
  LineChart,
  PieChart,
  AriaComponent,
  AxisPointerComponent,
  BrushComponent,
  GridComponent,
  MarkLineComponent,
  ToolboxComponent,
  TooltipComponent,
  CanvasRenderer,
]);

Imports

Import charts from their dedicated module. This keeps ECharts optional for other Phi components.

import { Chart, TimeseriesChart, BubbleMap, ChoroplethMap, ChartLegend, ChartPalette } from "@dicehub/phi/components/chart";

Available Charts

Color System

Use semantic colors for stateful data, categorical colors for series, and sequential colors for density.

Legend

Use chart legend items to display series names, values, units, inactive states, and loading placeholders.

LargeItem

SmallItem

API Reference

PropTypeDefaultDescription
echartstypeof echarts-ECharts core instance with the required modules registered.
optionsPhiChartOption-ECharts option object passed through to setOption.
optionUpdateBehaviorSetOptionOpts-Additional options passed to chart.setOption.
classNamestring-Optional class passed to the chart element.
aspectRationumber | string-Responsive container ratio used when height is not set.
heightnumber350Chart container height in pixels.
isDarkModebooleanfalseInitializes ECharts with dark mode and dark chart colors.
onEventsPartial<ChartEvents>-Event handlers registered on the ECharts instance.