import React from 'react' ; import { Axis , BarSeries , Chart , Position , ScaleType , Settings , SeriesNameConfigOptions } from '@elastic/charts' ; import * as TestDatasets from '@elastic/charts/src/utils/data_samples/test_dataset' ; import { useBaseTheme } from '../../use_base_theme' ; export const Example = ( ) => { const customSeriesNameOptions = { names : [ { accessor : 'g' , value : 'a' , name : 'replace a(from g)' , } , { accessor : 'y2' , name : 'replace y2' , } , ] , delimiter : ' | ' , } ; return ( < Chart > < Settings showLegend showLegendExtra legendPosition = { Position . Right } baseTheme = { useBaseTheme ( ) } / > < 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 ) } /> < BarSeries id = "bars1" xScaleType = { ScaleType . Ordinal } yScaleType = { ScaleType . Linear } xAccessor = "x" yAccessors = { [ 'y1' , 'y2' ] } splitSeriesAccessors = { [ 'g' ] } data = { TestDatasets . BARCHART_2Y1G } name = { customSeriesNameOptions } / > < /Chart>); } ;