```{js, echo=FALSE}
// Custom range filter with value label // Code copied from R-package 'reactable' vignette at // https://github.com/glin/reactable/blob/HEAD/vignettes/custom-filtering.Rmd // accessed on 2024-02-12 // License: MIT // YEAR: 2019 // COPYRIGHT HOLDER: Greg Lin, Tanner Linsley
function filterInput(column, state) { let min = Infinity; let max = 0; state.data.forEach(function (row) { const value = row[column.id]; if (value < min) { min = Math.floor(value); } else if (value > max) { max = Math.ceil(value); } });
const filterValue = column.filterValue || min; const input = React.createElement("input", { type: "range", value: filterValue, min: min, max: max, onChange: function (event) { column.setFilter(event.target.value || undefined); }, style: { width: "100%" }, "aria-label": "Filter " + column.name, });
return React.createElement( "div", { style: { display: "flex", alignItems: "center", height: "100%" } }, [input] ); }
// Filter method that filters numeric columns by minimum value
function filterMethod(rows, columnId, filterValue) { return rows.filter(function (row) { return row.values[columnId] >= filterValue; }); }
```
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.