@@ -29,7 +29,10 @@ import type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-f
29
29
import type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager' ;
30
30
import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager' ;
31
31
import type { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer' ;
32
- import type { BinSnappingInterval } from '@internetarchive/histogram-date-range' ;
32
+ import type {
33
+ BarScalingOption ,
34
+ BinSnappingInterval ,
35
+ } from '@internetarchive/histogram-date-range' ;
33
36
import chevronIcon from './assets/img/icons/chevron' ;
34
37
import expandIcon from './assets/img/icons/expand' ;
35
38
import {
@@ -258,23 +261,36 @@ export class CollectionFacets extends LitElement {
258
261
259
262
const zeroPadMonth = ( month : number ) => month . toString ( ) . padStart ( 2 , '0' ) ;
260
263
261
- // Format the min/max dates appropriately
262
- const minDate = this . isTvSearch
263
- ? `${ firstYear } -${ zeroPadMonth ( firstMonth ) } `
264
- : `${ firstYear } ` ;
265
-
266
- const maxDate = this . isTvSearch
267
- ? `${ lastYear } -${ zeroPadMonth ( lastMonth + monthInterval - 1 ) } `
268
- : `${ lastYear + yearInterval - 1 } ` ;
264
+ // The date picker is configured differently for TV search, allowing month-level resolution
265
+ if ( this . isTvSearch ) {
266
+ // Whether the bucket interval is less than a year
267
+ // (i.e., requires individual months to be handled & labeled)
268
+ const mustHandleMonths = monthInterval < 12 ;
269
+
270
+ return {
271
+ buckets : aggregation . buckets as number [ ] ,
272
+ dateFormat : 'YYYY-MM' ,
273
+ tooltipDateFormat : mustHandleMonths ? 'MMM YYYY' : 'YYYY' ,
274
+ tooltipLabel : 'broadcast' ,
275
+ binSnapping : ( mustHandleMonths
276
+ ? 'month'
277
+ : 'year' ) as BinSnappingInterval ,
278
+ barScaling : 'linear' as BarScalingOption ,
279
+ minDate : `${ firstYear } -${ zeroPadMonth ( firstMonth ) } ` ,
280
+ maxDate : `${ lastYear } -${ zeroPadMonth ( lastMonth + monthInterval - 1 ) } ` ,
281
+ } ;
282
+ }
269
283
270
- const hasMonths = this . isTvSearch && monthInterval < 12 ;
284
+ // All other search types use the same configuration
271
285
return {
272
286
buckets : aggregation . buckets as number [ ] ,
273
- dateFormat : this . isTvSearch ? 'YYYY-MM' : 'YYYY' ,
274
- tooltipDateFormat : hasMonths ? 'MMM YYYY' : 'YYYY' ,
275
- binSnapping : ( hasMonths ? 'month' : 'year' ) as BinSnappingInterval ,
276
- minDate,
277
- maxDate,
287
+ dateFormat : 'YYYY' ,
288
+ tooltipDateFormat : 'YYYY' ,
289
+ tooltipLabel : 'item' ,
290
+ binSnapping : 'year' as BinSnappingInterval ,
291
+ barScaling : 'logarithmic' as BarScalingOption ,
292
+ minDate : `${ firstYear } ` ,
293
+ maxDate : `${ lastYear + yearInterval - 1 } ` ,
278
294
} ;
279
295
}
280
296
@@ -289,7 +305,9 @@ export class CollectionFacets extends LitElement {
289
305
buckets,
290
306
dateFormat,
291
307
tooltipDateFormat,
308
+ tooltipLabel,
292
309
binSnapping,
310
+ barScaling,
293
311
minDate,
294
312
maxDate,
295
313
} = histogramProps ;
@@ -317,9 +335,11 @@ export class CollectionFacets extends LitElement {
317
335
.maxDate = ${ maxDate }
318
336
.minSelectedDate = ${ this . minSelectedDate }
319
337
.maxSelectedDate = ${ this . maxSelectedDate }
320
- .dateFormat = ${ dateFormat }
321
- .tooltipDateFormat = ${ tooltipDateFormat }
338
+ .customDateFormat = ${ dateFormat }
339
+ .customTooltipDateFormat = ${ tooltipDateFormat }
340
+ .customTooltipLabel = ${ tooltipLabel }
322
341
.binSnapping = ${ binSnapping }
342
+ .barScaling = ${ barScaling }
323
343
.buckets = ${ buckets }
324
344
.modalManager = ${ this . modalManager }
325
345
.analyticsHandler = ${ this . analyticsHandler }
@@ -396,7 +416,9 @@ export class CollectionFacets extends LitElement {
396
416
buckets,
397
417
dateFormat,
398
418
tooltipDateFormat,
419
+ tooltipLabel,
399
420
binSnapping,
421
+ barScaling,
400
422
minDate,
401
423
maxDate,
402
424
} = histogramProps ;
@@ -411,7 +433,9 @@ export class CollectionFacets extends LitElement {
411
433
.updateDelay = ${ 100 }
412
434
.dateFormat = ${ dateFormat }
413
435
.tooltipDateFormat = ${ tooltipDateFormat }
436
+ .tooltipLabel = ${ tooltipLabel }
414
437
.binSnapping = ${ binSnapping }
438
+ .barScaling = ${ barScaling }
415
439
.bins = ${ buckets }
416
440
mis singDataMessage= "..."
417
441
.width=${ this . collapsableFacets && this . contentWidth
0 commit comments