Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
887 Bytes
import { RadarSvgProps } from '@nivo/radar'
import { settingsMapper, UnmappedSettings } from '../../../lib/settings'
import { mapFormat, mapLegends } from '../../../lib/property-mappers'
export type MappedRadarProps = Omit<RadarSvgProps<any>, 'data' | 'keys' | 'width' | 'height'>
export type UnmappedRadarProps = UnmappedSettings<
MappedRadarProps,
{
valueFormat: {
format: string
enabled: boolean
}
dotLabel: string
}
>
export default settingsMapper<UnmappedRadarProps, MappedRadarProps>({
valueFormat: mapFormat,
dotLabel: (value: string) => {
if (value === `p => \`\${p.key}: \${p.value}\``) return (p: any) => `${p.key}: ${p.value}`
if (value === `p => \`\${p.index}: \${p.value}\``)
return (p: any) => `${p.index}: ${p.value}`
return value
},
legends: mapLegends,
})