Data Pure CSS

Bar chart

A CSS-only bar chart: bars grow in steps as the chart scrolls into view, each column’s tooltip opens on hover and keyboard focus, and the value axis is a nice-ticks ladder in your locale’s digits; negatives clamp to the baseline and the same data ships as a hidden table.

Real scenarios

The component as it is used in a product — not a specimen grid.

A week of support conversations

The single-series shape: a plain label → value map through data, no series plumbing. The bars grow in steps as the chart scrolls into view, the value axis is a nice-ticks ladder in the reader’s digits, and Tab lands on each column — its tooltip opens on focus just as it does on hover.

Conversations per day

Last week · all channels

Conversations per day
Value
Sat132
Sun98
Mon121
Tue144
Wed167
Thu89
Fri74

Week total: 825 conversations — the same numbers ship as a visually-hidden table for screen readers.

Revenue by channel, side by side

Two series through labels + series sit next to each other in the fixed chart-colour order, and the legend names them. The tallest single bar decides the axis — ۸۰ here lifts the ladder to ۱۰۰.

Monthly revenue

Million tomans

  • Web
  • App
Monthly revenue
WebApp
Apr4231
May4835
Jun6144
Jul5552
Aug7258
Sep8066

Tickets by language, stacked

With stacked the series pile on one another and each column’s total drives the axis; the tooltip adds the total row on top of the two owners.

Tickets by language

This week

  • Solved by the agent
  • Handed to a human
Tickets by language
Solved by the agentHanded to a human
Persian48688
English36261
Arabic21444
Turkish16827
Spanish12219

1,352 agent-solved · 239 handed over

Important props

Important props
Prop Type Default What it does
data array null One series: ['Mon' => 132, …] — the labels come from the keys.
labels / series array [] / null Several series: labels => […], series => [['name' => …, 'values' => […]]]; without labels 1..n are generated.
stacked bool false The series stack instead of sitting side by side, column totals drive the axis and the tooltip adds the total row.
title / subtitle string null The card’s title and subtitle; with more than one series the colour legend sits beside them.
height int / string 240 The plot height — a number (pixels) or any CSS length such as “16rem”.
locale string null The locale for value and tick digits (the app’s by default).

Snippet

<x-nx::bar-chart title="گفت‌وگوهای روزانه" subtitle="هفتهٔ جاری" :data="[
    'شنبه' => 132, 'یکشنبه' => 98, 'دوشنبه' => 121, 'سه‌شنبه' => 144,
]" />

{{-- چند سری، روی هم: جمع هر ستون محور را می‌سازد --}}
<x-nx::bar-chart :labels="$months" stacked :series="[
    ['name' => 'وب', 'values' => $web],
    ['name' => 'اپ', 'values' => $app],
]" />