PitchKit
API Reference@pitchkit/reactVariables

usePizzaChart

const usePizzaChart: () => PizzaChartContextValue = pizza.use;

Defined in: packages/react/src/pizza-context.ts:23

The pizza's geometry — the <PizzaChart> counterpart to usePitch(). pointAt(metricId, value) puts a mark on a slice's middle using the same range and flip as the slices, so a benchmark lines up:

function Median({ metricId }: { metricId: string }) {
  const { pointAt } = usePizzaChart();
  const [x, y] = pointAt(metricId, 50) ?? [];
  return x === undefined ? null : <circle cx={x} cy={y} r={3} fill="currentColor" />;
}

Throws outside a <PizzaChart>.

Returns

PizzaChartContextValue

On this page