import { boolean } from '@storybook/addon-knobs' ; import React from 'react' ; import { BarSeries , Chart , ScaleType , Settings } from '@elastic/charts' ; import { useBaseTheme } from '../../use_base_theme' ; export const Example = ( ) => { const toggleSpec = boolean ( 'toggle bar spec' , true ) ; const data1 = [ { x : 0 , y : 2 } , { x : 1 , y : 7 } , { x : 2 , y : 3 } , { x : 3 , y : 6 } , ] ; const data2 = data1 . map ( ( datum ) => ( { ... datum , y : datum . y - 1 } ) ) ; const data = toggleSpec ? data1 : data2 ; const specId = toggleSpec ? 'bars1' : 'bars2' ; return ( < Chart > < Settings baseTheme = { useBaseTheme ( ) } / > < BarSeries id = { specId } name = "Simple bar series" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } data = { data } / > < /Chart>); } ;