Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Slope Chart Stats Block for Vue

Six clubs on two vertical axes, after the first and the second quarter, with a solid 2 px line for a club that climbed and a dashed 1 px line for one that slipped, labelled at both ends with the change.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A slope chart for Vue with Ark UI. A centred header says how many clubs climbed the table, "3 of 6 clubs climbed the table in Q2", over one framed figure no wider than max-w-2xl. Two vertical axes, after Q1 and after Q2, carry a line for each of six clubs from its rank on the first to its rank on the second. A club that climbed gets a solid 2 px line and solid dots; one that slipped gets a 1 px dashed line at 55% and lighter dots, so the two read apart without green or red. Each end is labelled with the rank and the club, and the second end adds an arrow and the number of places moved. The ranks, the positions, the changes and the headline are computed at module scope from the two ranks per club, and the same ranks are an unseen table for screen readers. On a phone the club names shorten and the change drops under the name. For league tables, rankings over time and any before-and-after comparison.

FAQ

How do I change the clubs or add more?

Edit CLUBS at the top of the file: a name, a short name for phones and a rank after each quarter (1 is the top, and each rank should appear once on each side). Each place is 3 rem tall, so set the plot's height (h-72 for six) to the number of places times 3 rem. The lines, the labels, the changes and the headline are computed from the ranks.

How do climbs and slips differ without colour?

By weight, line style and glyph: a climb is a 2 px solid line with solid dots, a bold club name and an up arrow; a slip is a 1 px dashed line at 55% with lighter dots and a down arrow. A club that held its place would get a dash glyph and, with no climb to show, the slip style of line. The key under the chart shows the two line styles.

Is it accessible?

The drawing and its labels are hidden from assistive technology and an unseen table lists every club with its two ranks and the change in words ("up 2", "down 3"), in the order of the second ranking. The figure's caption names the chart. The plot is forced left to right so Q1 stays at the start in every language, and the arrows point up and down, so they never mirror.

What changes on a phone?

The gutters narrow to 5 rem, the club names switch to their short forms and each end label wraps so the arrow and number sit under the name. The plot keeps its height, so the lines stay readable at 320 pixels. The lines draw in from the start once on load; with reduced motion they are simply there.

What about ties?

Ranks are whole places, so give tied clubs different places, or change yOf to use fractional ranks (a tie at 2 and 3 is 2.5 for both). The labels are laid out one per place, so a tie on the same place would overlap; the unseen table would list both.