From f0241e6dd35f16a6bcf9992f66aa680bbd8c7782 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 11 Sep 2021 13:40:38 +0000 Subject: [PATCH] changed the LOC graph to the pie chart --- codepot/src/codepot/views/code_file.php | 65 ++++++++++++------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index b12581ba..5398c635 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -24,7 +24,7 @@ if (in_array ($fileext, array ('png', 'jpg', 'jpeg', 'gif', 'tif', 'bmp', 'ico'))) { - $img = @imagecreatefromstring($file['content']); + $img = @imagecreatefromstring ($file['content']); if ($img !== FALSE) { @imagedestroy ($img); @@ -104,10 +104,7 @@ - - - - + @@ -555,8 +552,7 @@ var RevGraphApp = (function () return App; })(); - - + var LocGraphApp = (function () { function App (top_container, graph_container, graph_msgdiv, graph_canvas, graph_button, graph_spin, graph_url, graph_title) @@ -583,37 +579,34 @@ var LocGraphApp = (function () this.clearMessage (); - var pd = []; // files, blank, comment, code // files is always 1. - for (var i = 1; i < data.SUM.length ; i++) - { - pd[i - 1] = [ i - 1, data.SUM[i] ]; - } this.plot_dataset = [ - { label: 'LOC', data: pd } - ] - - var ticks = [ - [0, "lang->line('Blank')?>(" + data.SUM[1] + ")"], - [1, "lang->line('Comment')?>(" + data.SUM[2] + "])"], - [2, "lang->line('Code')?>(" + data.SUM[3] + ")"] + { label: "lang->line('Blank')?>", data: data.SUM[1] }, + { label: "lang->line('Comment')?>", data: data.SUM[2] }, + { label: "lang->line('Code')?>", data: data.SUM[3] } ]; - this.plot_options = { + this.plot_options = + { series: { - bars: { show: true } + shadowSize: 0, + pie: { + show: true, + innerRadius: 0.1, + label: { + show: true, + radius: 0.9, + formatter: function labelFormatter(label, series) + { + return "
" + label + "
" + series.data[0][1] + "(" + Math.round(series.percent) + "%)
"; + }, + backgraound: { opacity: 0.8 } + } + } }, - bars: { - align: "center", - barWidth: 0.8 - }, - xaxis: { - axisLabel: "", - axisLabelUseCanvas: true, - ticks: ticks - }, - yaxis: { + legend: { + show: false } }; } @@ -895,9 +888,6 @@ $this->load->view ( print ' '; print anchor("code/edit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_file_edit_button"'); } - /*print anchor ("#", "LOC", "id=code_file_loc_button");*/ - print ''; - print 'LOC'; } ?> @@ -935,7 +925,12 @@ $this->load->view ( print anchor ('#', $history_anchor_text, 'id="code_file_history_button"'); //print anchor ('', $download_anchor_text, 'id="code_file_download_button"'); print anchor ("code/fetch/{$project->id}/${hex_headpath}{$revreq}", $download_anchor_text, 'id="code_file_download_button"'); - if (!$is_special_stream) print anchor ('#', $this->lang->line('Enstyle'), 'id="code_file_style_button"'); + if (!$is_special_stream) + { + print anchor ('#', $this->lang->line('Enstyle'), 'id="code_file_style_button"'); + print ''; + print 'LOC'; + } print ''; print '';