Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3644600
feat(responsive); use react-virtualized-auto-sizer
plouc May 13, 2025
a0323b7
feat(boxplot): improve responsive chart
plouc May 13, 2025
da4fd24
feat(bullet): improve responsive chart
plouc May 13, 2025
d4042da
feat(bump): improve responsive charts
plouc May 13, 2025
e061287
feat(chord): improve responsive charts
plouc May 13, 2025
66cdf2f
feat(polar-bar): improve responsive chart
plouc May 13, 2025
2595757
feat(responsive): add the ability to debounce resizing
plouc May 13, 2025
f04ad4e
feat(website): add the ability to document the new responsive properties
plouc May 13, 2025
b46c63d
feat(website): fix guides charts
plouc May 13, 2025
0577c28
feat(responsive): expose onResize callback
plouc May 13, 2025
d2d4c89
feat(website): attempt to simplify the code snippets provided by default
plouc May 13, 2025
65d4ee3
feat(responsive): add support for new responsive properties to boxplo…
plouc May 14, 2025
47a28d3
feat(circle-packing): improve typings, expose ref, and improve respon…
plouc May 14, 2025
9e5811c
feat(chord): improve responsive components
plouc May 14, 2025
f9fa182
feat(polar-bar): improve responsive component
plouc May 14, 2025
34c918d
feat(calendar): improve responsive components
plouc May 14, 2025
b621bdc
feat(funnel): improve responsive component and add support for ref
plouc May 14, 2025
fd736a9
feat(heatmap): improve responsive component and add support for ref
plouc May 14, 2025
ee1feec
feat(sankey): improve responsive component
plouc May 14, 2025
ffc8167
feat(icicle): improve responsive components
plouc May 14, 2025
0b17608
feat(line): improve responsive components and add ref support to the …
plouc May 14, 2025
79b7016
feat(pie): improve responsive components and add ref support
plouc May 14, 2025
6174f05
feat(radial-bar): improve responsive component and add ref support
plouc May 14, 2025
610cff4
feat(marimekko): improve responsive component and add ref support
plouc May 14, 2025
5471570
feat(radar): improve responsive component and add ref support
plouc May 14, 2025
5c45934
feat(stream): improve responsive component and add ref support
plouc May 14, 2025
2d44f8a
feat(network): improve responsive components and add ref support
plouc May 15, 2025
1813714
feat(treemap): improve responsive components and add ref support
plouc May 15, 2025
5f62ae7
feat(waffle): improve responsive components and add ref support
plouc May 16, 2025
4877f67
feat(tree): improve responsive components and add ref support
plouc May 16, 2025
cde091b
feat(voronoi): improve responsive component and add ref support
plouc May 16, 2025
1b89394
feat(scatterplot): improve responsive components and add ref support
plouc May 16, 2025
353cb51
feat(parallel-coordinates): improve responsive components and add ref…
plouc May 16, 2025
d9c7ac7
feat(website): make default code snippets a bit more concise
plouc May 16, 2025
0f858fd
feat(website): simplify descriptions
plouc May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 31 additions & 14 deletions cypress/src/components/bar/Bar.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import { Bar } from '@nivo/bar'
import { ResponsiveProps } from '@nivo/core'
import { Bar, ResponsiveBar, BarDatum, BarSvgProps } from '@nivo/bar'
import { testChartResponsiveness } from '../../helpers/responsive'

describe('<Bar />', () => {
const defaultData: BarDatum[] = [
{ id: 'one', value: 10 },
{ id: 'two', value: 20 },
{ id: 'three', value: 30 },
]

const defaultResponsiveProps: ResponsiveProps<BarSvgProps<BarDatum>> = {
data: defaultData,
animate: false,
role: 'chart',
}

const defaultProps: BarSvgProps<BarDatum> = {
...defaultResponsiveProps,
width: 500,
height: 300,
}

describe('Bar', () => {
it('should render a bar chart', () => {
cy.mount(
<Bar
width={500}
height={300}
data={[
{ id: 'one', value: 10 },
{ id: 'two', value: 20 },
{ id: 'three', value: 30 },
]}
animate={false}
/>
)
cy.mount(<Bar {...defaultProps} />, { strict: true })
})

testChartResponsiveness(defaults => (
<ResponsiveBar
{...defaultResponsiveProps}
defaultWidth={defaults?.[0]}
defaultHeight={defaults?.[1]}
/>
))
})
19 changes: 17 additions & 2 deletions cypress/src/components/bar/BarCanvas.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BarCanvas } from '@nivo/bar'
import { BarCanvas, ResponsiveBarCanvas } from '@nivo/bar'
import { testChartResponsiveness } from '../../helpers/responsive'

describe('<BarCanvas />', () => {
describe('BarCanvas', () => {
it('should render a bar chart', () => {
cy.mount(
<BarCanvas
Expand All @@ -14,4 +15,18 @@ describe('<BarCanvas />', () => {
/>
)
})

testChartResponsiveness(defaults => (
<ResponsiveBarCanvas
data={[
{ id: 'one', value: 10 },
{ id: 'two', value: 20 },
{ id: 'three', value: 30 },
]}
role="chart"
pixelRatio={1}
defaultWidth={defaults?.[0]}
defaultHeight={defaults?.[1]}
/>
))
})
53 changes: 53 additions & 0 deletions cypress/src/components/boxplot/BoxPlot.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ResponsiveProps } from '@nivo/core'
import { BoxPlot, ResponsiveBoxPlot, BoxPlotSvgProps } from '@nivo/boxplot'
import { testChartResponsiveness } from '../../helpers/responsive'

// dataset with two groups
const dataGroups = [
{ group: 'Alpha', value: 1 },
{ group: 'Alpha', value: 5 },
{ group: 'Beta', value: 2 },
{ group: 'Beta', value: 10 },
]

type SingleGroupDatum = (typeof dataGroups)[number]

// dataset with two groups and two subgroups
const dataSubGroups = [
{ group: 'Alpha', type: 'A', value: 10 },
{ group: 'Alpha', type: 'A', value: 10.5 },
{ group: 'Alpha', type: 'B', value: 11 },
{ group: 'Alpha', type: 'B', value: 11.5 },
]

const defaultResponsiveProps: ResponsiveProps<BoxPlotSvgProps<any>> = {
data: dataGroups,
margin: {
top: 0,
right: 0,
bottom: 24,
left: 24,
},
animate: false,
role: 'chart',
}

const defaultProps: BoxPlotSvgProps<any> = {
...defaultResponsiveProps,
width: 500,
height: 300,
}

describe('BoxPlot', () => {
it('should render a boxplot chart', () => {
cy.mount(<BoxPlot<SingleGroupDatum> {...defaultProps} />)
})

testChartResponsiveness(defaults => (
<ResponsiveBoxPlot<SingleGroupDatum>
defaultWidth={defaults?.[0]}
defaultHeight={defaults?.[1]}
{...defaultResponsiveProps}
/>
))
})
55 changes: 55 additions & 0 deletions cypress/src/components/bullet/Bullet.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { ResponsiveProps } from '@nivo/core'
import { Bullet, ResponsiveBullet, BulletSvgProps } from '@nivo/bullet'
import { testChartResponsiveness } from '../../helpers/responsive'

const defaultData = [
{
id: 'A',
ranges: [10, 20, 40],
measures: [30],
markers: [20],
},
{
id: 'B',
ranges: [100],
measures: [20, 50],
markers: [80],
},
{
id: 'C',
ranges: [50],
measures: [10],
},
]

const defaultResponsiveProps: ResponsiveProps<BulletSvgProps> = {
data: defaultData,
margin: {
top: 0,
right: 24,
bottom: 24,
left: 24,
},
animate: false,
role: 'chart',
}

const defaultProps: BulletSvgProps = {
...defaultResponsiveProps,
width: 500,
height: 300,
}

describe('Bullet', () => {
it('should render a bullet chart', () => {
cy.mount(<Bullet {...defaultProps} />)
})

testChartResponsiveness(defaults => (
<ResponsiveBullet
defaultWidth={defaults?.[0]}
defaultHeight={defaults?.[1]}
{...defaultResponsiveProps}
/>
))
})
106 changes: 106 additions & 0 deletions cypress/src/components/bump/AreaBump.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { ResponsiveProps } from '@nivo/core'
import { AreaBump, ResponsiveAreaBump, AreaBumpSvgProps } from '@nivo/bump'
import { testChartResponsiveness } from '../../helpers/responsive'

interface Datum {
x: number
y: number
}

const defaultData = [
{
id: 'A',
data: [
{
x: 2000,
y: 9,
},
{
x: 2001,
y: 9,
},
{
x: 2002,
y: 2,
},
{
x: 2003,
y: 4,
},
],
},
{
id: 'B',
data: [
{
x: 2000,
y: 8,
},
{
x: 2001,
y: 3,
},
{
x: 2002,
y: 1,
},
{
x: 2003,
y: 7,
},
],
},
{
id: 'C',
data: [
{
x: 2000,
y: 12,
},
{
x: 2001,
y: 4,
},
{
x: 2002,
y: 5,
},
{
x: 2003,
y: 6,
},
],
},
]

const defaultResponsiveProps: ResponsiveProps<AreaBumpSvgProps<Datum, {}>> = {
data: defaultData,
margin: {
top: 24,
right: 40,
bottom: 24,
left: 40,
},
animate: false,
role: 'chart',
}

const defaultProps: AreaBumpSvgProps<Datum, {}> = {
...defaultResponsiveProps,
width: 500,
height: 300,
}

describe('AreaBump', () => {
it('should render an area-bump chart', () => {
cy.mount(<AreaBump {...defaultProps} />)
})

testChartResponsiveness(defaults => (
<ResponsiveAreaBump
defaultWidth={defaults?.[0]}
defaultHeight={defaults?.[1]}
{...defaultResponsiveProps}
/>
))
})
Loading
Loading