d3.curveMonotoneX may be unsuitable for stacked areas.

Open
#81 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
d3, javascript

Research direction

The report compares stacked area output using d3.curveLinear and d3.curveMonotoneX and includes the last four data points for the lowest and highest areas. Start by reproducing both curves with those series in d3-shape’s area examples or tests, then inspect the monotone curve handling for stacked areas. Done means the cause of the unexpected convexity is identified and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Description

Creating stacked area chart with .curve(d3.curveLinear) produced correct interpolation:
image

Creating the same chart with .curve(d3.curveMonotoneX) produced strange convexity for the highest area (between 3 and 2 points (X) from the end):
image

Last 4 items from the series for the LOWEST area are:
[0, 0] [0, 186] [0, 2294] [0, 2812.11]
Last 4 items from the series for the HIGHEST area are:
[0, 0] [186, 186] [2294, 2294] [2812.11, 21312.11]

Dominant language
JavaScript
Stars
2.5k
Forks
307
Avg merge
4h 16m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from d3/d3-shape

All issues in d3/d3-shape

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.