import { boolean , color } from '@storybook/addon-knobs' ; import React from 'react' ; import { Chart , Datum , Partition , PartitionLayout , Settings , defaultPartitionValueFormatter } from '@elastic/charts' ; import { mocks } from '@elastic/charts/src/mocks/hierarchical' ; import { useBaseTheme } from '../../use_base_theme' ; import { indexInterpolatedFillColor , interpolatorCET2s , productLookup } from '../utils/utils' ; export const Example = ( ) => ( < Chart > < Settings theme = { { chartMargins : { top : 0 , left : 0 , bottom : 0 , right : 0 } , partition : { linkLabel : { maximumSection : Infinity , textColor : boolean ( 'custom linkLabel.textColor' , true ) ? color ( 'linkLabel.textColor' , 'rgba(0, 0, 0, 1)' ) : undefined , } , } , } } baseTheme = { useBaseTheme ( ) } / > < Partition id = "spec_1" data = { mocks . pie } layout = { PartitionLayout . sunburst } valueAccessor = { ( d ) => d . exportVal as number } valueFormatter = { ( d ) => `$${ defaultPartitionValueFormatter ( Math . round ( d / 1000000000 ) ) }\u00A0Bn` } layers = { [ { groupByRollup : ( d ) => d . sitc1 , nodeLabel : ( d ) => productLookup [ d ] . name , shape : { fillColor : indexInterpolatedFillColor ( interpolatorCET2s ) , } , } , ] } / > < /Chart>);