diff options
Diffstat (limited to 'scripts/lib/build_perf/html/measurement_chart.html')
-rw-r--r-- | scripts/lib/build_perf/html/measurement_chart.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html new file mode 100644 index 0000000000..26fe1453c0 --- /dev/null +++ b/scripts/lib/build_perf/html/measurement_chart.html | |||
@@ -0,0 +1,50 @@ | |||
1 | <script type="text/javascript"> | ||
2 | google.charts.setOnLoadCallback(drawChart_{{ chart_elem_id }}); | ||
3 | function drawChart_{{ chart_elem_id }}() { | ||
4 | var data = new google.visualization.DataTable(); | ||
5 | |||
6 | // Chart options | ||
7 | var options = { | ||
8 | theme : 'material', | ||
9 | legend: 'none', | ||
10 | hAxis: { format: '', title: 'Commit number', | ||
11 | minValue: {{ chart_opts.haxis.min }}, | ||
12 | maxValue: {{ chart_opts.haxis.max }} }, | ||
13 | {% if measurement.type == 'time' %} | ||
14 | vAxis: { format: 'h:mm:ss' }, | ||
15 | {% else %} | ||
16 | vAxis: { format: '' }, | ||
17 | {% endif %} | ||
18 | pointSize: 5, | ||
19 | chartArea: { left: 80, right: 15 }, | ||
20 | }; | ||
21 | |||
22 | // Define data columns | ||
23 | data.addColumn('number', 'Commit'); | ||
24 | data.addColumn('{{ measurement.value_type.gv_data_type }}', | ||
25 | '{{ measurement.value_type.quantity }}'); | ||
26 | // Add data rows | ||
27 | data.addRows([ | ||
28 | {% for sample in measurement.samples %} | ||
29 | [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}], | ||
30 | {% endfor %} | ||
31 | ]); | ||
32 | |||
33 | // Finally, draw the chart | ||
34 | chart_div = document.getElementById('{{ chart_elem_id }}'); | ||
35 | var chart = new google.visualization.LineChart(chart_div); | ||
36 | google.visualization.events.addListener(chart, 'ready', function () { | ||
37 | //chart_div = document.getElementById('{{ chart_elem_id }}'); | ||
38 | //chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">'; | ||
39 | png_div = document.getElementById('{{ chart_elem_id }}_png'); | ||
40 | png_div.outerHTML = '<a id="{{ chart_elem_id }}_png" href="' + chart.getImageURI() + '">PNG</a>'; | ||
41 | console.log("CHART READY: {{ chart_elem_id }}"); | ||
42 | {% if last_chart == true %} | ||
43 | console.log("ALL CHARTS READY"); | ||
44 | {% endif %} | ||
45 | //console.log(chart_div.innerHTML); | ||
46 | }); | ||
47 | chart.draw(data, options); | ||
48 | } | ||
49 | </script> | ||
50 | |||