mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Lens] Fix area percentage gaps with zero fitting function (#94086)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
91f7711da6
commit
ed95c08d71
1 changed files with 16 additions and 9 deletions
|
@ -648,6 +648,14 @@ export function XYChart({
|
|||
layersAlreadyFormatted
|
||||
);
|
||||
|
||||
const isStacked = seriesType.includes('stacked');
|
||||
const isPercentage = seriesType.includes('percentage');
|
||||
const isBarChart = seriesType.includes('bar');
|
||||
const enableHistogramMode =
|
||||
isHistogram &&
|
||||
(isStacked || !splitAccessor) &&
|
||||
(isStacked || !isBarChart || !chartHasMoreThanOneBarSeries);
|
||||
|
||||
// For date histogram chart type, we're getting the rows that represent intervals without data.
|
||||
// To not display them in the legend, they need to be filtered out.
|
||||
const rows = tableConverted.rows.filter(
|
||||
|
@ -674,7 +682,7 @@ export function XYChart({
|
|||
|
||||
const seriesProps: SeriesSpec = {
|
||||
splitSeriesAccessors: splitAccessor ? [splitAccessor] : [],
|
||||
stackAccessors: seriesType.includes('stacked') ? [xAccessor as string] : [],
|
||||
stackAccessors: isStacked ? [xAccessor as string] : [],
|
||||
id: `${splitAccessor}-${accessor}`,
|
||||
xAccessor: xAccessor || 'unifiedX',
|
||||
yAccessors: [accessor],
|
||||
|
@ -710,13 +718,8 @@ export function XYChart({
|
|||
);
|
||||
},
|
||||
groupId: yAxis?.groupId,
|
||||
enableHistogramMode:
|
||||
isHistogram &&
|
||||
(seriesType.includes('stacked') || !splitAccessor) &&
|
||||
(seriesType.includes('stacked') ||
|
||||
!seriesType.includes('bar') ||
|
||||
!chartHasMoreThanOneBarSeries),
|
||||
stackMode: seriesType.includes('percentage') ? StackMode.Percentage : undefined,
|
||||
enableHistogramMode,
|
||||
stackMode: isPercentage ? StackMode.Percentage : undefined,
|
||||
timeZone,
|
||||
areaSeriesStyle: {
|
||||
point: {
|
||||
|
@ -797,7 +800,11 @@ export function XYChart({
|
|||
case 'area_stacked':
|
||||
case 'area_percentage_stacked':
|
||||
return (
|
||||
<AreaSeries key={index} {...seriesProps} fit={getFitOptions(fittingFunction)} />
|
||||
<AreaSeries
|
||||
key={index}
|
||||
{...seriesProps}
|
||||
fit={isPercentage ? 'zero' : getFitOptions(fittingFunction)}
|
||||
/>
|
||||
);
|
||||
case 'area':
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue