Skip to content

Commit 3d649fa

Browse files
authored
Merge pull request #1 from Seesy/feat/add-axisFormat-bullet
Feat/add axis format bullet
2 parents 7f8f1c0 + c50336b commit 3d649fa

File tree

133 files changed

+5235
-1595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+5235
-1595
lines changed

CHANGELOG.md

Lines changed: 219 additions & 91 deletions
Large diffs are not rendered by default.

api/package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nivo/api",
3-
"version": "0.73.1",
3+
"version": "0.74.0",
44
"description": "Rendering API for nivo dataviz React/d3 components",
55
"main": "src/app.js",
66
"licenses": [
@@ -22,26 +22,26 @@
2222
"nodemon": "^1.18.10"
2323
},
2424
"dependencies": {
25-
"@nivo/bar": "0.73.1",
26-
"@nivo/bullet": "0.73.0",
27-
"@nivo/calendar": "0.73.0",
28-
"@nivo/chord": "0.73.0",
29-
"@nivo/circle-packing": "0.73.0",
30-
"@nivo/core": "0.73.0",
31-
"@nivo/generators": "0.73.0",
32-
"@nivo/heatmap": "0.73.0",
33-
"@nivo/legends": "0.73.0",
34-
"@nivo/line": "0.73.0",
35-
"@nivo/parallel-coordinates": "0.73.0",
36-
"@nivo/pie": "0.73.0",
37-
"@nivo/radar": "0.73.0",
38-
"@nivo/sankey": "0.73.0",
39-
"@nivo/scatterplot": "0.73.0",
40-
"@nivo/stream": "0.73.0",
41-
"@nivo/sunburst": "0.73.0",
42-
"@nivo/treemap": "0.73.0",
43-
"@nivo/voronoi": "0.73.0",
44-
"@nivo/waffle": "0.73.0",
25+
"@nivo/bar": "0.74.0",
26+
"@nivo/bullet": "0.74.0",
27+
"@nivo/calendar": "0.74.0",
28+
"@nivo/chord": "0.74.0",
29+
"@nivo/circle-packing": "0.74.0",
30+
"@nivo/core": "0.74.0",
31+
"@nivo/generators": "0.74.0",
32+
"@nivo/heatmap": "0.74.0",
33+
"@nivo/legends": "0.74.0",
34+
"@nivo/line": "0.74.0",
35+
"@nivo/parallel-coordinates": "0.74.0",
36+
"@nivo/pie": "0.74.0",
37+
"@nivo/radar": "0.74.0",
38+
"@nivo/sankey": "0.74.0",
39+
"@nivo/scatterplot": "0.74.0",
40+
"@nivo/stream": "0.74.0",
41+
"@nivo/sunburst": "0.74.0",
42+
"@nivo/treemap": "0.74.0",
43+
"@nivo/voronoi": "0.74.0",
44+
"@nivo/waffle": "0.74.0",
4545
"body-parser": "^1.17.2",
4646
"compression": "^1.7.0",
4747
"cors": "^2.8.4",

conf/base.yaml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ capture:
108108
# selector: '#chart'
109109
# output: ./packages/radar/doc/radar.png
110110

111+
# - path: /radial-bar
112+
# selector: '#chart'
113+
# output: ./packages/radial-bar/doc/radial-bar.png
114+
111115
# - path: /sankey
112116
# selector: '#chart'
113117
# output: ./packages/sankey/doc/sankey.png
@@ -517,15 +521,28 @@ capture:
517521
# selector: '#marimekko-darkColored'
518522
# output: ./website/src/assets/icons/marimekko-dark-colored.png
519523

524+
# - path: /internal/icons/
525+
# selector: '#time-range-lightNeutral'
526+
# output: ./website/src/assets/icons/time-range-light-neutral.png
527+
# - path: /internal/icons/
528+
# selector: '#time-range-lightColored'
529+
# output: ./website/src/assets/icons/time-range-light-colored.png
530+
# - path: /internal/icons/
531+
# selector: '#time-range-darkNeutral'
532+
# output: ./website/src/assets/icons/time-range-dark-neutral.png
533+
# - path: /internal/icons/
534+
# selector: '#time-range-darkColored'
535+
# output: ./website/src/assets/icons/time-range-dark-colored.png
536+
520537
- path: /internal/icons/
521-
selector: '#time-range-lightNeutral'
522-
output: ./website/src/assets/icons/time-range-light-neutral.png
538+
selector: '#radial-bar-lightNeutral'
539+
output: ./website/src/assets/icons/radial-bar-light-neutral.png
523540
- path: /internal/icons/
524-
selector: '#time-range-lightColored'
525-
output: ./website/src/assets/icons/time-range-light-colored.png
541+
selector: '#radial-bar-lightColored'
542+
output: ./website/src/assets/icons/radial-bar-light-colored.png
526543
- path: /internal/icons/
527-
selector: '#time-range-darkNeutral'
528-
output: ./website/src/assets/icons/time-range-dark-neutral.png
544+
selector: '#radial-bar-darkNeutral'
545+
output: ./website/src/assets/icons/radial-bar-dark-neutral.png
529546
- path: /internal/icons/
530-
selector: '#time-range-darkColored'
531-
output: ./website/src/assets/icons/time-range-dark-colored.png
547+
selector: '#radial-bar-darkColored'
548+
output: ./website/src/assets/icons/radial-bar-dark-colored.png

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages/*",
44
"api"
55
],
6-
"version": "0.73.1",
6+
"version": "0.74.0",
77
"npmClient": "yarn",
88
"useWorkspaces": true
99
}

packages/annotations/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nivo/annotations",
3-
"version": "0.73.0",
3+
"version": "0.74.0",
44
"license": "MIT",
55
"author": {
66
"name": "Raphaël Benitte",
@@ -28,15 +28,15 @@
2828
"!dist/tsconfig.tsbuildinfo"
2929
],
3030
"dependencies": {
31-
"@nivo/colors": "0.73.0",
32-
"@react-spring/web": "9.2.4",
31+
"@nivo/colors": "0.74.0",
32+
"@react-spring/web": "9.2.6",
3333
"lodash": "^4.17.21"
3434
},
3535
"devDependencies": {
36-
"@nivo/core": "0.73.0"
36+
"@nivo/core": "0.74.0"
3737
},
3838
"peerDependencies": {
39-
"@nivo/core": "0.73.0",
39+
"@nivo/core": "0.74.0",
4040
"react": ">= 16.14.0 < 18.0.0"
4141
},
4242
"publishConfig": {

packages/arcs/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nivo/arcs",
3-
"version": "0.73.0",
3+
"version": "0.74.0",
44
"license": "MIT",
55
"author": {
66
"name": "Raphaël Benitte",
@@ -28,16 +28,16 @@
2828
"!dist/tsconfig.tsbuildinfo"
2929
],
3030
"dependencies": {
31-
"@nivo/colors": "0.73.0",
32-
"@react-spring/web": "9.2.4",
31+
"@nivo/colors": "0.74.0",
32+
"@react-spring/web": "9.2.6",
3333
"d3-shape": "^1.3.5"
3434
},
3535
"devDependencies": {
36-
"@nivo/core": "0.73.0",
36+
"@nivo/core": "0.74.0",
3737
"@types/d3-shape": "^2.0.0"
3838
},
3939
"peerDependencies": {
40-
"@nivo/core": "0.73.0",
40+
"@nivo/core": "0.74.0",
4141
"react": ">= 16.14.0 < 18.0.0"
4242
},
4343
"publishConfig": {

packages/arcs/src/ArcLine.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { animated, to, AnimatedProps } from '@react-spring/web'
2+
import { ExtractProps } from '@nivo/core'
3+
import { generateSvgArc } from './utils'
4+
5+
type ArcLineProps = {
6+
animated: AnimatedProps<{
7+
radius: number
8+
startAngle: number
9+
endAngle: number
10+
opacity: number
11+
}>
12+
} & ExtractProps<typeof animated.path>
13+
14+
export const ArcLine = ({ animated: animatedProps, ...rest }: ArcLineProps) => (
15+
<animated.path
16+
d={to(
17+
[animatedProps.radius, animatedProps.startAngle, animatedProps.endAngle],
18+
(radius, start, end) => generateSvgArc(radius, start, end)
19+
)}
20+
{...rest}
21+
/>
22+
)

packages/arcs/src/boundingBox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const computeArcBoundingBox = (
4444
}
4545

4646
points = points.map(([x, y]) => [centerX + x, centerY + y])
47-
if (includeCenter === true) {
47+
if (includeCenter) {
4848
points.push([centerX, centerY])
4949
}
5050

packages/arcs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './arc_labels'
22
export * from './arc_link_labels'
3+
export * from './ArcLine'
34
export * from './ArcShape'
45
export * from './ArcsLayer'
56
export * from './arcTransitionMode'

packages/arcs/src/utils.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo } from 'react'
2-
import { radiansToDegrees } from '@nivo/core'
2+
import { radiansToDegrees, positionFromAngle, degreesToRadians } from '@nivo/core'
33
import { DatumWithArc } from './types'
44

55
/**
@@ -33,3 +33,53 @@ export const useFilteredDataBySkipAngle = <Datum extends DatumWithArc>(
3333
data: Datum[],
3434
skipAngle: number
3535
) => useMemo(() => filterDataBySkipAngle(data, skipAngle), [data, skipAngle])
36+
37+
export const svgEllipticalArcCommand = (
38+
radius: number,
39+
largeArcFlag: 0 | 1,
40+
sweepFlag: 0 | 1,
41+
x: number,
42+
y: number
43+
) =>
44+
[
45+
'A',
46+
radius,
47+
radius,
48+
0, // x-axis-rotation
49+
largeArcFlag,
50+
sweepFlag,
51+
x,
52+
y,
53+
].join(' ')
54+
55+
export const generateSvgArc = (
56+
radius: number,
57+
originalStartAngle: number,
58+
originalEndAngle: number
59+
): string => {
60+
const startAngle = Math.min(originalStartAngle, originalEndAngle)
61+
const endAngle = Math.max(originalStartAngle, originalEndAngle)
62+
63+
const start = positionFromAngle(degreesToRadians(endAngle), radius)
64+
const end = positionFromAngle(degreesToRadians(startAngle), radius)
65+
66+
// we have a full circle, we cannot use a single elliptical arc
67+
// to draw it, so we use 2 in that case.
68+
if (endAngle - startAngle >= 360) {
69+
const mid = positionFromAngle(degreesToRadians(startAngle + 180), radius)
70+
71+
return [
72+
`M ${start.x} ${start.y}`,
73+
svgEllipticalArcCommand(radius, 1, 1, mid.x, mid.y),
74+
`M ${start.x} ${start.y}`,
75+
svgEllipticalArcCommand(radius, 1, 0, mid.x, mid.y),
76+
].join(' ')
77+
}
78+
79+
const largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1
80+
81+
return [
82+
`M ${start.x} ${start.y}`,
83+
svgEllipticalArcCommand(radius, largeArcFlag, 0, end.x, end.y),
84+
].join(' ')
85+
}

0 commit comments

Comments
 (0)