import { boolean , number } from '@storybook/addon-knobs' ; import React from 'react' ; import { Axis , BarSeries , Chart , PartialTheme , Position , ScaleType , Settings } from '@elastic/charts' ; import { useBaseTheme } from '../../use_base_theme' ; import { getChartRotationKnob } from '../utils/knobs' ; export const Example = ( ) => { const hasCustomDomain = boolean ( 'has custom domain' , false ) ; const xDomain = hasCustomDomain ? { min : 0 , max : NaN , } : undefined ; const theme = { scales : { barsPadding : number ( 'bars padding' , 0.25 , { range : true , min : 0 , max : 1 , step : 0.1 , } ) , } , } ; return ( < Chart > < Settings xDomain = { xDomain } rotation = { getChartRotationKnob ( ) } theme = { theme } baseTheme = { useBaseTheme ( ) } / > < Axis id = "bottom" position = { Position . Bottom } title = "Bottom axis" / > < Axis id = "left2" title = "Left axis" position = { Position . Left } tickFormat = { ( d ) => Number ( d ) . toFixed ( 2 ) } /> < BarSeries id = "bars" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } data = { [ { x : 1 , y : 10 } ] } / > < /Chart>); } ;