diff --git a/src/components/DistributionComparisonModal.svelte b/src/components/DistributionComparisonModal.svelte index a40f9fb55..963588249 100644 --- a/src/components/DistributionComparisonModal.svelte +++ b/src/components/DistributionComparisonModal.svelte @@ -13,7 +13,15 @@ export let distViewButtonId; let normalized = $store.productDimensions.normalizationType === 'normalized'; + let probeType = $store.probe.type; + let probeKind = $store.probe.details.kind; let cumulative = false; + let activeCategoricalProbeLabels = + probeKind === 'categorical' + ? $store.probe.details.labels.filter((l) => + $store.activeBuckets.includes(l) + ) + : []; let valueSelector = 'value'; // Change this value to adjust the minimum tick increment on the chart @@ -49,9 +57,16 @@ }; const buildDensity = function (chartData) { - let density = normalized - ? chartData[densityMetricType] - : convertValueToPercentage(chartData[densityMetricType]); + let density = chartData[densityMetricType]; + if (probeKind === 'categorical') { + let categoricalProbeLabels = $store.probe.details.labels; + density = density.filter((v, i) => + $store.activeBuckets.includes(categoricalProbeLabels[i]) + ); + } + if (probeType === 'scalar' || !normalized) { + density = convertValueToPercentage(chartData[densityMetricType]); + } return cumulative ? makeCumulative(density) : density; }; @@ -111,11 +126,13 @@
Reference
@@ -128,6 +145,7 @@ density={topChartDensity} {topTick} {tickIncrement} + {activeCategoricalProbeLabels} >