Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Footer
  • MenuNew
  • Navbar
  • On This PageNew
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Button
  • Checkbox
  • Color Picker
    • Date
    • Date Range
    • Datetime
    • Datetime Range
    • Time
    • Time Range
  • File Upload
  • NumericNew
  • Radio Button
  • RatingNew
  • Select
  • Slider
  • Switch
  • Textfield
  • Alert
  • Avatar
  • Chip
  • Icon
  • Progress
  • Skeleton
  • Spinner
  • TooltipNew
  • Data Table
  • Pagination
  • Pick List
  • BarcodeNew
  • QR CodeNew
  • CalendarNew
  • Table
  • Overview
  • Area
  • Bar
  • Box Plot
  • Bullet
  • Bump
  • Candlestick
  • Column
  • Dot Plot
  • Dumbbell
  • Funnel
  • Gantt
  • Gauge
  • Heatmap
  • Histogram
  • Icon
  • Line
  • Lollipop
  • Matrix
  • Nightingale
  • Parallel Coordinates
  • Pie
  • Quadrant
  • Radar
  • Radial Bar
  • Range
  • Scatter
  • Slope
  • Small Multiples
  • Strip Plot
  • Treemap
  • Waffle
  • Waterfall
  • Arc Diagram
  • Barcode
  • Beeswarm
  • Bump Area
  • Categorical Scatter
  • Chord Diagram
  • Circular Treemap
  • Contour
  • Convex Treemap
  • Density Plot
  • Dendrogram
  • Euler Diagram
  • Flowchart
  • Hexagonal Binning
  • Horizon
  • Marimekko
  • Network Diagram
  • Radial Histogram
  • Ridgeline
  • Sankey
  • Stream Graph
  • Sunburst
  • Venn Diagram
  • Violin Plot
  • Word Cloud
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Charts

TwHexbinChart

TwHexbinChart is a Blazor hexbin chart that tiles the plot with hexagons shaded by how many points fall in each, for scatter data too dense to read.

Last updated 18 October 2026

Please be aware this component is new, may have bugs and/or be subject to change. Please report any bugs at https://github.com/twblazor/twblazor/issues.

Basic usage

TwHexbinChart takes the same ChartPointSeries as a scatter plot, tiles the plot with hexagons and shades each by how many points fall inside it. Use it when there are so many points that dots would pile into a blob.
Session length against pages viewedOne point per session
Pages
051015
051015
19.85, 12.14Count 12
22.25, 12.81Count 19
25.36, 13.42Count 6
12.03, 8.82Count 7
15.12, 9.86Count 25
18.11, 10.25Count 22
21.03, 10.07Count 19
23.96, 10.08Count 9
7.83, 6.74Count 14
10.53, 7.14Count 22
13.65, 7.42Count 20
16.4, 7.31Count 21
19.3, 7.76Count 22
22.18, 8.59Count 5
2.71, 4.14Count 11
5.83, 4.98Count 27
9.04, 4.92Count 20
12.07, 4.82Count 21
14.94, 5.47Count 16
1.75, 1.79Count 25
4.63, 1.93Count 27
7.52, 2.41Count 22
9.81, 3.18Count 8
051015202530
Minutes
RAZOR
<TwChart Title="Session length against pages viewed" Description="One point per session">
    <TwHexbinChart Series="@_sessions" XTitle="Minutes" YTitle="Pages" />
</TwChart>
CSHARP
@code {
    // A repeatable cloud of 400 sessions: longer sessions view more pages, with some scatter.
    private readonly ChartPointSeries[] _sessions =
    [
        new("Sessions", [.. Enumerable.Range(0, 400).Select(index =>
        {
            var minutes = 2 + index % 37 * 0.6 + Math.Sin(index * 1.7) * 3;
            var pages = 1 + minutes * 0.45 + Math.Cos(index * 2.3) * 2.5;
            return new ChartPoint(Math.Max(0.5, minutes), Math.Max(1, pages));
        })])
    ];
}

Bin size

BinWidth is the width of a hexagon as a percentage of the plot's width, from 4 to 25. Smaller hexagons show finer detail but need more points to fill; larger ones smooth out the noise.
FineBinWidth 6
Pages
051015
051015
21.91, 13.27Count 3
22.63, 13.4Count 6
25.35, 14.08Count 4
18.46, 11.69Count 7
20.65, 12.21Count 13
22.32, 12.47Count 5
23.57, 12.55Count 1
25.38, 12.08Count 2
14.43, 9.88Count 5
15.95, 10.27Count 13
17.84, 10.58Count 6
19.36, 10.45Count 6
21.1, 10.42Count 8
22.9, 10.43Count 4
25.32, 10.4Count 4
11.97, 8.78Count 6
13.32, 8.94Count 7
14.78, 8.97Count 8
16.95, 9Count 7
18.68, 8.99Count 7
20.28, 8.86Count 7
22.19, 8.92Count 11
7.21, 6.74Count 2
8.81, 7.25Count 10
10.02, 7.46Count 5
12.26, 7.53Count 10
14.05, 7.67Count 5
16.01, 7.17Count 6
17.83, 7.43Count 7
18.96, 7.36Count 5
20.86, 8Count 4
5.03, 5.49Count 1
5.76, 5.84Count 10
7.63, 6.12Count 10
9.69, 6.03Count 9
11.59, 5.97Count 9
13.38, 5.89Count 7
14.88, 5.75Count 12
16.34, 6.19Count 9
18.28, 6.74Count 3
1.59, 3.98Count 7
2.99, 4.2Count 7
4.94, 4.37Count 7
6.91, 4.52Count 9
9.08, 4.28Count 6
10.24, 4.38Count 5
12.02, 4.26Count 10
14.05, 5.02Count 4
2.01, 2.69Count 5
4.53, 2.91Count 7
5.94, 2.79Count 5
7.88, 2.67Count 14
9.62, 3.17Count 9
11.6, 3.72Count 1
1.58, 1.2Count 13
3.06, 1.31Count 10
5.21, 1.38Count 12
6.66, 1.61Count 5
051015202530
Minutes
CoarseBinWidth 16
Pages
051015
051015
13.08, 9.34Count 2
17.54, 10.66Count 32
21.63, 11.64Count 46
25.34, 12.21Count 10
6.24, 6.03Count 17
10.25, 7.13Count 45
14.97, 7.46Count 67
19.49, 8.07Count 34
22.58, 8.79Count 3
3.11, 2.49Count 64
7.79, 3.31Count 58
12.19, 4.67Count 22
051015202530
Minutes
RAZOR
<div class="grid gap-8 md:grid-cols-2">
    <TwChart Title="Fine" Description="BinWidth 6">
        <TwHexbinChart Series="@_sessions" BinWidth="6" XTitle="Minutes" YTitle="Pages" Height="ChartHeight.Small" />
    </TwChart>
    <TwChart Title="Coarse" Description="BinWidth 16">
        <TwHexbinChart Series="@_sessions" BinWidth="16" XTitle="Minutes" YTitle="Pages" Height="ChartHeight.Small" />
    </TwChart>
</div>

Several series

Every series is combined into one cloud before counting, so you can pass data in whatever groups you hold it in. Here two clusters of readings show as two dark patches.
Sensor readingsTemperature against humidity
Humidity
304050607080
304050607080
24.16, 76.07Readings 20
25.23, 75.53Readings 29
27.51, 75.89Readings 26
29.48, 74.12Readings 47
24.74, 65.73Readings 27
27.11, 66.03Readings 3
27.79, 65.72Readings 17
29.72, 64.58Readings 11
12.55, 45.23Readings 23
14.38, 44.51Readings 14
16.02, 44.9Readings 11
17.59, 45.16Readings 11
19.36, 44.99Readings 27
12.3, 37.75Readings 21
13.56, 36.06Readings 15
15.33, 38.97Readings 11
16.83, 35.77Readings 12
18.42, 38.29Readings 15
19.78, 37.42Readings 20
1015202530
Temperature
RAZOR
<TwChart Title="Sensor readings" Description="Temperature against humidity">
    <TwHexbinChart Series="@_readings" XTitle="Temperature" YTitle="Humidity" CountLabel="Readings" BinWidth="8" Height="ChartHeight.Large" />
</TwChart>
CSHARP
@code {
    private readonly ChartPointSeries[] _readings =
    [
        new("Greenhouse", [.. Enumerable.Range(0, 180).Select(index => new ChartPoint(27 + Math.Sin(index * 0.9) * 3, 72 + Math.Cos(index * 1.3) * 8))]),
        new("Warehouse", [.. Enumerable.Range(0, 180).Select(index => new ChartPoint(16 + Math.Sin(index * 1.1) * 4, 41 + Math.Cos(index * 0.7) * 6))])
    ];
}

When to use

Use a hexbin chart when a scatter plot has too many points to tell apart. Shading uses a single hue, so darker always means more points, and hexagons with no points are left out. For fewer points use TwScatterChart.

Summary

Tooltips and the table view give the average position and the count of the points in each hexagon.

Shared features

The legend, tooltips, keyboard navigation, table view, value formatting, height and empty state work the same on every chart. See TwChart for those options.

Keyboard navigation

The plot is a single Tab stop. Each data point is announced with its series and value as focus reaches it, and the table view presents the same data without the plot.
Key What it does
Tab Moves focus into the plot, onto the data point last visited.
Arrow Right or Arrow Down Moves to the next data point.
Arrow Left or Arrow Up Moves to the previous data point.
Home or End Moves to the first or last data point.
Escape Hides the tooltip of the focused data point.
Enter or Space On a legend item: shows or hides that series. On the table button: switches between the chart and its data table.

On this page

  • Basic usage
  • Bin size
  • Several series
  • When to use
  • Summary
  • Shared features
  • Keyboard navigation
Discord (opens in a new tab) • GitHub (opens in a new tab) • Documentation (opens in a new tab) • MIT License (opens in a new tab) • llms.txt (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload