@@ -38,6 +38,7 @@ export class GlTimelineChart extends GlElement {
3838 private readonly _commitsByTimestamp = new Map < string , Commit > ( ) ;
3939 private readonly _authorsByIndex = new Map < number , string > ( ) ;
4040 private readonly _indexByAuthors = new Map < string , number > ( ) ;
41+ private readonly _zByAuthorAndX = new Map < string , Map < number , number > > ( ) ;
4142
4243 private _abortController ?: AbortController ;
4344 private _loading ?: ReturnType < typeof defer < void > > ;
@@ -147,6 +148,7 @@ export class GlTimelineChart extends GlElement {
147148 this . _commitsByTimestamp . clear ( ) ;
148149 this . _authorsByIndex . clear ( ) ;
149150 this . _indexByAuthors . clear ( ) ;
151+ this . _zByAuthorAndX . clear ( ) ;
150152
151153 const xs : Record < string , string > = { } ;
152154 const colors : Record < string , string > = { } ;
@@ -197,7 +199,7 @@ export class GlTimelineChart extends GlElement {
197199 return result ;
198200 } ;
199201
200- const { bb, bar, bubble , zoom } = await import ( /* webpackChunkName: "lib-billboard" */ 'billboard.js' ) ;
202+ const { bb, bar, scatter , zoom } = await import ( /* webpackChunkName: "lib-billboard" */ 'billboard.js' ) ;
201203 if ( abortSignal ?. aborted ) {
202204 loading ?. cancel ( ) ;
203205 return ;
@@ -249,7 +251,7 @@ export class GlTimelineChart extends GlElement {
249251
250252 names [ author ] = author ;
251253
252- types [ author ] = bubble ( ) ;
254+ types [ author ] = scatter ( ) ;
253255
254256 group . push ( authorX ) ;
255257 }
@@ -260,11 +262,15 @@ export class GlTimelineChart extends GlElement {
260262
261263 series [ authorX ] . push ( date ) ;
262264
265+ series [ author ] . push ( this . _indexByAuthors . get ( author ) ) ;
266+
267+ let zAuthor = this . _zByAuthorAndX . get ( author ) ;
268+ if ( zAuthor == null ) {
269+ zAuthor = new Map ( ) ;
270+ this . _zByAuthorAndX . set ( author , zAuthor ) ;
271+ }
263272 const z = additions == null && deletions == null ? 6 : bubbleScale ( ( additions ?? 0 ) + ( deletions ?? 0 ) ) ;
264- series [ author ] . push ( {
265- y : this . _indexByAuthors . get ( author ) ,
266- z : z ,
267- } ) ;
273+ zAuthor . set ( new Date ( date ) . getTime ( ) , z ) ;
268274
269275 this . _commitsByTimestamp . set ( date , commit ) ;
270276 }
@@ -387,12 +393,7 @@ export class GlTimelineChart extends GlElement {
387393 } ,
388394 } ,
389395 bar : { width : 2 , sensitivity : 4 , padding : 2 } ,
390- bubble : {
391- maxR : 75 ,
392- // maxR: d => {
393- // const z = (d as { value: { z: number } })?.value.z;
394- // return z == null || isNaN(z) ? 6 : z;
395- // },
396+ scatter : {
396397 zerobased : true ,
397398 } ,
398399 grid : {
@@ -412,7 +413,41 @@ export class GlTimelineChart extends GlElement {
412413 } ,
413414 tooltip : true ,
414415 } ,
415- point : { sensitivity : d => Math . max ( 6 , ( ( d as unknown as { value : { z : number } } ) . value ?. z ?? 6 ) / 2 ) } ,
416+ point : {
417+ r : d => {
418+ if ( d == null ) return 0 ;
419+
420+ if ( 'data' in d && typeof d . data === 'function' ) {
421+ d = d . data ( ) [ 0 ] ;
422+ if ( d == null ) return 0 ;
423+ }
424+
425+ const result = Math . max (
426+ 6 ,
427+ this . _zByAuthorAndX . get ( d . id ) ?. get ( ( d . x as unknown as Date ) . getTime ( ) ) ?? 6 ,
428+ ) ;
429+ return result ;
430+ } ,
431+ focus : {
432+ expand : {
433+ enabled : true ,
434+ } ,
435+ } ,
436+ sensitivity : d => {
437+ if ( d == null ) return 0 ;
438+
439+ if ( 'data' in d && typeof d . data === 'function' ) {
440+ d = d . data ( ) [ 0 ] ;
441+ if ( d == null ) return 0 ;
442+ }
443+
444+ const result = Math . max (
445+ 6 ,
446+ ( this . _zByAuthorAndX . get ( d . id ) ?. get ( ( d . x as unknown as Date ) . getTime ( ) ) ?? 6 ) / 2 ,
447+ ) ;
448+ return result ;
449+ } ,
450+ } ,
416451 resize : { auto : true } ,
417452 tooltip : {
418453 contents : ( data , _defaultTitleFormat , _defaultValueFormat , _color ) => {
0 commit comments