import { boolean } from '@storybook/addon-knobs' ; import React from 'react' ; import { AreaSeries , Axis , BarSeries , Chart , CurveType , LineSeries , Position , ScaleType , Settings , TooltipType , } from '@elastic/charts' ; import { SeededDataGenerator } from '@elastic/charts/src/mocks/utils' ; import { useBaseTheme } from '../../use_base_theme' ; const dg = new SeededDataGenerator ( ) ; const data1 = dg . generateGroupedSeries ( 40 , 4 ) ; const data2 = dg . generateSimpleSeries ( 40 ) ; const data3 = dg . generateSimpleSeries ( 40 ) ; export const Example = ( ) => { const hideBars = boolean ( 'Hide Bars' , false ) ; return ( < Chart > < Settings baseTheme = { useBaseTheme ( ) } debug = { boolean ( 'Debug' , false ) } showLegend showLegendExtra tooltip = { TooltipType . Crosshairs } / > < Axis id = "bottom" position = { Position . Bottom } title = "Bottom axis" showOverlappingTicks / > < Axis id = "left2" title = "Left axis" position = { Position . Left } tickFormat = { ( d ) => Number ( d ) . toFixed ( 2 ) } /> < Axis id = "top" position = { Position . Top } title = "Top axis" showOverlappingTicks / > < Axis id = "right" title = "Right axis" position = { Position . Right } tickFormat = { ( d ) => Number ( d ) . toFixed ( 2 ) } /> { ! hideBars && ( < BarSeries id = "bars" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } splitSeriesAccessors = { [ 'g' ] } stackAccessors = { [ 'x' ] } data = { data1 } / > ) } < LineSeries id = "lines" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } curve = { CurveType . CURVE_MONOTONE_X } data = { data2 } / > < AreaSeries id = "areas" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } curve = { CurveType . CURVE_MONOTONE_X } data = { data3 } / > < /Chart>); } ; Example . parameters = { theme : { default : 'dark' } , } ;