@@ -389,9 +389,10 @@ const isEndDateOnPeriodEnd = computed(() => {
389389const isEstimationGranularity = computed (
390390 () => displayedGranularity .value === ' monthly' || displayedGranularity .value === ' yearly' ,
391391)
392- const shouldRenderEstimationOverlay = computed (
393- () => ! pending .value && isEstimationGranularity .value ,
392+ const supportsEstimation = computed (
393+ () => isEstimationGranularity .value && selectedMetric .value !== ' contributors ' ,
394394)
395+ const shouldRenderEstimationOverlay = computed (() => ! pending .value && supportsEstimation .value )
395396
396397const startDate = usePermalink <string >(' start' , ' ' , {
397398 permanent: props .permalink ,
@@ -1018,9 +1019,15 @@ const chartData = computed<{
10181019
10191020const normalisedDataset = computed (() => {
10201021 return chartData .value .dataset ?.map (d => {
1022+ const lastValue = d .series .at (- 1 ) ?? 0
1023+
1024+ // Contributors is an absolute metric: keep the partial period value as-is.
1025+ const projectedLastValue =
1026+ selectedMetric .value === ' contributors' ? lastValue : extrapolateLastValue (lastValue )
1027+
10211028 return {
10221029 ... d ,
1023- series: [... d .series .slice (0 , - 1 ), extrapolateLastValue ( d . series . at ( - 1 ) ?? 0 ) ],
1030+ series: [... d .series .slice (0 , - 1 ), projectedLastValue ],
10241031 }
10251032 })
10261033})
@@ -1200,6 +1207,8 @@ function getCompletionRatioForBucket(params: {
12001207 * or the original `lastValue` when no extrapolation should be applied.
12011208 */
12021209function extrapolateLastValue(lastValue : number ) {
1210+ if (selectedMetric .value === ' contributors' ) return lastValue
1211+
12031212 if (displayedGranularity .value !== ' monthly' && displayedGranularity .value !== ' yearly' )
12041213 return lastValue
12051214
@@ -1382,11 +1391,7 @@ function drawSvgPrintLegend(svg: Record<string, any>) {
13821391 })
13831392
13841393 // Inject the estimation legend item when necessary
1385- if (
1386- [' monthly' , ' yearly' ].includes (displayedGranularity .value ) &&
1387- ! isEndDateOnPeriodEnd .value &&
1388- ! isZoomed .value
1389- ) {
1394+ if (supportsEstimation .value && ! isEndDateOnPeriodEnd .value && ! isZoomed .value ) {
13901395 seriesNames .push (`
13911396 <line
13921397 x1="${svg .drawingArea .left + 12 }"
@@ -1696,12 +1701,7 @@ watch(selectedMetric, value => {
16961701 <template #svg =" { svg } " >
16971702 <!-- Estimation lines for monthly & yearly granularities when the end date induces a downwards trend -->
16981703 <g
1699- v-if ="
1700- !pending &&
1701- ['monthly', 'yearly'].includes(displayedGranularity) &&
1702- !isEndDateOnPeriodEnd &&
1703- !isZoomed
1704- "
1704+ v-if =" shouldRenderEstimationOverlay && !isEndDateOnPeriodEnd && !isZoomed"
17051705 v-html =" drawEstimationLine(svg)"
17061706 />
17071707
@@ -1779,10 +1779,7 @@ watch(selectedMetric, value => {
17791779 </template >
17801780
17811781 <!-- Estimation extra legend item -->
1782- <div
1783- class =" flex gap-1 place-items-center"
1784- v-if =" ['monthly', 'yearly'].includes(selectedGranularity)"
1785- >
1782+ <div class =" flex gap-1 place-items-center" v-if =" supportsEstimation" >
17861783 <svg viewBox =" 0 0 20 2" width =" 20" >
17871784 <line
17881785 x1 =" 0"
0 commit comments