forked from plouc/nivo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprops.ts
75 lines (57 loc) · 1.87 KB
/
props.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { BarItem } from './BarItem'
import { BarTooltip } from './BarTooltip'
import { BarCanvasLayerId, BarLayerId, ComputedDatum } from './types'
import { InheritedColorConfig, OrdinalColorScaleConfig } from '@nivo/colors'
import { ScaleBandSpec, ScaleSpec } from '@nivo/scales'
export const defaultProps = {
indexBy: 'id',
keys: ['value'],
groupMode: 'stacked' as const,
layout: 'vertical' as const,
reverse: false,
minValue: 'auto' as const,
maxValue: 'auto' as const,
valueScale: { type: 'linear' } as ScaleSpec,
indexScale: { type: 'band', round: true } as ScaleBandSpec,
padding: 0.1,
innerPadding: 0,
axisBottom: {},
axisLeft: {},
enableGridX: false,
enableGridY: true,
enableLabel: true,
label: 'formattedValue',
labelSkipWidth: 0,
labelSkipHeight: 0,
labelTextColor: { from: 'theme', theme: 'labels.text.fill' },
colorBy: 'id' as const,
colors: { scheme: 'nivo' } as OrdinalColorScaleConfig,
borderRadius: 0,
borderWidth: 0,
borderColor: { from: 'color' } as InheritedColorConfig<any>,
isInteractive: true,
tooltip: BarTooltip,
tooltipLabel: <RawDatum>(datum: ComputedDatum<RawDatum>) => `${datum.id} - ${datum.indexValue}`,
legends: [],
initialHiddenIds: [],
annotations: [],
markers: [],
enableTotals: false,
totalsOffset: 10,
}
export const svgDefaultProps = {
...defaultProps,
layers: ['grid', 'axes', 'bars', 'markers', 'legends', 'annotations'] as BarLayerId[],
barComponent: BarItem,
defs: [],
fill: [],
animate: true,
motionConfig: 'default',
role: 'img',
isFocusable: false,
}
export const canvasDefaultProps = {
...defaultProps,
layers: ['grid', 'axes', 'bars', 'legends', 'annotations'] as BarCanvasLayerId[],
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio ?? 1 : 1,
}