@@ -35,15 +35,19 @@ export class DailyActivityChartComponent implements OnInit, OnChanges {
3535 'IDE Suggestions' : this . targets ?. user . dailySuggestions . target || 0 ,
3636 'IDE Accepts' : this . targets ?. user . dailyAcceptances . target || 0 ,
3737 'IDE Chats' : this . targets ?. user . dailyChatTurns . target || 0 ,
38- '.COM Chats' : this . targets ?. user . dailyDotComChats . target || 0
38+ '.COM Chats' : this . targets ?. user . dailyDotComChats . target || 0 ,
39+ 'IDE Acceptance Rate' : 100 * ( this . targets ?. user . dailyAcceptances . target || 0 ) / ( this . targets ?. user . dailySuggestions . target || 0 ) , // NEW
40+ 'Pull Requests' : this . targets ?. user . weeklyPRSummaries . target || 0 / 5 // 5 days in a week
3941 } ;
4042
4143 // NEW: mapping for typical ranges (from, to)
4244 const typicalRangeMapping : Record < string , [ number , number ] > = {
4345 'IDE Suggestions' : [ 50 , 90 ] ,
44- 'IDE Accepts' : [ 20 , 40 ] ,
46+ 'IDE Accepts' : [ 15 , 40 ] ,
4547 'IDE Chats' : [ 25 , 40 ] ,
46- '.COM Chats' : [ 4 , 8 ]
48+ '.COM Chats' : [ 4 , 8 ] ,
49+ 'IDE Acceptance Rate' : [ 20 , 40 ] , // NEW – percentage range (example)
50+ 'Pull Requests' : [ 1 , 3 ] // NEW example range
4751 } ;
4852
4953 // the code below is to set the target line on the chart, based on the series name
@@ -136,19 +140,36 @@ export class DailyActivityChartComponent implements OnInit, OnChanges {
136140 fontSize : '14px'
137141 }
138142 } ,
139- series : [ {
140- name : 'IDE Suggestions' ,
141- type : 'spline' ,
142- } , {
143- name : 'IDE Accepts' ,
144- type : 'spline' ,
145- } , {
146- name : 'IDE Chats' ,
147- type : 'spline' ,
148- } , {
149- name : '.COM Chats' ,
150- type : 'spline' ,
151- } ]
143+ series : [
144+ { name : 'IDE Suggestions' , type : 'spline' , data : [ ] , zIndex : 5 } ,
145+ { name : 'IDE Accepts' , type : 'spline' , data : [ ] , zIndex : 4 } ,
146+ { name : 'IDE Acceptance Rate' , type : 'spline' , data : [ ] , zIndex : 3 } ,
147+ { name : 'IDE Chats' , type : 'spline' , data : [ ] , color : '#00E676' , zIndex : 5 } ,
148+ { name : '.COM Chats' , type : 'spline' , data : [ ] , color : '#E91E63' , zIndex : 4 } ,
149+ { name : 'Pull Requests' , type : 'spline' , data : [ ] , color : '#9C27B0' , zIndex : 3 }
150+ ] ,
151+ plotOptions : {
152+ series : {
153+ events : {
154+ legendItemClick : function ( ) {
155+ const chart = this . chart as Highcharts . Chart & { _isolated ?: Highcharts . Series } ;
156+
157+ // if this series is already isolated → restore all
158+ if ( chart . _isolated === this ) {
159+ chart . series . forEach ( s => s . setVisible ( true , false ) ) ;
160+ chart . _isolated = undefined ;
161+ } else {
162+ // isolate the clicked series
163+ chart . series . forEach ( s => s . setVisible ( s === this , false ) ) ;
164+ chart . _isolated = this ;
165+ }
166+
167+ chart . redraw ( false ) ;
168+ return false ; // prevent default toggle
169+ }
170+ }
171+ }
172+ }
152173 } ;
153174
154175 constructor (
@@ -167,7 +188,9 @@ export class DailyActivityChartComponent implements OnInit, OnChanges {
167188 ...this . _chartOptions ,
168189 ...this . highchartsService . transformMetricsToDailyActivityLine ( this . activity , this . metrics )
169190 } ;
170- this . updateFlag = true ;
191+ console . log ( 'chart opts' , this . _chartOptions . series ) ; // DEBUG
192+ // toggle so <highcharts-chart> detects a change
193+ this . updateFlag = ! this . updateFlag ;
171194 }
172195 }
173196
0 commit comments