import { action } from '@storybook/addon-actions' ; import { number , boolean } from '@storybook/addon-knobs' ; import React from 'react' ; import { Axis , Chart , BubbleSeries , 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 ( ) ; export const Example = ( ) => { const onElementListeners = { onElementClick : action ( 'onElementClick' ) , onElementOver : action ( 'onElementOver' ) , onElementOut : action ( 'onElementOut' ) , } ; const markSizeRatio = number ( 'markSizeRatio' , 30 , { range : true , min : 1 , max : 100 , step : 1 , } ) ; const size = number ( 'total points' , 20 , { range : true , min : 10 , max : 50 , step : 5 , } ) ; const data = dg . generateRandomGroupedSeries ( size , 4 ) ; return ( < Chart > < Settings showLegend tooltip = { { type : TooltipType . Follow , snap : false , } } theme = { { markSizeRatio , } } baseTheme = { useBaseTheme ( ) } debug = { boolean ( 'debug' , false ) } pointBuffer = { ( r ) => 20 / r } { ... onElementListeners } /> < Axis id = "bottom" position = { Position . Bottom } title = "Bottom axis" / > < Axis id = "left2" title = "Left axis" position = { Position . Left } tickFormat = { ( d ) => Number ( d ) . toFixed ( 2 ) } /> < BubbleSeries id = "bubbles" xScaleType = { ScaleType . Linear } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y' ] } splitSeriesAccessors = { [ 'g' ] } markSizeAccessor = "z" data = { data } / > < /Chart>); } ;