Skip to content

blockr.viz ​

Interactive, dashboard-grade output: a chart block with built-in aggregation and drilldown, and a table block for rows, group summaries and Table 1 summaries. Clicking a chart filters what is downstream of it. The right choice when people explore your board rather than read it.

Chart ​

new_chart_block() · plot

Configurable chart with click-to-filter drill-down

ArgumentDescription
typeChart type. Aggregated: bar, waterfall, pie, treemap, boxplot, pointrange. One mark per row: scatter, line, area, band. Also histogram and gantt (intervals on lanes).
categoryColumn whose values become the bars, slices, tiles, boxes or points: one mark per value. The same whichever way a bar lies.
valueColumn func aggregates per category; unused by func = "count". Boxplot and pointrange: the column whose spread each box or point range shows.
funcAggregation of value per category. "identity" draws the value as is; "pct_distinct" is the share of the panel's distinct values (see percent_of).
xColumn on the horizontal axis of a scatter, line, area or band. Histogram: the column that is binned. Gantt: the interval start.
xendInterval end. A row without an end is drawn as a dot at x.
openLogical column. TRUE draws an arrowhead after the bar's end (still ongoing); a TRUE row without an end runs to the last x drawn.
yColumn on the vertical axis. Gantt: the lane.
colorColumn mapped to color, at most 15 levels.
facetColumn to facet by, one small panel per level.
facet_rowColumn whose levels make the rows of a panel grid, facet making its columns. Each row gets its own y scale when facet_scales is "free_y" or "free".
seriesColumn whose values split rows into separate series: one line or point group per value, the bar label on a gantt.
labelColumn written on the marks. A bar, slice or tile shows it only when its rows agree on one value.
orientationWhich way a bar, boxplot or pointrange lies. It changes no mapping: category stays the category either way.
positionLayout of a color split: stacked, side by side, or to 100%.
sort_byCategory order: "value", "data", "alpha", or a column (its per-category minimum). Gantt: "onset", "alpha" or a column. NULL: "data" for date, numeric and factor categories, else "value".
sort_dirSort direction.
value_labelsTRUE writes each bar's value at its end: a stack its total, a filled bar each share.
formatHow numbers print: "number" (separators and up to two decimals, trailing zeros dropped; a value that would round to 0 keeps two significant digits), "compact" (1.2K, 3.4M), "percent" (a fraction times 100, with "%"), ...
unitFree text printed after the number ("CHF"); headers carry it once.
y_transform"log10" draws a base-10 y axis. Values at or below zero are not drawn; a note under the chart counts them.
x_transformAs y_transform, for the x axis of a scatter.
x_limitsThe x axis from and to, as c(0, 100); NA at either end is auto. Dates as "2024-01-01". Marks outside are cut off, not dropped from the data. Drag zoom works inside the limits, and a reset returns to them. A subtit...
y_limitsAs x_limits, for the value axis: y on a scatter, line, area or band, value's axis on the aggregated types, whichever way they lie.
x_ticksWhere the x axis puts its ticks. One number is a step: 10 ticks every 10, at its multiples. On a date axis the step takes a unit, "7 days", "2 weeks", "month", "quarter" or "year"; days and weeks count from the axis...
y_ticksAs x_ticks, for the value axis: y on a scatter, line, area or band, value's axis on the aggregated types, whichever way they lie.
tooltipExtra columns shown in each mark's tooltip.
drillColumn a click filters downstream on, or "auto" for the type's natural target (the clicked group, bin or lane).
line_widthLine width relative to the default (1).
point_sizeMarker size relative to the default (1).
connectHow a line connects its points.
value_linesPositions of dashed reference lines across the value axis: value's axis, y on a scatter, line, area or histogram. Names are labels. Text form: "Target: 4; 6".
x_linesPositions of dashed reference lines across x, or across a bar's category axis: numbers, dates or category values. Names are labels.
yminColumns holding the lower end of an interval per row, the first the outermost. A line draws shaded bands, a scatter error bars.
ymaxColumns holding the upper end of an interval, as ymin.
linetypeColumn whose values set a line's dash: the first value is solid, the others dashed.
shapeColumn whose values set each point's marker: circle, triangle, diamond, square, rounded square, pin, arrow, then again. Levels in factor order, else sorted; a missing value is a circle. A line chart shows its points w...
x_rangesNamed stretches of x shaded behind the marks, as list(Recession = c("2008-01-01", "2009-06-30")). Text form: "Recession: 2008-01-01 to 2009-06-30; ...".
legendWhere the color legend goes. "marks" writes the names on the marks where the type has room, and keeps the legend elsewhere.
highlightOne column and some of its values, as list(country = "Switzerland"). Matching marks keep their color; every other mark is gray.
smootherTrend line, fit per color or series group and per panel.
identity_lineTRUE draws a dashed y = x line.
box_points"outliers" draws the points beyond the whiskers.
summaryStatistic of a boxplot's body, a pointrange's interval or a band's inner range.
whiskersOuter interval: Tukey fences or any summary statistic.
connect_centersTRUE joins a pointrange's centers in category order.
band_window"adaptive" grows the window at each point until it holds band_size individuals; "fixed" uses band_size as a half-width in x units.
band_sizeIndividuals per window, or the half-width; see band_window.
band_min_nPoints with fewer individuals than this are not drawn.
idColumn that identifies an individual, counted distinct by the band and by show_n.
ref_minColumn holding a lower reference limit per row, drawn as a dashed line at its median and labelled with its spread.
ref_maxColumn holding an upper reference limit per row, as ref_min.
ref_linesColumns holding reference limits (a normal range, grade thresholds). Per panel, each column with a value in the panel's rows draws a dashed horizontal line at the mean of those values, labelled with the column's label...
ref_line_colorsColors of the ref_lines, by column, as list(LLN = "#4DAF4A", ULN = "#4DAF4A"). A column without one takes the reference line color.
waterfall_totalsSteps of a waterfall drawn as totals, from zero.
binsAbout how many bins x is cut into, at readable breaks.
show_nObservation counts in labels, e.g. "Female (12)".
missingRows whose category is missing: "level" gives them their own ("(Missing)"; a click on it gives the rows with no value), "drop" removes them from the categories.
percent_ofThe role whose levels a pct_distinct denominator is taken within, or "total" for the whole chart.
facet_scales"fixed" shares one scale across panels, "free" lets each panel size itself, "free_y" frees y only (scatter, line and band). In a grid (facet_row) "free_y" shares the value axis within a row (x on horizontal bars and...
facet_colsPanels per row. NULL fits as many as the card is wide.
downloadTRUE offers the block for download.
titleText above the block. NULL uses the input's label, "" shows nothing, any other string is a template resolved against the data: {col}, {label(col)}, {n}, {n_distinct(col)}, {filters}, {@arg} (one of the blo...
subtitleText under the title, a template as title.
captionText below the block, a template as title. Defaults to the option blockr.viz.default_caption.
drill_targetBeta. The id of a filter block a click is sent to, or "auto" for the board's drill destination. With a target set a click is an event and the block holds no selection.
drill_tableBeta. The table in the target's dm the click applies to.

Table ​

new_table_block() · table

Interactive table: the input rows (cell colouring, finished tables from R code) or one row per group with a column per summary (count/mean bars, box / point-range distributions, swimlanes, sparklines, text stats), or a Table 1 with one row per statistic of each variable and a column per group, with search, sort and click-to-filter drill-down. Drawn as a table, a compact matrix, or KPI cards (one card per summary: its number in large type and its glyph)

ArgumentDescription
layoutWhat a row is: "records" (the input rows), "groups" (one row per level of by, one column per summary) or "variables" (a Table 1: one row per statistic or level, one column per level of by).
byGrouping columns, outer first, at most two. Records: rows under one collapsible header per level. Groups: one row per level. Variables: one column per level.
rownameThe stub column: first column, row label.
columnsColumns shown beside the row names, in order.
summariesGroups: the table's columns. Variables: its variables. An ordered list of typed summaries, each list(type = , ...): simple, dist, field, sparkline, spans, pair, expr, custom. Keys per type: see the Summaries section...
idColumn whose distinct values are counted instead of rows, so a count reads as "subjects with at least one event".
percent_ofThe base of a count's percentage: the rows of the column's own facet level, or the table.
missingRows whose category is missing: "level" gives them their own ("(Missing)"; a click on it gives the rows with no value), "drop" removes them from the categories.
colorColumn whose colors tint the rows, from the board's scale map. "auto" uses the stub column when the scale map has it.
shadingsCell color rules, each list(mode, columns, domain) with mode one of "diverging", "sequential", "bar". A column belongs to the first rule that names it.
formatHow numbers print: "number" (separators and up to two decimals, trailing zeros dropped; a value that would round to 0 keeps two significant digits), "compact" (1.2K, 3.4M), "percent" (a fraction times 100, with "%"), ...
unitFree text printed after the number ("CHF"); headers carry it once.
look"compact" rotates the column titles and draws tile summaries as square cells (a heatmap). "cards" draws one card per summary (groups) or per column (records).
facet_layoutColumn order of faceted summaries. "by_level" needs exactly one facet column in the table.
group_rowsWhat the outer rows of a nested table (two by columns) show. "name": the group's name and its number of rows, across the row, with the groups open. "summary": every summary over the group's rows, on the group's line...
openWith group_rows = "summary", whether the outer rows start closed ("none") or open ("all"). The header's button opens and closes them all either way.
row_sectionsColumn naming the section each inner row of a nested table belongs to. An outer row whose inner rows fall in more than one section shows each section's name, in small bold type, above its first row. One section: no ti...
row_groupsColumn whose value groups the outer rows: each value heads its rows, which a click on it folds, in the column's level order (a factor) or alphabetical. An outer row takes the first value its records have; rows without...
sort_byRow order: "value", "data", "alpha", a summary's name, a facet level, or a numeric column (its per-row minimum).
sort_dirSort direction.
top_nRows past the cut fold into one "Other" row.
value_labelsTRUE writes each mark's number beside it.
column_axisTRUE draws the domain strip under each glyph column.
bar_widthMark length: fit the column, or 90, 150 or 240 px.
drillTurns the row click on. Records: the column a click filters on, "auto", or "source" (the input's source rows). Groups and variables: "auto".
searchShow the search input.
sortableAllow sorting by the column headers.
collapsibleAllow collapsing the group rows of a nested table.
downloadTRUE offers the block for download.
statsRows shown for numeric variables, in the order given.
sectionsOuter header rows above the variables.
totalTRUE adds a column over all levels of by.
total_labelHeader of the overall column.
nestTRUE nests adjacent categorical hierarchies.
titleText above the block. NULL uses the input's label, "" shows nothing, any other string is a template resolved against the data: {col}, {label(col)}, {n}, {n_distinct(col)}, {filters}, {@arg} (one of the blo...
subtitleText under the title, a template as title.
captionText below the block, a template as title. Defaults to the option blockr.viz.default_caption.
drill_targetBeta. The id of a filter block a click is sent to, or "auto" for the board's drill destination. With a target set a click is an event and the block holds no selection.
drill_tableBeta. The table in the target's dm the click applies to.