Skip to content
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

Migrate @nivo/heatmap to TypeScript #1880

Merged
merged 42 commits into from
Jan 12, 2022
Merged

Migrate @nivo/heatmap to TypeScript #1880

merged 42 commits into from
Jan 12, 2022

Conversation

plouc
Copy link
Owner

@plouc plouc commented Jan 6, 2022

⚠️ BC breaks for @nivo/heatmap:

data now takes a similar structure to AreaBump, Bump, Line and ScatterPlot :

{
    id: string
    data: {
        x: string | number
        y: number | null
    }[]
}[]

therefore, indexBy and keys have been removed.

colors behaves completely differently, and now supports sequential, diverging and quantize color scales, the best is to have a look at the interactive doc of the component and play with the various types to see how to use them.

Root properties minValue and maxValue have been removed, we can now control this where needed (colors and sizeVariation).

sizeVariation now accepts either false (to disable it) or a config object having the following structure:

interface SizeVariationConfig {
    // use auto min/max values if unspecified
    values?: [min: number, max: number]
    // expressed as a range from 0~1
    sizes: [min: number, max: number]
}

Renamed properties:

  • paddingxOuterPadding, xInnerPadding, yOuterPadding, yInnerPadding
  • cellBorderWidthborderWidth
  • cellBorderColorborderColor
  • cellOpacityopacity
  • cellHoverOpacityactiveOpacity
  • cellHoverOthersOpacityinactiveOpacity

Also, the scope of this PR became huge 😅, so here is a summary:

  • @nivo/heatmap:
    • migrate to TypeScript
    • update data to use series like other charts to be able to use the same data structure for different chart types
    • add support for basic aria attributes
    • add support for layers
    • add support for annotations
    • add proper unit tests and remove snapshot based tests
  • @nivo/colors:
    • add support for more versatile color scales: sequential, diverging and quantize
  • @nivo/legends:
    • add support for legends based on color scales
  • @nivo/core:
    • remove resize-observer-polyfill package as it should be added only if IE support is needed
  • @nivo/funnel:
    • add missing license file
  • website:
    • improve and reorganize control components and fix missing context
    • improve the website theming guide, add more demos, add missing properties
    • change the max length of the generated code snippets lines to be 80 instead of 120
    • add a mobile nav and improve the way the charts sitemap is defined
    • migrate all chart icons to TypeScript
    • homogenize color controls for ordinal color scales, legacy quantize scales and new continuous color scales
  • misc:
    • add the nivo logo and NPM downloads badge to packages READMEs and add missing trailing slash to doc links

@plouc plouc self-assigned this Jan 6, 2022
@plouc plouc changed the title feat(colors): add support for continuous color scales Migrate @nivo/heatmap to TypeScript Jan 6, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 6, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4dc588e:

Sandbox Source
nivo Configuration

@plouc plouc force-pushed the heatmap-typescript branch from 2425c46 to 698a6ec Compare January 6, 2022 22:07
@plouc plouc force-pushed the heatmap-typescript branch from baa821d to 9094fae Compare January 7, 2022 12:47
@plouc plouc marked this pull request as ready for review January 7, 2022 12:50
plouc added 22 commits January 9, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant