DATA / 099

Sparkline

小さな折れ線グラフ
短い折れ線で、値の変化の傾向を示します。

実際のHTML・CSSで描かれた見本です。

ラボで詳しく試す ↗

ひとつ試すなら

どこが変わるかを観察して、似た表現と見比べてみよう。

こんなときに

表やカード内で、推移を簡潔に添えるとき。

仕組みと使い方

数値の読み取りが重要なら、軸やラベルも用意します。

推移折れ線sparklineグラフ
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample .spark{width:230px}.sample small{font-family:monospace;display:block;margin-bottom:8px}
</style>
<div class="sample">
<div class="spark"><small>例示データ · 7日間</small><svg viewBox="0 0 230 110" role="img" aria-label="20、40、32、67、48、79、90と推移する例示データ"><path d="M5 95 40 75 75 83 110 48 145 67 180 36 220 25V108H5Z" fill="#bda8e84d"/><path d="M5 95 40 75 75 83 110 48 145 67 180 36 220 25" fill="none" stroke="#8b6cbb" stroke-width="4" stroke-linejoin="round"/><circle cx="220" cy="25" r="6" fill="#8b6cbb"/></svg></div>
</div>