Describe the bug
When a chart is configured with a split series accessor, but the data has only one series with one accessor value, the name of the series in the legend and in the tooltip is equal to the name or to the Id of the Series.
To Reproduce
Steps to reproduce the behavior:
Use the following playground
import React, { Fragment } from 'react';
import { Axis, Chart, getAxisId, getSpecId, Position, ScaleType, BarSeries, Settings } from '../src';
export class Playground extends React.Component<{}, { dataLimit: boolean }> {
state = {
dataLimit: false,
};
changeData = () => {
this.setState((prevState) => {
return {
dataLimit: !prevState.dataLimit,
};
});
};
render() {
const data = [
{
g: 'authentication_failure',
i: 'aa',
x: 1571212800000,
y: 16,
y1: 2,
},
{
x: 1571290200000,
y: 1,
y1: 5,
g: 'authentication_success',
},
];
return (
<Fragment>
<div>
<button onClick={this.changeData}>Reduce data</button>
</div>
<div className="chart">
<Chart>
<Settings showLegend />
<Axis id={getAxisId('top')} position={Position.Bottom} title={'Top axis'} />
<Axis
id={getAxisId('left2')}
title={'Left axis'}
position={Position.Left}
tickFormat={(d: any) => Number(d).toFixed(2)}
/>
<BarSeries
id={getSpecId('bars1')}
xScaleType={ScaleType.Linear}
yScaleType={ScaleType.Linear}
xAccessor="x"
yAccessors={['y']}
splitSeriesAccessors={['g']}
stackAccessors={['x']}
data={data.slice(0, this.state.dataLimit ? 1 : 2)}
/>
</Chart>
</div>
</Fragment>
);
}
}
and click on the button
Expected behavior
If the series is configured with splitSeriesAccessors and we rely on this accessors values to define the name of the series, for consistency we should keep the same behaviour also when we have just one series in the data.
Screenshots
Current behaviour:

Version (please complete the following information):
Additional context
Was discovered by SIEM team when adding an histogram
Errors in browser console
n/a
Kibana Cross Issues
elastic/kibana#48260
Checklist
Describe the bug
When a chart is configured with a split series accessor, but the data has only one series with one accessor value, the name of the series in the legend and in the tooltip is equal to the name or to the Id of the Series.
To Reproduce
Steps to reproduce the behavior:
Use the following playground
and click on the button
Expected behavior
If the series is configured with
splitSeriesAccessorsand we rely on this accessors values to define the name of the series, for consistency we should keep the same behaviour also when we have just one series in the data.Screenshots
Current behaviour:
Version (please complete the following information):
Additional context
Was discovered by SIEM team when adding an histogram
Errors in browser console
n/a
Kibana Cross Issues
elastic/kibana#48260
Checklist
Kibana Cross Issueslistkibana cross issuetag is associated to the issue if any kibana cross issue is present