Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mbostock
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
151.
▲
by
mbostock
8y ago
This is lovely for using React or Preact in Observable! https://beta.observablehq.com/@mbostock/hello-htm We have our own lit-html-inspired html tagged template literals that render directly to DOM, but it’s nice to se
152.
▲
by
mbostock
8y ago
You don’t need lodash or a new operator for the example provided: departments .flatMap(d => d.employees) .map(e => e.salary) .reduce((p, v) => Math.max(p, v), 0) That said, the pipe operator is nice because it al
153.
▲
How well does population density predict U.S. voting outcomes?
(beta.observablehq.com)
148 points
by
mbostock
8y ago
|
109 comments
154.
▲
by
mbostock
9y ago
Well, it’s nice that you can always define your own tagged template literal. ;) The double backslashes certainly are annoying. We may be able to eliminate them by using String.raw. https://github.com/observablehq/notebo
155.
▲
by
mbostock
9y ago
We recently added support for embedding LaTeX expressions (and really, any dynamically-generated DOM) within Markdown template literals to Observable notebooks. So you can say md`I like ${tex`\\KaTeX`}`, and KaTeX renders its logo, which is
156.
▲
by
mbostock
9y ago
Yep!
157.
▲
by
mbostock
9y ago
We’re still writing more documentation, but there’s a bit more detail here (and I’ll be posting more soon): https://beta.observablehq.com/@mbostock/introduction-to-code To summarize, the body of a cell is typically eit
158.
▲
by
mbostock
9y ago
A few differences. 1. You don’t have to install anything, so running (or forking) someone else’s notebook is as simple as clicking a link. 2. It’s reactive, which means simpler code and better feedback, particularly when building user inter
159.
▲
by
mbostock
9y ago
I wrote more about the motivation for Observable (formerly d3.express) last year: https://medium.com/@mbostock/a-better-way-to-code-2b1d2876a3... It’s easy to use D3 within Observable, but it’s not pre-loaded or specif
160.
▲
by
mbostock
9y ago
If you hit the '?' key (when you don’t have a code editor focused), a help modal appears that shows all the keyboard shortcuts. Most of the keyboard shortcuts are also described in the introduction here: https://beta.ob
161.
▲
by
mbostock
9y ago
You can solve by finding the point <x, y> that minimizes the distance from any point in any input circle: \sqrt{(x_p - x) ^ 2 + (y_p - y) ^ 2} + r_p for p ∈ L. This is the center of the smallest enclosing circle. Once you have the cen
162.
▲
by
mbostock
9y ago
You can have more than three tangent circles, but three tangent circles are sufficient to represent an enclosing circle.
163.
▲
by
mbostock
10y ago
1. That’s a difficult question. There is an efficiency that comes from working with people you already know--maintaining a smaller set of relationships--rather than trying to manage a lot of small contributions from many. Jason Davies made
164.
▲
by
mbostock
10y ago
Take a look at these introductions to d3-scale and d3-shape for why you might want visualization-related abstractions to help you with React: https://medium.com/@mbostock/introducing-d3-scale-61980c5154... https:/
165.
▲
by
mbostock
10y ago
Yep, I’m going to update my examples in-place. Consider it my heavy-handed encouragement to upgrade to 4.0. (For one thing, there are lot of 3.x bugs fixed in 4.0, and I have limited resources to provide free support to old versions.) My ex
166.
▲
by
mbostock
10y ago
Thanks. It’s definitely more fun to work on the pieces of D3 individually, rather than feeling the weight of a massive monolith. Hopefully it will encourage others to develop more reusable libraries that depend on (the relevant parts of) D3
167.
▲
by
mbostock
10y ago
I don’t know about the “best” way, but there are quite a few ways people have explored so far; Google [d3 react] for starters… D3 4.0 introduces a new option which is to use the D3 minilibraries d3-scale, d3-shape, d3-hierarchy etc. without
168.
▲
by
mbostock
10y ago
Let’s see, in no particular order… * New pretty continuous color schemes (viridis, rainbow, ColorBrewer) * New axes that are easier to use. * Vastly improved circle-packing layout. * More stable, extensible force layout. * Cleaner implement
169.
▲
by
mbostock
10y ago
Hmm. It might be possible, though it doesn’t sound like a great idea to have both D3 3.x and the D3 4.0 default bundle loaded simultaneously, since there will be a lot of overlap. A better strategy might be to load just the new modules you
170.
▲
by
mbostock
10y ago
I thought about the Python 2/3 debacle a lot this past year, and yes, I hope this isn’t a repeat. The Python migration was especially hard because of dependencies between libraries (you could only migrate your library or application to
171.
▲
by
mbostock
10y ago
The place to start is the release notes: https://github.com/d3/d3/releases/tag/v4.0.0 And the detailed change list: https://github.com/d3/d3/blob/master/CHANGES.md I
172.
▲
by
mbostock
10y ago
Aye, a lot has changed! I know change in itself is a pain; despite the quantity of changes I did try to avoid unnecessary change, and batch the changes into a rare major release. I believe such change is worthwhile, and that it’s better in
173.
▲
Declarative Design Tools
(jon.gold)
3 points
by
mbostock
10y ago
|
0 comments
174.
▲
by
mbostock
10y ago
I ported these color scales to d3-scale and D3 4.0: https://github.com/d3/d3-scale/blob/master/README.md#sequent...
175.
▲
by
mbostock
10y ago
Without a more specific example to go on, it’s difficult to speculate. The only case where you’d get an error asynchronously should be in the case of transition.tween or an event listener—cases where the code is necessarily asynchronous—and
176.
▲
by
mbostock
10y ago
It’s interesting—or frustrating?—that you should mention this, because D3 is explicitly designed with debugging (and debuggers, developer tools) in mind. I’d like to understand your frustrations better. There are two main strategies that
177.
▲
by
mbostock
10y ago
This sentiment—that application programming interfaces are user interfaces, and that programmers are users—is why I’m spending so much effort improving the API of D3 4.0. I wrote about that in March: https://medium.com/@mbos
178.
▲
by
mbostock
11y ago
It’s hard to tell how much overlap there is. One of way of looking at Crom is that it provides a more convenient interface than a URL, yet without the centralization that comes from using names in a registry. Crom helps you go from a name t
179.
▲
by
mbostock
11y ago
How does Nix find packages? E.g., how does `nix-env --install firefox` get mapped to a specific package?
180.
▲
by
mbostock
11y ago
Author here. This is currently at the stage of an afternoon thought experiment, but I’m interested in your feedback and help! Probably the most important open issue is that simple names aren’t a sufficient identifier with a decentralized re
More ›