-
Notifications
You must be signed in to change notification settings - Fork 204
clip: geojson #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clip: geojson #2243
Changes from 12 commits
9b488b4
e2527d3
3d9234d
814c6b2
b263074
63c8b53
a67c5a9
c3af294
e592779
928bf0b
e23ed52
3533dd7
31e2e33
d5c7af4
423f8ae
872f641
f09d6ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import {creator, select} from "d3"; | ||
| import {creator, geoPath, select} from "d3"; | ||
| import {createChannel, inferChannelScale} from "./channel.js"; | ||
| import {createContext} from "./context.js"; | ||
| import {createDimensions} from "./dimensions.js"; | ||
|
|
@@ -11,7 +11,7 @@ import {frame} from "./marks/frame.js"; | |
| import {tip} from "./marks/tip.js"; | ||
| import {isColor, isIterable, isNone, isScaleOptions} from "./options.js"; | ||
| import {dataify, lengthof, map, yes, maybeIntervalTransform, subarray} from "./options.js"; | ||
| import {createProjection, getGeometryChannels, hasProjection} from "./projection.js"; | ||
| import {createProjection, getGeometryChannels, hasProjection, xyProjection} from "./projection.js"; | ||
| import {createScales, createScaleFunctions, autoScaleRange, exposeScales} from "./scales.js"; | ||
| import {innerDimensions, outerDimensions} from "./scales.js"; | ||
| import {isPosition, registry as scaleRegistry} from "./scales/index.js"; | ||
|
|
@@ -236,6 +236,11 @@ export function plot(options = {}) { | |
| facetTranslate = facetTranslator(fx, fy, dimensions); | ||
| } | ||
|
|
||
| // A path generator for marks that want to draw GeoJSON. | ||
| context.path = function () { | ||
| return geoPath(this.projection ?? xyProjection(scales)); | ||
| }; | ||
|
|
||
|
Comment on lines
+239
to
+243
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn’t catch this in the review, but I think this should be assigned quite a bit earlier, especially before we pass the context to mark initializers.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. follow-up at #2252 |
||
| // Compute value objects, applying scales and projection as needed. | ||
| for (const [mark, state] of stateByMark) { | ||
| state.values = mark.scale(state.channels, scales, context); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is lovely! |
Uh oh!
There was an error while loading. Please reload this page.