mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Lens] Fixes bug with empty data and a reference line (#131922)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
e3e9e009fd
commit
63f2d66471
2 changed files with 25 additions and 2 deletions
|
@ -757,6 +757,29 @@ describe('XYChart component', () => {
|
|||
expect(component.find(EmptyPlaceholder).prop('icon')).toBeDefined();
|
||||
});
|
||||
|
||||
test('it renders empty placeholder for no results with references layer', () => {
|
||||
const { data, args } = sampleArgsWithReferenceLine();
|
||||
const emptyDataLayers = args.layers.map((layer) => {
|
||||
if (layer.type === 'dataLayer') {
|
||||
return { ...layer, table: { ...data, rows: [] } };
|
||||
} else {
|
||||
return layer;
|
||||
}
|
||||
});
|
||||
const component = shallow(
|
||||
<XYChart
|
||||
{...defaultProps}
|
||||
args={{
|
||||
...args,
|
||||
layers: emptyDataLayers,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(component.find(BarSeries)).toHaveLength(0);
|
||||
expect(component.find(EmptyPlaceholder).prop('icon')).toBeDefined();
|
||||
});
|
||||
|
||||
test('onBrushEnd returns correct context data for date histogram data', () => {
|
||||
const { args } = sampleArgs();
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ export function XYChart({
|
|||
[dataLayers, formatFactory]
|
||||
);
|
||||
|
||||
if (filteredLayers.length === 0) {
|
||||
if (dataLayers.length === 0) {
|
||||
const icon: IconType = getIconForSeriesType(
|
||||
getDataLayers(layers)?.[0]?.seriesType || SeriesTypes.BAR
|
||||
);
|
||||
|
@ -253,7 +253,7 @@ export function XYChart({
|
|||
const annotationsLayers = getAnnotationsLayers(layers);
|
||||
const firstTable = dataLayers[0]?.table;
|
||||
|
||||
const xColumnId = firstTable.columns.find((col) => col.id === dataLayers[0]?.xAccessor)?.id;
|
||||
const xColumnId = firstTable?.columns.find((col) => col.id === dataLayers[0]?.xAccessor)?.id;
|
||||
|
||||
const groupedLineAnnotations = getAnnotationsGroupedByInterval(
|
||||
annotationsLayers,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue