d3-interactive-datatable
/d3-interactive-datatable
Buduje interaktywne tabele danych w D3.js powiązane z innymi wizualizacjami D3: podświetlanie po kliknięciu, wspólne zaznaczanie i formatowane kolumny liczbowe.
- Autor
- cxcscmu ↗
- Repozytorium
- SkillLearnBench ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 02.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 02.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Buduje interaktywne tabele danych w D3.js powiązane z innymi wizualizacjami D3: podświetlanie po kliknięciu, wspólne zaznaczanie i formatowane kolumny liczbowe.
Oryginalny opis (EN)
Build interactive data tables with D3.js that are linked to other D3 visualizations. Use this skill when building HTML tables with D3 that need click-to-highlight interaction, synchronized selection with charts, or formatted numeric columns. Triggers on: data table, interactive table, linked table and chart, click to highlight.
Jak działa
- Overview
- Building the Table
- Formatting Market Cap
- Click-to-Highlight Synchronization
- Styling
Podgląd SKILL.md
---
name: d3-interactive-datatable
description: >
Build interactive data tables with D3.js that are linked to other D3 visualizations.
Use this skill when building HTML tables with D3 that need click-to-highlight interaction,
synchronized selection with charts, or formatted numeric columns. Triggers on: data table,
interactive table, linked table and chart, click to highlight.
---
# D3 Interactive Data Table
## Overview
Create HTML `<table>` elements using D3's data join pattern, with click-based interaction
that synchronizes with other visualizations (e.g., a bubble chart).
## Building the Table
```js
const table = d3.select("#table-container")
.append("table");
const thead = table.append("thead").append("tr");
thead.selectAll("th")
.data(columns)
.join("th")
.text(d => d.label);
const tbody = table.append("tbody");
const rows = tbody.selectAll("tr")
.data(data)
.join("tr")
.attr("data-ticker", d => d.ticker);
rows.selectAll("td")
.data(d => columns.map(col => col.accessor(d)))
.join("td")
.text(d => d);
```
## Formatting Market Cap
Format large numbers into human-readable form (e.g., 1.64T, 345.98B):
```js
function formatMarketCap(value) {
if (!value) return "N/A";
if (value >= 1e12) return (value / 1e12).toFixed(2) + "T";
if (value >= 1e9) return (value / 1e9).toFixed(2) + "B";
if (value >= 1e6) return (value / 1e6).toFixed(2) + "M";
return value.toLocaleString();
}
```
## Click-to-Highlight Synchronization
### Pattern: Shared Selection State
Maintain a shared selection state and update both the chart and the table when selection changes.
```js
function selectStock(ticker) {
// Highlight the table row
d3.selectAll("#table-container tr")
.classed("highlighted", d => d && d.ticker === ticker);
// Highlight the bubble
d3.selectAll(".bubble")
.classed("highlighted", d => d.ticker === ticker);
// Scroll the table row into view
const row = document.querySelector(`tr[data-ticker="${ticker}"]`);
if (row) row.scrollIntoView({ behavior: "smooth", block: "center" });
}
```
### Binding Click Events
```js
// On bubble click
bubbles.on("click", (event, d) => selectStock(d.ticker));
// On table row click
rows.on("click", (event, d) => selectStock(d.ticker));
```
## Styling
- Use `position: sticky` on `<thead>` for scrollable tables
- Highlight rows with a distinct background color on `.highlighted` class
- Add hover effects on rows for discoverability
- Use alternating row colors for readability
Wersje
W bazie nie ma innych skilli o nazwie d3-interactive-datatable.
Migawka bazy z 13.11.2026 · wersja paczki d091668adeaf (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 90build-interactive-data-table-with-bubble-sync
Buduje tabelę danych HTML, której podświetlenie synchronizuje się z wykresem bąbelkowym D3 po kliknięciu w obu kierunkach. - 100evidence-data-components
Pokazuje metryki i tabele danych w Evidence.dev komponentami BigValue, DataTable, Delta i Value z formatowaniem. - 100d3-chart-table-sync
Synchronizuje interakcje między wizualizacjami D3 a tabelami HTML, tak że kliknięcie lub najechanie podświetla powiązane elementy w obu miejscach. - 90visualize-data
Tworzy wykresy i tabele z zapytań, gdy użytkownik chce zobaczyć dane graficznie albo w sformatowanej tabeli. - 87data-inspect
Pokazuje schemat aktywnego zbioru danych: tabele, kolumny, liczbę wierszy i relacje, a w razie potrzeby szczegóły jednej tabeli. - 100data-inspect
Pokazuje schemat aktywnego zbioru danych: tabele, kolumny, liczby wierszy i relacje, także dla wskazanej tabeli.