|
2 | 2 | // Get raw data
|
3 | 3 | const rawData = [
|
4 | 4 | {% for sample in measurement.samples %}
|
5 |
| - [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}], |
| 5 | + [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'], |
6 | 6 | {% endfor %}
|
7 | 7 | ];
|
8 | 8 |
|
|
30 | 30 | const option = {
|
31 | 31 | tooltip: {
|
32 | 32 | trigger: 'axis',
|
33 |
| - valueFormatter: (value) => { |
34 |
| - const commitNumber = rawData.filter(([commit, dataValue, time]) => updateValue(dataValue) === value) |
| 33 | + enterable: true, |
| 34 | + position: function (point, params, dom, rect, size) { |
| 35 | + return [point[0]-150, '10%']; |
| 36 | + }, |
| 37 | + formatter: function (param) { |
| 38 | + const value = param[0].value[1] |
| 39 | + const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value) |
| 40 | + // Add commit hash to the tooltip as a link |
| 41 | + const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}` |
35 | 42 | if ('{{ measurement.value_type.quantity }}' == 'time') {
|
36 | 43 | const hours = Math.floor(value/60)
|
37 | 44 | const minutes = Math.floor(value % 60)
|
38 | 45 | const seconds = Math.floor((value * 60) % 60)
|
39 |
| - return [ |
40 |
| - hours + ':' + minutes + ':' + seconds + ', ' + |
41 |
| - 'commit number: ' + commitNumber[0][0] |
42 |
| - ] |
| 46 | + return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>` |
43 | 47 | }
|
44 |
| - return [ |
45 |
| - value.toFixed(2) + ' MB' + ', ' + |
46 |
| - 'commit number: ' + commitNumber[0][0] |
47 |
| - ] |
48 |
| - }, |
49 |
| - |
| 48 | + return `<strong>Size:</strong> ${value.toFixed(2)} MB, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>` |
| 49 | + ;} |
50 | 50 | },
|
51 | 51 | xAxis: {
|
52 | 52 | type: 'time',
|
|
0 commit comments