forked from lptr/gradle-code-evolution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
220 lines (201 loc) · 7.78 KB
/
Copy pathindex.html
File metadata and controls
220 lines (201 loc) · 7.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html>
<head>
<title>Module Sizes Over Time</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.2/dist/chart.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8/hammer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom@2.0.1/dist/chartjs-plugin-zoom.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-corner/dist/fork-corner.min.css">
<script src="https://cdn.jsdelivr.net/npm/fork-corner/dist/fork-corner.min.js" defer></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
body {
display: flex;
flex-direction: column;
}
#header {
margin: 0.5em;
}
#chart-container {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
margin: 0.5em;
}
canvas {
width: 100% !important;
height: 100% !important;
}
</style>
<script>
// Function to fetch and process the TSV file
async function fetchData() {
const response = await fetch('report.tsv');
const rawData = await response.text();
// Process the raw data
const lines = rawData.trim().split('\n');
lines.shift(); // Remove the header line
const dataMap = {};
const versionSet = new Set();
lines.forEach(line => {
const [module, version, size] = line.split('\t');
if (!dataMap[module]) {
dataMap[module] = {};
}
dataMap[module][version] = parseInt(size, 10);
versionSet.add(version);
});
const versions = Array.from(versionSet);
// Prepare datasets for Chart.js
const moduleSums = Object.keys(dataMap).map(module => {
return {
module: module,
sum: Object.values(dataMap[module]).reduce((a, b) => a + b, 0)
};
});
// Sort modules by the sum of lines
moduleSums.sort((a, b) => b.sum - a.sum);
const colors = [
'141, 211, 199', // Pastel Teal
'255, 255, 179', // Pastel Yellow
'190, 186, 218', // Pastel Lavender
'251, 128, 114', // Pastel Red
'128, 177, 211', // Pastel Blue
'253, 180, 98', // Pastel Orange
'179, 222, 105', // Pastel Green
'252, 205, 229', // Pastel Pink
'217, 217, 217', // Light Gray
'188, 128, 189', // Pastel Purple
'204, 235, 197', // Pastel Mint
'255, 237, 111', // Light Pastel Yellow
'174, 199, 232', // Light Blue
'255, 187, 120', // Light Orange
'152, 223, 138', // Light Green
'255, 152, 150', // Light Coral
'214, 39, 40', // Muted Red
'31, 119, 180', // Muted Blue
'255, 127, 14', // Muted Orange
'44, 160, 44', // Muted Green
'148, 103, 189', // Muted Purple
'140, 86, 75', // Muted Brown
'227, 119, 194', // Muted Pink
'127, 127, 127', // Medium Gray
'188, 189, 34', // Muted Yellow
'23, 190, 207', // Muted Cyan
'174, 199, 232', // Light Sky Blue
'255, 187, 120', // Light Apricot
'152, 223, 138', // Light Pastel Green
'255, 152, 150', // Light Salmon
'197, 176, 213', // Light Lilac
'196, 156, 148' // Light Beige
];
const datasets = moduleSums.map((item, index) => {
const color = colors[index % colors.length];
const backgroundColor = `rgba(${color}, 1)`;
const borderColor = `rgba(${color}, 1)`;
return {
label: item.module,
data: versions.map(version => dataMap[item.module][version] || 0),
fill: true,
backgroundColor,
borderColor,
borderWidth: 0,
pointRadius: 0,
pointHoverRadius: 10,
cubicInterpolationMode: "monotone",
stepped: false
};
});
// Register the zoom plugin
Chart.register(ChartZoom);
Chart.defaults.scales.linear.min = 0;
// Configure and render the chart
const ctx = document.getElementById('moduleChart').getContext('2d');
new Chart(ctx, {
type: 'line',
data: {
labels: versions,
datasets: datasets
},
options: {
maintainAspectRatio: false,
scales: {
x: {
ticks: {
font: {
size: 18
}
}
},
y: {
stacked: true,
ticks: {
font: {
size: 18
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
enabled: true,
mode: 'nearest',
intersect: false,
callbacks: {
label: function (context) {
const label = context.dataset.label || '';
const value = new Intl.NumberFormat().format(context.raw);
return `${label}: ${value} files`;
}
},
filter: function (tooltip) {
return tooltip.raw > 0;
}
},
zoom: {
zoom: {
wheel: {
enabled: true,
speed: 0.05,
},
pinch: {
enabled: true
},
mode: 'xy',
},
pan: {
enabled: true,
mode: 'xy',
},
},
},
response: true,
}
});
}
// Call the fetchData function to load and visualize the data
fetchData();
</script>
</head>
<body>
<div id="header">
<h1>Gradle legacy module sizes over time</h1>
<p>
<a href="report.tsv">Report in TSV format</a> (generated {{CURRENT_DATE}})
</p>
</div>
<div id="chart-container">
<canvas id="moduleChart"></canvas>
</div>
<a href="https://github.com/ghale/gradle-code-evolution" target="_blank" id="fork-corner"
class="fork-corner fc-pos-tr fc-animate fc-theme-github fc-size-small"></a>
</body>
</html>