File size: 1,954 Bytes
1e92f2d | 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 76 77 78 79 80 81 82 | import { BoxPlotItem } from './BoxPlotItem'
import { BoxPlotTooltip, BoxPlotTooltipLabel } from './BoxPlotTooltip'
import { InheritedColorConfig, OrdinalColorScaleConfig } from '@nivo/colors'
import { ScaleBandSpec, ScaleLinearSpec } from '@nivo/scales'
import { ComputedBoxPlotSummary } from './types'
export const defaultProps = {
value: 'value',
groupBy: 'group',
groups: null,
subGroupBy: null,
subGroups: null,
quantiles: [0.1, 0.25, 0.5, 0.75, 0.9],
layout: 'vertical' as const,
minValue: 'auto' as const,
maxValue: 'auto' as const,
valueScale: { type: 'linear' } as ScaleLinearSpec,
indexScale: { type: 'band', round: true } as ScaleBandSpec,
padding: 0.1,
innerPadding: 6,
opacity: 1,
activeOpacity: 1,
inactiveOpacity: 0.25,
axisTop: null,
axisRight: null,
axisBottom: {},
axisLeft: {},
enableGridX: false,
enableGridY: true,
valueFormat: (value: number) => value.toPrecision(4),
colorBy: 'subGroup' as const,
colors: { scheme: 'nivo' } as OrdinalColorScaleConfig,
borderRadius: 0,
borderWidth: 0,
borderColor: { from: 'color' } as InheritedColorConfig<ComputedBoxPlotSummary>,
medianWidth: 2,
medianColor: {
from: 'color',
modifiers: [['darker', 2.0]],
} as InheritedColorConfig<ComputedBoxPlotSummary>,
whiskerWidth: 2,
whiskerColor: {
from: 'color',
} as InheritedColorConfig<ComputedBoxPlotSummary>,
whiskerEndSize: 0.6,
isInteractive: true,
tooltip: BoxPlotTooltip,
tooltipLabel: BoxPlotTooltipLabel,
legends: [],
annotations: [],
markers: [],
}
export const svgDefaultProps = {
...defaultProps,
layers: ['grid', 'axes', 'boxPlots', 'markers', 'legends', 'annotations'],
boxPlotComponent: BoxPlotItem,
defs: [],
fill: [],
animate: true,
motionConfig: 'default',
role: 'img',
isFocusable: false,
}
|