@@ -95,6 +95,9 @@ function table(data, options = {}) {
95
95
// In the meantime, here's a very dirty approach
96
96
const _data = index === index0 ? data : take (data, index);
97
97
table .replaceWith (table = _Inputs .table (_data, options));
98
+ d3 .select (table)
99
+ .style (" min-width" , ` ${ 120 * fields .length } px` )
100
+ .style (" max-width" , ` ${ 280 * fields .length } px` );
98
101
const th = d3 .select (table).selectAll (" th" );
99
102
th .append ((d , i ) => thtype[i]);
100
103
th .append ((d , i ) => thsummary[i]);
@@ -245,6 +248,18 @@ async function summary(div, filters, refresh) {
245
248
Plot .axisX (ticks, {tickSize: 3 , tickPadding: 2 , fontSize: 8 , ... (! isDate && {tickFormat: " s" })}),
246
249
]
247
250
});
251
+
252
+ const X = Array .from (values, chart .scale (" x" ).apply );
253
+ const brush = d3 .brushX ()
254
+ .on (" end" , refresh)
255
+ .on (" brush" , ({selection}) => {
256
+ if (selection) {
257
+ const [min , max ] = selection;
258
+ filters .set (name, (i ) => min <= X [i] && X [i] <= max);
259
+ } else filters .delete (name);
260
+ refresh (); // TODO debounce
261
+ });
262
+ d3 .select (chart).call (brush);
248
263
}
249
264
div .append (chart ? html ` <div style =${type === " Utf8" ? " " : {
250
265
position: " absolute" ,
0 commit comments