Cora Sutton
07/02/2024, 1:36 AMCora Sutton
07/03/2024, 1:54 AMaaronkyle
07/06/2024, 3:45 AM```js echo
function formatTable(
data,
props, // See <https://github.com/yetrun/json5-to-table#props%E5%AE%9A%E5%88%B6%E5%B5%8C%E5%A5%97%E5%B1%9E%E6%80%A7>
opts = {}
) {
const options = Object.assign(
{
// Format Date data types. Use path to selectively format.
dateFormat: (datum, path) => isoformat.format(datum),
// Format all values. Use path to selectively format.
// 📝 dateFormat take precedence for Date types
format: (datum, path) => datum,
height: 274, // Set height of the table. Default is on the Inputs.table
width: null // Set width of the table.
},
opts
);
const minHeight = 33;
let { height, width } = options;
const copy = cleanseData(data, options);
height = height > minHeight ? height : null;
const generateHTMLTableoptions = {
attributes: {
table: {
// Based on Observable table styles
style: `
max-width: initial;
${minHeight != null ? `min-height: ${length(minHeight)};` : ""}
margin: 0;
border-spacing: 0;
font-variant-numeric: tabular-nums;`
},
th: {
style: `padding: 3px 6.5px; position: sticky; top: 0; background: #fff;`
},
td: {
style: `padding: 3px 6.5px`
}
}
};
return html`<div style="overflow-x: auto;${
height ? `max-height: ${height}px;` : ""
}${width != null ? `width: ${length(width)};` : ""}">
${json2table.default.generateHTMLTable(copy, props, generateHTMLTableoptions)}
</div>`;
}
```
And execution is attempted like this:
```js echo
formatTable(sampleArray, null, {
height: 200, // Set height of the table
width: "80%", // Set width of the table
// Format date types
dateFormat: (datum, path) => new Intl.DateTimeFormat("en-US").format(datum),
// Format values. dateFormat take precedence for Date types
format: (datum, path) => {
if (path === "courses.score") {
return `${datum}/100`;
}
return datum;
}
})
```
Wrapping in <div>
and messing around with the html template literal, JavaScript code blocks, and in-line Markdown and still I can't return a rendered result. Here's where I am keeping a copy of the source code:
https://github.com/aaronkyle/dataviz/blob/main/pretty-tables_src/index.md
And here's a rendering of where I am at when trying to covert this table. Here a table is being returned, but the image in not correctly interpreted.
https://aaronkyle.github.io/dataviz/pretty-tables_dist/
🙏🏻Elliott Whitling
07/08/2024, 8:21 PMJung Hoon Son
07/09/2024, 2:51 AMtotal_employment
field): website linkMaxwell Grant
07/09/2024, 3:00 PMBawantha Rathnayaka
07/09/2024, 5:50 PMaaronkyle
07/10/2024, 10:54 AM*[IAM User Policy](*${links.iam_policy}*)*
Elliott Whitling
07/10/2024, 10:36 PMBawantha Rathnayaka
07/12/2024, 3:59 PMHarris Lapiroff
07/13/2024, 1:54 AMCora Sutton
07/13/2024, 9:51 PMSrirama Bhamidipati
07/15/2024, 7:10 AMJung Hoon Son
07/15/2024, 2:06 PMDylan Omran
07/16/2024, 4:03 PMS Cohen
07/16/2024, 5:17 PMsankeyLinkHorizontal
for the links. I can kinda have the nodes be a certain height pretty easily, but the links is the issue. There was a question about this in the forum, but the solution seems hacky and I'm wondering if theres a better way to implement a minimum height. Thanks!aaronkyle
07/16/2024, 7:51 PM```js
import {md} from "npm:@observablehq/stdlib";
```
but it returns as undefined
Gordon Tu
07/17/2024, 3:09 AMMaxwell Grant
07/17/2024, 7:55 PMBrett Spradbury
07/18/2024, 1:33 PMJack Ketcham
07/19/2024, 3:44 AM6
, 14
) of the count bucket, so I'd like to key off of that for the faceting.
Here's a notebook with what I'm working with: https://observablehq.com/d/bfbb63a16a2d77b5Wouter de Vries
07/19/2024, 2:13 PMWouter de Vries
07/20/2024, 12:40 PMDuckDBClient.of({ mydb: FileAttachment("mydb.parquet") })
then?
Error: Binder Error: Can only update base table!
Wouter de Vries
07/21/2024, 2:52 PMhistogram()
function built into DuckDB. The query seems to run fine, but the SQL cell shows "Error" as a value and inspecting the array itself says "Uncaught TypeError: proxy [[OwnPropertyKeys]] must return an array with only string and symbol elements". Am I using it incorrectly? Of course I could do the binning myself which is a lot more flexible.
https://observablehq.com/d/75014781c1acd67c#cell-120Justin Angevaare
07/22/2024, 5:41 PM<h1>head</h1>
and <h2>subhead</h3>
, only head
shows in toc.)
TIAWouter de Vries
07/22/2024, 7:04 PMInput.search
with an Input.table
to help looking entries to select. The problem is that the previous selection clears when you filter data away by typing in the search field. Is there a clever way to preserve selection even though the list of visible items are filtered? A native search field on the table like the data table cell has would be even better 👼 There's an issue related to search #222, but it has no mention of preserving selection.Blake Decker
07/23/2024, 2:22 PMWouter de Vries
07/24/2024, 8:19 AMalbers-usa
projection for the US which also happens to resize nicely when used in Plot. For other countries I've been doing projection: d3.geoMercator().fitSize([width, 650], nl_land)
, but that does not take into account the height. Is there a variable around for the standard height of a plot cell I can use? It seems that the aspect ratio remains 1.6, but who's to say that's a given.
https://observablehq.com/d/91980718e3b1cae1Tobias Sjösten
07/24/2024, 11:22 AMBianca Melo
07/24/2024, 2:41 PM