Revenue over time
January–June 2026 · USD
View data table
| Month | Recurring | Expansion |
|---|---|---|
| Jan | $12,400 | $2,800 |
| Feb | $13,800 | $3,400 |
| Mar | $12,900 | $3,100 |
| Apr | $16,200 | $4,200 |
| May | $17,800 | $4,800 |
| Jun | $19,600 | $5,600 |
Data displayExtension
A line, area, bar or donut chart drawn from a native data table, which stays available as the fallback.
| Class name | Type | Description |
|---|---|---|
chartplf:chart | Component | The figure that holds the data table |
chart-viewplf:chart-view | Part | The box the script adds before the data and fills, or an empty, hidden one the page places |
chart-frameplf:chart-frame | Part | The chart layout the script adds |
chart-plotplf:chart-plot | Part | The drawing area the script adds |
chart-canvasplf:chart-canvas | Part | The focusable canvas the script adds |
chart-legendplf:chart-legend | Part | The legend the script adds |
chart-legend-buttonplf:chart-legend-button | Part | A series toggle the script adds |
chart-legend-labelplf:chart-legend-label | Part | A toggle's name the script adds |
chart-swatchplf:chart-swatch | Part | A toggle's color the script adds |
chart-tooltipplf:chart-tooltip | Part | The values tooltip the script adds |
chart-tooltip-titleplf:chart-tooltip-title | Part | The tooltip's category the script adds |
chart-tooltip-valuesplf:chart-tooltip-values | Part | The tooltip's value list the script adds |
chart-tooltip-labelplf:chart-tooltip-label | Part | A series name the script adds |
chart-tooltip-valueplf:chart-tooltip-value | Part | A formatted value the script adds |
chart-dataplf:chart-data | Part | The data table disclosure |
chart-data-toggleplf:chart-data-toggle | Part | The disclosure's summary |
chart-data-scrollplf:chart-data-scroll | Part | The table's scroll region |
chart-emptyplf:chart-empty | Part | The message the script adds, shown when nothing is left to draw |
chart-helpplf:chart-help | Part | The keyboard instructions the script adds |
chart-statusplf:chart-status | Part | The screen-reader status the script adds |
The table is the data source and the accessible alternative: it needs a caption, which names the canvas, one header row and one body without merged cells, each row starting with a unique <th scope="row">.
January–June 2026 · USD
| Month | Recurring | Expansion |
|---|---|---|
| Jan | $12,400 | $2,800 |
| Feb | $13,800 | $3,400 |
| Mar | $12,900 | $3,100 |
| Apr | $16,200 | $4,200 |
| May | $17,800 | $4,800 |
| Jun | $19,600 | $5,600 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Revenue over time</h3>
<p class="card-description">January–June 2026 · USD</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-currency="USD">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Revenue over time data">
<table class="table">
<caption>Revenue over time</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Recurring</th>
<th scope="col">Expansion</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="12400">$12,400</td>
<td data-plf-value="2800">$2,800</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="13800">$13,800</td>
<td data-plf-value="3400">$3,400</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="12900">$12,900</td>
<td data-plf-value="3100">$3,100</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="16200">$16,200</td>
<td data-plf-value="4200">$4,200</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="17800">$17,800</td>
<td data-plf-value="4800">$4,800</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="19600">$19,600</td>
<td data-plf-value="5600">$5,600</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Revenue over time</h3>
<p class="plf:card-description">January–June 2026 · USD</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-currency="USD">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Revenue over time data">
<table class="plf:table">
<caption>Revenue over time</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Recurring</th>
<th scope="col">Expansion</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="12400">$12,400</td>
<td data-plf-value="2800">$2,800</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="13800">$13,800</td>
<td data-plf-value="3400">$3,400</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="12900">$12,900</td>
<td data-plf-value="3100">$3,100</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="16200">$16,200</td>
<td data-plf-value="4200">$4,200</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="17800">$17,800</td>
<td data-plf-value="4800">$4,800</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="19600">$19,600</td>
<td data-plf-value="5600">$5,600</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>January–June 2026 · USD
| Month | Recurring | Expansion |
|---|---|---|
| Jan | $12,400 | $2,800 |
| Feb | $13,800 | $3,400 |
| Mar | $12,900 | $3,100 |
| Apr | $16,200 | $4,200 |
| May | $17,800 | $4,800 |
| Jun | $19,600 | $5,600 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Revenue over time</h3>
<p class="card-description">January–June 2026 · USD</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-type="area" data-plf-currency="USD">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Revenue over time data">
<table class="table">
<caption>Revenue over time</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Recurring</th>
<th scope="col">Expansion</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="12400">$12,400</td>
<td data-plf-value="2800">$2,800</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="13800">$13,800</td>
<td data-plf-value="3400">$3,400</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="12900">$12,900</td>
<td data-plf-value="3100">$3,100</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="16200">$16,200</td>
<td data-plf-value="4200">$4,200</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="17800">$17,800</td>
<td data-plf-value="4800">$4,800</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="19600">$19,600</td>
<td data-plf-value="5600">$5,600</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Revenue over time</h3>
<p class="plf:card-description">January–June 2026 · USD</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-type="area" data-plf-currency="USD">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Revenue over time data">
<table class="plf:table">
<caption>Revenue over time</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Recurring</th>
<th scope="col">Expansion</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="12400">$12,400</td>
<td data-plf-value="2800">$2,800</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="13800">$13,800</td>
<td data-plf-value="3400">$3,400</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="12900">$12,900</td>
<td data-plf-value="3100">$3,100</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="16200">$16,200</td>
<td data-plf-value="4200">$4,200</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="17800">$17,800</td>
<td data-plf-value="4800">$4,800</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="19600">$19,600</td>
<td data-plf-value="5600">$5,600</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>2026 · Sample data
| Quarter | Organic | Referral |
|---|---|---|
| Q1 | 420 | 180 |
| Q2 | 560 | 240 |
| Q3 | 610 | 320 |
| Q4 | 740 | 390 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Signups by channel</h3>
<p class="card-description">2026 · Sample data</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-type="bar">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Signups by channel data">
<table class="table">
<caption>Signups by channel</caption>
<thead>
<tr>
<th scope="col">Quarter</th>
<th scope="col">Organic</th>
<th scope="col">Referral</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Q1</th>
<td data-plf-value="420">420</td>
<td data-plf-value="180">180</td>
</tr>
<tr>
<th scope="row">Q2</th>
<td data-plf-value="560">560</td>
<td data-plf-value="240">240</td>
</tr>
<tr>
<th scope="row">Q3</th>
<td data-plf-value="610">610</td>
<td data-plf-value="320">320</td>
</tr>
<tr>
<th scope="row">Q4</th>
<td data-plf-value="740">740</td>
<td data-plf-value="390">390</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Signups by channel</h3>
<p class="plf:card-description">2026 · Sample data</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-type="bar">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Signups by channel data">
<table class="plf:table">
<caption>Signups by channel</caption>
<thead>
<tr>
<th scope="col">Quarter</th>
<th scope="col">Organic</th>
<th scope="col">Referral</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Q1</th>
<td data-plf-value="420">420</td>
<td data-plf-value="180">180</td>
</tr>
<tr>
<th scope="row">Q2</th>
<td data-plf-value="560">560</td>
<td data-plf-value="240">240</td>
</tr>
<tr>
<th scope="row">Q3</th>
<td data-plf-value="610">610</td>
<td data-plf-value="320">320</td>
</tr>
<tr>
<th scope="row">Q4</th>
<td data-plf-value="740">740</td>
<td data-plf-value="390">390</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>data-plf-axes="x" keeps the category labels alone, for a small chart in a card. A chart with one series has no legend, and whole amounts show no decimals.
January–June 2026
| Month | Revenue |
|---|---|
| Jan | $15,200 |
| Feb | $17,200 |
| Mar | $16,000 |
| Apr | $20,400 |
| May | $22,600 |
| Jun | $25,200 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Monthly revenue</h3>
<p class="card-description">January–June 2026</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-type="bar" data-plf-axes="x" data-plf-currency="USD">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Monthly revenue data">
<table class="table">
<caption>Monthly revenue</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Revenue</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="15200">$15,200</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="17200">$17,200</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="16000">$16,000</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="20400">$20,400</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="22600">$22,600</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="25200">$25,200</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Monthly revenue</h3>
<p class="plf:card-description">January–June 2026</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-type="bar" data-plf-axes="x" data-plf-currency="USD">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Monthly revenue data">
<table class="plf:table">
<caption>Monthly revenue</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Revenue</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Jan</th>
<td data-plf-value="15200">$15,200</td>
</tr>
<tr>
<th scope="row">Feb</th>
<td data-plf-value="17200">$17,200</td>
</tr>
<tr>
<th scope="row">Mar</th>
<td data-plf-value="16000">$16,000</td>
</tr>
<tr>
<th scope="row">Apr</th>
<td data-plf-value="20400">$20,400</td>
</tr>
<tr>
<th scope="row">May</th>
<td data-plf-value="22600">$22,600</td>
</tr>
<tr>
<th scope="row">Jun</th>
<td data-plf-value="25200">$25,200</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>2026 · Sample data
| Quarter | Organic | Referral |
|---|---|---|
| Q1 | 420 | 180 |
| Q2 | 560 | 240 |
| Q3 | 610 | 320 |
| Q4 | 740 | 390 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Signups by channel</h3>
<p class="card-description">2026 · Sample data</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-type="stacked-bar">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Signups by channel data">
<table class="table">
<caption>Signups by channel</caption>
<thead>
<tr>
<th scope="col">Quarter</th>
<th scope="col">Organic</th>
<th scope="col">Referral</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Q1</th>
<td data-plf-value="420">420</td>
<td data-plf-value="180">180</td>
</tr>
<tr>
<th scope="row">Q2</th>
<td data-plf-value="560">560</td>
<td data-plf-value="240">240</td>
</tr>
<tr>
<th scope="row">Q3</th>
<td data-plf-value="610">610</td>
<td data-plf-value="320">320</td>
</tr>
<tr>
<th scope="row">Q4</th>
<td data-plf-value="740">740</td>
<td data-plf-value="390">390</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Signups by channel</h3>
<p class="plf:card-description">2026 · Sample data</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-type="stacked-bar">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Signups by channel data">
<table class="plf:table">
<caption>Signups by channel</caption>
<thead>
<tr>
<th scope="col">Quarter</th>
<th scope="col">Organic</th>
<th scope="col">Referral</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Q1</th>
<td data-plf-value="420">420</td>
<td data-plf-value="180">180</td>
</tr>
<tr>
<th scope="row">Q2</th>
<td data-plf-value="560">560</td>
<td data-plf-value="240">240</td>
</tr>
<tr>
<th scope="row">Q3</th>
<td data-plf-value="610">610</td>
<td data-plf-value="320">320</td>
</tr>
<tr>
<th scope="row">Q4</th>
<td data-plf-value="740">740</td>
<td data-plf-value="390">390</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>A donut takes exactly one series with no negative values; its legend toggles the categories.
2026 · Sample data
| Plan | Subscribers |
|---|---|
| Free | 1,260 |
| Pro | 680 |
| Team | 340 |
| Enterprise | 120 |
<article class="card">
<header class="card-header">
<h3 class="card-title">Subscribers by plan</h3>
<p class="card-description">2026 · Sample data</p>
</header>
<div class="card-body">
<figure class="chart" data-plf-chart data-plf-type="donut">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Subscribers by plan data">
<table class="table">
<caption>Subscribers by plan</caption>
<thead>
<tr>
<th scope="col">Plan</th>
<th scope="col">Subscribers</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Free</th>
<td data-plf-value="1260">1,260</td>
</tr>
<tr>
<th scope="row">Pro</th>
<td data-plf-value="680">680</td>
</tr>
<tr>
<th scope="row">Team</th>
<td data-plf-value="340">340</td>
</tr>
<tr>
<th scope="row">Enterprise</th>
<td data-plf-value="120">120</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Subscribers by plan</h3>
<p class="plf:card-description">2026 · Sample data</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" data-plf-chart data-plf-type="donut">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Subscribers by plan data">
<table class="plf:table">
<caption>Subscribers by plan</caption>
<thead>
<tr>
<th scope="col">Plan</th>
<th scope="col">Subscribers</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Free</th>
<td data-plf-value="1260">1,260</td>
</tr>
<tr>
<th scope="row">Pro</th>
<td data-plf-value="680">680</td>
</tr>
<tr>
<th scope="row">Team</th>
<td data-plf-value="340">340</td>
</tr>
<tr>
<th scope="row">Enterprise</th>
<td data-plf-value="120">120</td>
</tr>
</tbody>
</table>
</div>
</details>
</figure>
</div>
</article>The chart follows its table, so add the rows your request returns to it. Until then, the chart shows data-plf-empty.
Monday–Sunday · Sample data
| Day | Visitors |
|---|
<article class="card">
<header class="card-header">
<h3 class="card-title">Visitors this week</h3>
<p class="card-description">Monday–Sunday · Sample data</p>
</header>
<div class="card-body">
<figure class="chart" id="visitors-chart" data-plf-chart data-plf-type="bar" data-plf-empty="Loading visitors…">
<details class="chart-data" open>
<summary class="chart-data-toggle">View data table</summary>
<div class="table-wrapper chart-data-scroll" role="region" tabindex="0" aria-label="Visitors this week data">
<table class="table">
<caption>Visitors this week</caption>
<thead>
<tr>
<th scope="col">Day</th>
<th scope="col">Visitors</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</details>
</figure>
</div>
</article>
<script>
const chart = document.getElementById('visitors-chart');
async function loadVisitors() {
// Your request, here a list of { day, visitors }.
const response = await fetch('/visitors');
if (!response.ok) throw new Error(response.statusText);
const days = await response.json();
chart.querySelector('tbody').replaceChildren(...days.map(({ day, visitors }) => {
const row = document.createElement('tr');
row.innerHTML = '<th scope="row"></th><td></td>';
row.cells[0].textContent = day;
row.cells[1].textContent = visitors.toLocaleString();
row.cells[1].dataset.plfValue = visitors;
return row;
}));
chart.setAttribute('data-plf-empty', 'No visitors this week.');
}
loadVisitors().catch(() => { chart.setAttribute('data-plf-empty', 'Visitors could not be loaded.'); });
</script><article class="plf:card">
<header class="plf:card-header">
<h3 class="plf:card-title">Visitors this week</h3>
<p class="plf:card-description">Monday–Sunday · Sample data</p>
</header>
<div class="plf:card-body">
<figure class="plf:chart" id="visitors-chart" data-plf-chart data-plf-type="bar" data-plf-empty="Loading visitors…">
<details class="plf:chart-data" open>
<summary class="plf:chart-data-toggle">View data table</summary>
<div class="plf:table-wrapper plf:chart-data-scroll" role="region" tabindex="0" aria-label="Visitors this week data">
<table class="plf:table">
<caption>Visitors this week</caption>
<thead>
<tr>
<th scope="col">Day</th>
<th scope="col">Visitors</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</details>
</figure>
</div>
</article>
<script>
const chart = document.getElementById('visitors-chart');
async function loadVisitors() {
// Your request, here a list of { day, visitors }.
const response = await fetch('/visitors');
if (!response.ok) throw new Error(response.statusText);
const days = await response.json();
chart.querySelector('tbody').replaceChildren(...days.map(({ day, visitors }) => {
const row = document.createElement('tr');
row.innerHTML = '<th scope="row"></th><td></td>';
row.cells[0].textContent = day;
row.cells[1].textContent = visitors.toLocaleString();
row.cells[1].dataset.plfValue = visitors;
return row;
}));
chart.setAttribute('data-plf-empty', 'No visitors this week.');
}
loadVisitors().catch(() => { chart.setAttribute('data-plf-empty', 'Visitors could not be loaded.'); });
</script>Chart needs JavaScript and is an extension: the Full script and Full CSS leave it out. The keyboard instructions under a chart show while it has keyboard focus, and screen readers read them as it takes focus. The Full script (pelatform-ui.min.js) and the extension scripts after it start every component on page load, with no code of your own; with Core and single files, the last line starts them. For markup you add later, see Dynamic content.
<link rel="stylesheet" href="pelatform-ui.min.css">
<link rel="stylesheet" href="extensions/chart.min.css">
<script src="pelatform-ui.min.js" defer></script>
<script src="extensions/chart.min.js" defer></script><link rel="stylesheet" href="core/pelatform-ui-core.min.css">
<link rel="stylesheet" href="components/card.min.css">
<link rel="stylesheet" href="components/table.min.css">
<link rel="stylesheet" href="extensions/chart.min.css">
<script src="core/pelatform-ui-core.min.js" defer></script>
<script src="extensions/chart.min.js" defer></script>
<script>document.addEventListener('DOMContentLoaded', () => PLF.init());</script><link rel="stylesheet" href="pelatform-ui.prefixed.min.css">
<link rel="stylesheet" href="extensions/chart.prefixed.min.css">
<script src="pelatform-ui.min.js" defer></script>
<script src="extensions/chart.min.js" defer></script><link rel="stylesheet" href="core/pelatform-ui-core.prefixed.min.css">
<link rel="stylesheet" href="components/card.prefixed.min.css">
<link rel="stylesheet" href="components/table.prefixed.min.css">
<link rel="stylesheet" href="extensions/chart.prefixed.min.css">
<script src="core/pelatform-ui-core.min.js" defer></script>
<script src="extensions/chart.min.js" defer></script>
<script>document.addEventListener('DOMContentLoaded', () => PLF.init());</script>With ESM imports, install the optional chart.js peer, import Chart from @pelatform/ui/extensions/chart and call use(Chart) before init().
| Attribute | Purpose |
|---|---|
data-plf-chart |
The chart element, such as a <figure> |
data-plf-chart-view |
Optional; on an empty, hidden chart-view, places the chart there instead of before the data table |
data-plf-series |
Optional, on a value column’s th scope="col": the series key that setVisibility, the state and events use; the header’s text by default |
data-plf-value |
On each value cell, the number as a plain decimal; the displayed text is never read. Leave it out for a gap |
data-plf-type |
line (default), area, bar, stacked-bar or donut |
data-plf-axes |
all (default), or x for the category labels alone, with no value axis or grid; a donut has no axes |
data-plf-currency |
An ISO 4217 currency code such as USD or IDR |
data-plf-format |
decimal (default), currency (default when a currency is set) or percent, where 0. shows as 25% |
data-plf-locale |
A language tag such as id or en-GB for number formats; any locale the browser’s Intl knows. The nearest lang, then en by default |
data-plf-help, data-plf-legend-label |
Translated keyboard instructions and legend name; English by default, the legend Chart visibility |
data-plf-empty |
The message when nothing is left to draw; No data to show. by default |
| Method | Behavior |
|---|---|
PLF. |
Returns the instance, creating it for valid markup; options (type, axes, format, currency, locale, help, legendLabel, empty) override the attributes |
PLF. |
Returns the instance or null |
instance. |
Changes the chart type. Returns false when canceled, unchanged or invalid, such as a donut with more than one series |
instance. |
Shows or hides a series by its key, or a category on a donut by its row header |
instance. |
Rereads the colors after you change them; the chart follows its table, data-plf-empty and its root’s theme by itself. Returns true when the data changed |
instance. |
Returns a copy with type, labels, series, hiddenSeries, hiddenCategories, activeIndex, empty and the number settings |
instance. |
Removes the drawn chart and its listeners and shows the table again |
| Event | When |
|---|---|
plf: |
Before a type, visibility or table change; cancelable except for a table change, which has already happened |
plf: |
After the change is drawn |
Each event’s detail:
| Property | Value |
|---|---|
instance |
The Chart instance |
trigger |
The legend button used, otherwise null |
reason |
type, visibility, or refresh after a table change |
previousState |
The state before the change, shaped like getState |
state |
The state after the change |
| Key | Action |
|---|---|
| Left Arrow, Right Arrow | On the canvas, show the previous or next category’s values; reversed right to left |
| Home, End | Show the first or last category’s values |
| Escape | Close the values tooltip |
The canvas reads its colors when it draws, so call refresh() after changing them.
| Variable | Default |
|---|---|
--plf-chart-height |
16rem (256px) |
--plf-chart-color |
Text |
--plf-chart-radius |
--plf-radius-md, 0. (6px), on the canvas |
--plf-chart-bar-radius |
--plf-radius-sm, 0. (4px), on bars |
--plf-chart-series-1 … --plf-chart-series-6 |
Primary, info, success, warning, danger and muted text; repeated after six |
--plf-chart-axis-color |
Muted text |
--plf-chart-grid-color |
--plf-color-border-subtle |
--plf-chart-bg |
Surface, between donut segments |
--plf-chart-tooltip-bg, --plf-chart-tooltip-color |
Surface and text |
--plf-chart-tooltip-border |
--plf-color-border-subtle |