Index: arms/js/analysisTime.js =================================================================== diff -u -r0d8e55973b5540053b203758cd787238151f9961 -r9acb2f9c893499115d9a779930bc7a4e3e0d2295 --- arms/js/analysisTime.js (.../analysisTime.js) (revision 0d8e55973b5540053b203758cd787238151f9961) +++ arms/js/analysisTime.js (.../analysisTime.js) (revision 9acb2f9c893499115d9a779930bc7a4e3e0d2295) @@ -283,7 +283,6 @@ getRelationJiraIssueByPdServiceAndVersions($("#selected_pdService").val(), selectedVersionId); - heatMapReady(); if (checked) { @@ -326,6 +325,8 @@ }); networkChart(data); + calendarHeatMap(data); + globalJiraIssue = data; } } @@ -2143,28 +2144,6 @@ networkGraph.createGraph(); } -if (!String.prototype.formatString) { - String.prototype.formatString = function () { - var args = arguments; - return this.replace(/{(\d+)}/g, function (match, number) { - return typeof args[number] !== 'undefined' - ? args[number] - : match - ; - }); - }; -} -// If the number less than 10, add a zero before it -var prettyNumber = function (number) { - return number < 10 ? '0' + number.toString() : number = number.toString(); -}; - -var getDisplayDate = function (date_obj) { - var pretty_month = prettyNumber(date_obj.getMonth() + 1); - var pretty_date = prettyNumber(date_obj.getDate()); - return "{0}-{1}-{2}".formatString(date_obj.getFullYear(), pretty_month, pretty_date); -}; - function formatDate(date) { var year = date.getFullYear(); var month = (1 + date.getMonth()).toString().padStart(2, '0'); @@ -2173,80 +2152,81 @@ return year + '-' + month + '-' + day; } -// Generate random number between min and max -function randomInt(min, max) { - return Math.floor(Math.random() * (max - min + 1) + min); -} +function calendarHeatMap(jiraIssueData) { -function getRandoHeatMapData(min, max, items) { - var return_object = {}; + $("#heatmap-bar").show(); - var entries = randomInt(min, max); - console.log("entires : "+ entries); + $('#calendar_yearview_blocks_chart_1 svg').remove(); + $('#calendar_yearview_blocks_chart_2 svg').remove(); - for (var i = 0; i < entries; i++) { - var day = new Date(); + var return_object = {}; + var uniqueItems = []; - var previous_date = randomInt(0, 365); - day.setDate(day.getDate() - previous_date); + jiraIssueData.forEach(item => { + var display_date = formatDate(new Date(item.updated)); - var display_date = getDisplayDate(day); - return_object[display_date] = {}; - return_object[display_date].items = []; - var random_elements = randomInt(1,3); - for (var j=0; j < random_elements; j++) { - var random_item = items[randomInt(0,items.length-1)]; - if (!return_object[display_date].items.includes(random_item)) { - return_object[display_date].items.push(random_item); - } + if (return_object[display_date] === undefined) { + return_object[display_date] = {}; + return_object[display_date].items = []; } - } - console.log(return_object); - return JSON.stringify(return_object); + return_object[display_date].items.push(item.summary); + uniqueItems.push(item.summary); + }); -} + console.log(JSON.stringify(return_object)); -function heatMapReady() { + var heatMapData = JSON.stringify(return_object); + var colors = { + 'default': '#eeeeee' // 'default' 항목에는 고정된 색상 할당 + }; - $('#calendar_yearview_blocks_chart_1').removeData(); - $('#calendar_yearview_blocks_chart_2').removeData(); + uniqueItems.forEach((item, index) => { + if (item !== 'default') { + var randomColor = getRandomColor(); // 랜덤한 색상 생성 + colors[item] = randomColor; + } + }); - var return_object = {}; + function getRandomColor() { + var letters = '0123456789ABCDEF'; + var color = '#'; + for (var i = 0; i < 6; i++) { + color += letters[Math.floor(Math.random() * 16)]; + } + return color; + } + console.log(heatMapData); + console.log(colors); - var heatMapData = getRandoHeatMapData(10, 40, ["banana", "apple", "orange", "pear"]); - $('#calendar_yearview_blocks_chart_1').calendar_yearview_blocks({ - //data: '{"2020-08-01": {"items": ["banana", "apple"]}, "2020-05-05": {"items": ["apple"]}, "2020-05-01": {"items": ["banana"]}, "2020-05-03": {"items": ["banana", "apple", "orange"]}, "2020-05-22": {"items": ["banana", "apple", "orange", "pear"]}}', data: heatMapData, start_monday: true, always_show_tooltip: true, - month_names: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', 'jul', 'aug', 'sept', 'okt', 'nov', 'dec'], + month_names: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'], day_names: ['mo', 'wed', 'fri', 'sun'], - colors: { - 'default': '#eeeeee', // Default color - 'apple': 'green', - 'banana': 'yellow', - 'orange': 'orange', - 'pear': 'lightgreen' - } + colors: colors }); - $('#calendar_yearview_blocks_chart_2').calendar_yearview_blocks({ - data: getRandoHeatMapData(20, 80, ["rain", "sunshine", "fog", "thunder", "hail"]), - start_monday: true, - always_show_tooltip: true, - month_names: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], - day_names: ['mo', 'wed', 'fri', 'sun'], - colors: { - 'default': '#eeeeee', // Default color - 'rain': 'lightblue', - 'sunshine': 'lightyellow', - 'fog': 'gray', - 'thunder': 'brown', - 'hail': 'white' - } - }); + /*var heatMapBarHtml = `
`; + $('#calendar_yearview_blocks_chart_1').append(heatMapBarHtml);*/ + + // $('#calendar_yearview_blocks_chart_2').calendar_yearview_blocks({ + // data: getRandoHeatMapData(20, 80, ["rain", "sunshine", "fog", "thunder", "hail"]), + // start_monday: true, + // always_show_tooltip: true, + // month_names: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], + // day_names: ['mo', 'wed', 'fri', 'sun'], + // colors: { + // 'default': '#eeeeee', // Default color + // 'rain': 'lightblue', + // 'sunshine': 'lightyellow', + // 'fog': 'gray', + // 'thunder': 'brown', + // 'hail': 'white' + // } + // }); + } /* Index: reference/jquery-plugins/github-calendar-heatmap/css/calendar_yearview_blocks.css =================================================================== diff -u -r62658c9b5d837daf1bf73b292b53d5921fb0ea27 -r9acb2f9c893499115d9a779930bc7a4e3e0d2295 --- reference/jquery-plugins/github-calendar-heatmap/css/calendar_yearview_blocks.css (.../calendar_yearview_blocks.css) (revision 62658c9b5d837daf1bf73b292b53d5921fb0ea27) +++ reference/jquery-plugins/github-calendar-heatmap/css/calendar_yearview_blocks.css (.../calendar_yearview_blocks.css) (revision 9acb2f9c893499115d9a779930bc7a4e3e0d2295) @@ -17,11 +17,14 @@ left: 50%; height: 5px; width: 5px; - bottom: -10px; margin: 0 0 0 -5px; content: " "; border: 5px solid transparent; - border-top-color: rgba(0,0,0,0.8); + /*border-top-color: rgba(0,0,0,0.8); + bottom: -10px;*/ + border-bottom-color: rgba(0,0,0,0.8); /* 수정된 부분: border-bottom-color 속성으로 아래쪽 선 색상 지정 */ + top: -10px; /* 수정된 부분: top 속성으로 위치 조정 */ + } .wday, .month { Index: reference/jquery-plugins/github-calendar-heatmap/js/calendar_yearview_blocks.js =================================================================== diff -u -rca153e19ba6310ea7c85bf644481cff6402f0efc -r9acb2f9c893499115d9a779930bc7a4e3e0d2295 --- reference/jquery-plugins/github-calendar-heatmap/js/calendar_yearview_blocks.js (.../calendar_yearview_blocks.js) (revision ca153e19ba6310ea7c85bf644481cff6402f0efc) +++ reference/jquery-plugins/github-calendar-heatmap/js/calendar_yearview_blocks.js (.../calendar_yearview_blocks.js) (revision 9acb2f9c893499115d9a779930bc7a4e3e0d2295) @@ -192,7 +192,6 @@ // Handle mouseEnter event when entering into rect element var mouseEnter = function (evt) { - var target_offset = $(evt.target).offset(); var items = $(evt.target).attr('data-items'); var legend = $(evt.target).attr('data-legend'); @@ -205,12 +204,12 @@ var svg_tip = $('.svg-tip').show(); svg_tip.html(text); var svg_width = Math.round(svg_tip.width() / 2 + 5); - var svg_height = svg_tip.height() * 2 + 10; - + /*var svg_height = svg_tip.height() * 2 + 10; svg_tip.css({top: target_offset.top - svg_height - 5}); - svg_tip.css({left: target_offset.left - svg_width}); + svg_tip.css({left: target_offset.left - svg_width});*/ + var top = target_offset.top + $(evt.target).outerHeight() + 20; + svg_tip.css({top: top, left: target_offset.left - svg_width}); } - }; // Append tooltip to display when the mouse enters the rect element