import React from 'react' ; import { Chart , Datum , Partition , Settings , PartialTheme , 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' ; const theme = { chartMargins : { top : 0 , left : 0 , bottom : 0 , right : 0 } , partition : { linkLabel : { valueFont : { fontWeight : 900 , fontStyle : 'italic' } } , } , } ; export const Example = ( ) => ( < Chart > < Settings theme = { theme } baseTheme = { useBaseTheme ( ) } / > < Partition id = "spec_1" data = { mocks . pie } valueAccessor = { ( d ) => d . exportVal as number } valueFormatter = { ( d ) => `$${ defaultPartitionValueFormatter ( Math . round ( d / 1000000000 ) ) }\u00A0Bn` } layers = { [ { groupByRollup : ( d ) => d . sitc1 , nodeLabel : ( d ) => productLookup [ d ] . name , fillLabel : { valueFont : { fontWeight : 900 , fontStyle : 'italic' } } , shape : { fillColor : indexInterpolatedFillColor ( interpolatorCET2s ) , } , } , ] } / > < /Chart>); Example . parameters = { background : { default : 'white' } , } ;