Skip to content

Commit ca4d469

Browse files
committed
feat: update chart titles for clarity and adjust y-axis settings in adoption, daily activity, and time saved charts
1 parent 16d2047 commit ca4d469

3 files changed

Lines changed: 51 additions & 16 deletions

File tree

frontend/src/app/main/copilot/copilot-value/adoption-chart/adoption-chart.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class AdoptionChartComponent implements OnInit, OnChanges {
2929
_chartOptions: Highcharts.Options = {
3030
yAxis: {
3131
title: {
32-
text: 'Adoption %'
32+
text: 'Adoption (% of Max Devs)'
3333
},
3434
min: 0,
3535
max: 100,

frontend/src/app/main/copilot/copilot-value/daily-activity-chart/daily-activity-chart.component.ts

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,40 @@ export class DailyActivityChartComponent implements OnInit, OnChanges {
3838
'.COM Chats': this.targets?.user.dailyDotComChats.target || 0
3939
};
4040

41+
// NEW: mapping for typical ranges (from, to)
42+
const typicalRangeMapping: Record<string, [number, number]> = {
43+
'IDE Suggestions': [50, 90],
44+
'IDE Accepts': [20, 40],
45+
'IDE Chats': [25, 40],
46+
'.COM Chats': [4, 8]
47+
};
48+
49+
// the code below is to set the target line on the chart, based on the series name
50+
// and the target value from the targets service. Target line only shows if the series is visible and other series are not
4151
let newTarget = 1000;
52+
let newTypicalFrom = 50;
53+
let newTypicalTo = 90;
4254
const visibleSeries = this.chart.series.filter(s => s.visible);
4355

4456
if (visibleSeries.length === 1) {
4557
const series = visibleSeries[0];
4658
if (series.name && targetMapping[series.name]) {
4759
newTarget = targetMapping[series.name];
4860
}
61+
// NEW: select typical range limits
62+
if (series.name && typicalRangeMapping[series.name]) {
63+
[newTypicalFrom, newTypicalTo] = typicalRangeMapping[series.name];
64+
}
4965
}
5066

5167
// Use chart instance to access yAxis
5268
const yAxis = this.chart.yAxis[0];
5369
const plotLineId = 'target-line';
70+
const plotBandId = 'typical-range';
5471

5572
yAxis.removePlotLine(plotLineId);
73+
yAxis.removePlotBand?.(plotBandId);
74+
5675
yAxis.addPlotLine({
5776
id: plotLineId,
5877
value: newTarget,
@@ -68,26 +87,42 @@ export class DailyActivityChartComponent implements OnInit, OnChanges {
6887
},
6988
zIndex: 2
7089
});
90+
91+
// also show typical range band only when one series is visible
92+
if (visibleSeries.length === 1) {
93+
yAxis.addPlotBand({
94+
id: plotBandId,
95+
from: newTypicalFrom,
96+
to: newTypicalTo,
97+
color: 'var(--sys-surface-variant)',
98+
label: {
99+
text: 'Typical Range',
100+
style: { color: 'var(--sys-on-surface-variant)' }
101+
},
102+
zIndex: 1
103+
});
104+
105+
// NEW: tighten y-axis max for the lone series
106+
const dataMax = Math.max(
107+
...visibleSeries[0].data.filter(v => typeof v === 'number') as number[]
108+
);
109+
const proposedMax = Math.max(dataMax, newTarget, newTypicalTo) * 1.15; // 15 % head-room
110+
111+
yAxis.setExtremes(undefined, proposedMax, false);
112+
} else {
113+
// reset to auto when multiple series are active
114+
yAxis.setExtremes(undefined, undefined, false);
115+
}
71116
}
72117
}
73118
},
74119
yAxis: {
75120
title: {
76-
text: 'Daily Activity Per Avg User'
121+
text: 'Daily Activity (per Avg User)'
77122
},
78123
min: 0,
79-
maxPadding: 1.7,
80-
plotBands: [{
81-
from: 500,
82-
to: 750,
83-
color: 'var(--sys-surface-variant)',
84-
label: {
85-
text: 'Typical Range',
86-
style: {
87-
color: 'var(--sys-on-surface-variant)'
88-
}
89-
}
90-
}]
124+
maxPadding: 0.2, // was 1.2 – shrink default empty space
125+
plotBands: [] // start with no typical-range band
91126
},
92127
tooltip: {
93128
headerFormat: '<b>{point.x:%b %d, %Y}</b><br/>',

frontend/src/app/main/copilot/copilot-value/time-saved-chart/time-saved-chart.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export class TimeSavedChartComponent implements OnInit, OnChanges {
2626
_chartOptions: Highcharts.Options = {
2727
yAxis: {
2828
title: {
29-
text: 'Time Saved (hrs per week)'
29+
text: 'Time Saved (Hrs per Week)'
3030
},
3131
min: 0,
32-
// max: 12,
32+
max: 10,
3333
labels: {
3434
format: '{value}hrs'
3535
},

0 commit comments

Comments
 (0)