techniq / techniq/layerchart

Simplify imports (scales, curves, projections, etc)

Open
#478 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
41
Avg merge
2d 19h
Merged PRs (30d)
16

Description

Instead of requiring imports from d3-scales, d3-shape, d3-geo, we should support simple strings for many of these use cases (but still support functions for custom implementations including pulling from other sources such as d3-geo-projection) or d3-geo-polygon).

This will

  • Simplify the packages needing to be installed by the user
  • Knowing the packages and import names (prefixes like scale*, geo*, curve*, etc)
  • Explorability of the API (ex. auto complete when <Spline curve=" is typed with available options)

Scale

Before
<script>
  import { scaleBand } from 'd3-scale';
</script>

<Chart xScale={scaleBand()} />
After
<Chart xScale="band" />

Curve

Before
<script>
  import { curveMonotoneX } from 'd3-shape';
</script>

<Spline curve={curveMonotoneX} />
After
<Spline curve="monotoneX" />

Projection

Before
<script>
  import { geoOrthographic } from 'd3-geo';
</script>

<Chart geo={{ projection: geoOrthographic }}>...</Chart>
After
<Chart geo={{ projection: 'orthographic' }}>...</Chart>

Will need to consider how this impacts the library size / tree shaking.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the entry points that handle xScale, curve, and geo projection props, then trace how D3 functions are currently passed through. Done means the documented string forms resolve for scales, curves, and projections while custom functions remain supported and the tree-shaking impact is considered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.