@@ -977,7 +977,10 @@ const effectiveDataSingle = computed<EvolutionData>(() => {
977977
978978 if (isDownloadsMetric .value && data .length ) {
979979 if (settings .value .chartFilter .anomaliesFixed ) {
980- data = applyHampelCorrection (data )
980+ data = applyHampelCorrection (data , {
981+ halfWindow: settings .value .chartFilter .hampelWindow ,
982+ threshold: settings .value .chartFilter .hampelThreshold ,
983+ })
981984 }
982985 }
983986
@@ -1021,7 +1024,10 @@ const chartData = computed<{
10211024 let data = state .evolutionsByPackage [pkg ] ?? []
10221025 if (isDownloadsMetric .value && data .length ) {
10231026 if (settings .value .chartFilter .anomaliesFixed ) {
1024- data = applyHampelCorrection (data )
1027+ data = applyHampelCorrection (data , {
1028+ halfWindow: settings .value .chartFilter .hampelWindow ,
1029+ threshold: settings .value .chartFilter .hampelThreshold ,
1030+ })
10251031 }
10261032 }
10271033 const points = extractSeriesPoints (granularity , data )
@@ -1698,6 +1704,36 @@ watch(selectedMetric, value => {
16981704 class =" accent-[var(--accent-color,var(--fg-subtle))]"
16991705 />
17001706 </label >
1707+ </div >
1708+ <div v-if =" showCorrectionControls" class =" grid grid-cols-2 sm:flex items-end gap-3" >
1709+ <label class =" flex flex-col gap-1 flex-1" >
1710+ <span class =" text-2xs font-mono text-fg-subtle tracking-wide uppercase" >
1711+ {{ $t('package.trends.hampel_window') }}
1712+ <span class =" text-fg-muted" >({{ settings.chartFilter.hampelWindow }})</span >
1713+ </span >
1714+ <input
1715+ v-model.number =" settings.chartFilter.hampelWindow"
1716+ type =" range"
1717+ min =" 1"
1718+ max =" 10"
1719+ step =" 1"
1720+ class =" accent-[var(--accent-color,var(--fg-subtle))]"
1721+ />
1722+ </label >
1723+ <label class =" flex flex-col gap-1 flex-1" >
1724+ <span class =" text-2xs font-mono text-fg-subtle tracking-wide uppercase" >
1725+ {{ $t('package.trends.hampel_threshold') }}
1726+ <span class =" text-fg-muted" >({{ settings.chartFilter.hampelThreshold }})</span >
1727+ </span >
1728+ <input
1729+ v-model.number =" settings.chartFilter.hampelThreshold"
1730+ type =" range"
1731+ min =" 1"
1732+ max =" 10"
1733+ step =" 0.5"
1734+ class =" accent-[var(--accent-color,var(--fg-subtle))]"
1735+ />
1736+ </label >
17011737 <div class =" flex flex-col gap-1 shrink-0" >
17021738 <span
17031739 class =" text-2xs font-mono text-fg-subtle tracking-wide uppercase flex items-center justify-between"
0 commit comments