tabla de datos
Un diseño de fuerza es malo en tres cosas que la gente hace constantemente: leer valores exactos, seleccionar a escala y determinar por dónde empezar. UI.table divide un base de datos la parte inferior del lienzo para responder a las tres: las filas del gráfico, ordenables y seleccionables.
El bucle es tabla para buscar, lienzo para comprender, barra lateral para leer:
- La tabla se abre ordenada por solicitudes, por lo que el servicio más ocupado es la primera fila.
- Haga clic en cualquier encabezado para volver a ordenar; haga clic nuevamente para revertir.
- Haga clic en una fila para seleccionarla,
Ctrl+Clickpara agregar una, oShift+Clickpara tomar un rango ** en el orden mostrado** - luego actúa en el lote con las acciones masivas de la barra lateral. - En su lugar, coloque una banda elástica sobre un grupo en el lienzo y las filas correspondientes se iluminarán.
- Limite las filas de los encabezados: el control sigue la columna: escriba en Servicio, elija entre Tipo, establezca límites en Solicitudes/día. que nunca toca el lienzo: el filtro del gráfico permanece en el panel de filtros, por lo que los dos no pueden pelear.
- Nodos / Edges cambian lo que aparece en la lista. CSV y JSON escriben exactamente qué está en la pantalla: esta pestaña, estas columnas, este tipo, este filtro.
El muelle también enumera los nodos que el gráfico está actualmente ocultando, con una columna Visibility decir si el responsable es un filtro o una ocultación manual, por lo que "23 nodos ocultos" es algo que puedes inspeccionar en lugar de confiar.
Arrastre el divisor para cambiar su tamaño o dóblelo hasta su barra de encabezado con el galón. Ninguno mueve el gráfico: la simulación se sintoniza con el contenedor, no con el lienzo, por lo que La apertura y el cierre de Chrome nunca pueden cambiar un diseño.
Consulte Tabla de datos para ver el conjunto de opciones completo.
// import { ColorPaletteMapper, tableColumns } from 'pivotick'
//
// The data dock comes with `mode: 'full'`, folded to its header bar — click the chevron
// or press Shift+T. `open: true` below starts it expanded instead. Everything here is
// optional; `UI: { mode: 'full' }` alone gets you a dock.
//
// Columns are derived when you don't declare any: the graph-aware ones lead (Label,
// Degree, Visibility) and the data keys follow, ordered by how many nodes carry them.
// They are declared here instead, to put `requests` on the right and give three columns
// a row filter — one of each kind, since the control follows the column's `type`.
// `tableColumns` holds the graph-aware ones — clone one to relabel it.
const options = {
UI: {
mode: 'full',
// Full mode's minimap would sit in the corner this card wants for the dock,
// and the dock is the subject — see the Minimap card for that one.
minimap: false,
// Top-left, because this embed is 560px tall and the dock takes 42% of it: the
// canvas that's left is shorter than the mode rail, so the bottom-left corner has
// no column to give. A bottom-left legend would shrink to its header here.
legend: { position: 'top-left' },
table: {
open: true,
height: 0.42,
// Busiest first — the question you actually arrive with.
sort: { key: 'requests', direction: 'desc' },
columns: [
{ ...tableColumns.label, label: 'Service', filterable: true },
{ key: 'kind', label: 'Kind', type: 'select', filterable: true },
{ key: 'owner', label: 'Owner', type: 'select' },
{ key: 'tier', label: 'Tier', type: 'select' },
{ key: 'requests', label: 'Requests / day', type: 'numberRange', align: 'right', filterable: true },
{ ...tableColumns.degree, label: 'Links' },
],
},
},
// Colour by the same `kind` the table shows, so a row and a dot can be matched by
// eye. Declaring `nodeTypeAccessor` is also what earns the canvas its legend.
render: {
nodeTypeAccessor: (node) => node.getData().kind,
defaultNodeStyle: {
color: (node) => palette.getColor(node.getData().kind),
},
},
}const data = {
nodes: [
{ id: 'api', data: { label: 'api-gateway', kind: 'service', owner: 'Platform', requests: 48200, tier: 'edge' } },
{ id: 'auth', data: { label: 'auth-service', kind: 'service', owner: 'Identity', requests: 31400, tier: 'core' } },
{ id: 'billing', data: { label: 'billing-service', kind: 'service', owner: 'Payments', requests: 8600, tier: 'core' } },
{ id: 'search', data: { label: 'search-service', kind: 'service', owner: 'Discovery', requests: 22750, tier: 'core' } },
{ id: 'users-db', data: { label: 'users-db', kind: 'datastore', owner: 'Identity', requests: 39900, tier: 'data' } },
{ id: 'orders-db', data: { label: 'orders-db', kind: 'datastore', owner: 'Payments', requests: 12300, tier: 'data' } },
{ id: 'index', data: { label: 'search-index', kind: 'datastore', owner: 'Discovery', requests: 20100, tier: 'data' } },
{ id: 'cache', data: { label: 'edge-cache', kind: 'datastore', owner: 'Platform', requests: 51000, tier: 'edge' } },
{ id: 'mailer', data: { label: 'mailer', kind: 'worker', owner: 'Payments', requests: 1450, tier: 'async' } },
{ id: 'reindexer', data: { label: 'reindexer', kind: 'worker', owner: 'Discovery', requests: 980, tier: 'async' } },
],
edges: [
{ from: 'api', to: 'auth', data: { label: 'authenticates' } },
{ from: 'api', to: 'search', data: { label: 'queries' } },
{ from: 'api', to: 'billing', data: { label: 'charges' } },
{ from: 'api', to: 'cache', data: { label: 'reads' } },
{ from: 'auth', to: 'users-db', data: { label: 'reads' } },
{ from: 'billing', to: 'orders-db', data: { label: 'writes' } },
{ from: 'billing', to: 'mailer', data: { label: 'enqueues' } },
{ from: 'search', to: 'index', data: { label: 'reads' } },
{ from: 'reindexer', to: 'index', data: { label: 'writes' } },
{ from: 'reindexer', to: 'orders-db', data: { label: 'reads' } },
],
}