Skip to content

Commit

Permalink
feat(chord): fix static mapping used for the http API
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Jan 1, 2022
1 parent 458ba58 commit a992666
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 1 addition & 3 deletions packages/chord/package.json
Expand Up @@ -35,9 +35,7 @@
"@nivo/tooltip": "0.77.0",
"@react-spring/web": "9.3.1",
"d3-chord": "^1.0.6",
"d3-shape": "^1.3.5",
"lodash": "^4.17.21",
"react-motion": "^0.5.2"
"d3-shape": "^1.3.5"
},
"devDependencies": {
"@nivo/core": "0.77.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/static/src/mappings/chord.ts
@@ -1,19 +1,18 @@
import { FunctionComponent } from 'react'
import Joi from 'joi'
import { Dimensions } from '@nivo/core'
import { Chord, ChordProps } from '@nivo/chord'
import { Chord, ChordSvgProps } from '@nivo/chord'
import { custom } from './common'
import { ordinalColors, inheritedColor } from './commons/colors'
import { dimensions } from './commons/dimensions'
import { OmitStrict } from '../types'

// filter out all dynamic properties
export type ChordApiProps = OmitStrict<
ChordProps & Dimensions,
ChordSvgProps & Dimensions,
| 'isInteractive'
| 'animate'
| 'motionStiffness'
| 'motionDamping'
| 'motionConfig'
| 'onRibbonMouseEnter'
| 'onRibbonMouseMove'
| 'onRibbonMouseLeave'
Expand All @@ -38,7 +37,7 @@ export const chordMapping = {
height: dimensions.height,
margin: dimensions.margin,

matrix: custom.array().required(),
data: custom.array().required(),
keys: Joi.array().required(),

padAngle: Joi.number(),
Expand Down
2 changes: 1 addition & 1 deletion packages/static/src/samples/index.ts
Expand Up @@ -46,7 +46,7 @@ export const samples: Record<
props: {
width: 800,
height: 800,
matrix: [
data: [
[11975, 5871, 8916, 2868, 1967, 2987, 4300],
[1951, 10048, 2060, 6171, 1967, 2987, 4300],
[8010, 16145, 8090, 8045, 1967, 2987, 4300],
Expand Down
4 changes: 2 additions & 2 deletions website/src/pages/chord/api.tsx
Expand Up @@ -34,13 +34,13 @@ const ChordApi = () => {
chartClass="chord"
apiPath="/charts/chord"
flavors={meta.flavors}
dataProperty="matrix"
//dataProperty="matrix"
controlGroups={groups}
propsMapper={mapper}
defaultProps={{
width: 800,
height: 800,
matrix: JSON.stringify(data.matrix, null, ' '),
data: JSON.stringify(data.matrix, null, ' '),
keys: data.keys,
margin: {
top: 40,
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/chord/canvas.tsx
Expand Up @@ -49,7 +49,7 @@ const initialProperties = {
modifiers: [['darker', 1]],
},

colors: { scheme: 'paired' },
colors: { scheme: 'red_blue' },

isInteractive: true,
arcHoverOpacity: 1,
Expand Down

0 comments on commit a992666

Please sign in to comment.