Financial charts
Volume profile
Horizontal histogram of traded volume by price, for the visible range or per session.
"use client";
import { ChartCanvas, Pane } from "@reincharts/core";
import { CandlestickSeries, VolumeProfileSeries } from "@reincharts/series";
import { Grid, XAxis, YAxis } from "@reincharts/axes";
import { Crosshair } from "@reincharts/coordinates";
import { daily } from "@/lib/data";
import { useDocsChartTheme } from "@/lib/use-docs-theme";
export default function VolumeProfile() {
const theme = useDocsChartTheme();
return (
<ChartCanvas data={daily} theme={theme} barSpacing={6}>
<Pane>
<Grid />
{/* volume by price over the visible bars, with the point of control */}
<VolumeProfileSeries bins={30} maxWidth={0.25} />
<CandlestickSeries />
<YAxis />
</Pane>
<XAxis />
<Crosshair />
</ChartCanvas>
);
}Usage
<VolumeProfileSeries bins={30} />
<CandlestickSeries />The profile covers the visible bars and updates while you pan and zoom. Each bar's volume is spread over its low-high
range (or assigned to a single price), split into up and down volume, and the row with the most volume, the
point of control, is drawn as a line (showPoc, pocColor). side and maxWidth place the rows; the
volumeProfile() function returns the same rows for your own drawing.
Session profiles
sessionStart(d, i, prev) starts a new profile whenever it returns true, for example on every new trading day. The
example aggregates 1-minute bars into 15-minute bars with aggregateBars from @reincharts/datafeed and draws one
profile per day.