Index: arms/js/analysis/cost/circularPackingChart.js =================================================================== diff -u -rfed30a6b92ea8a3909b74fbe1daadf0d9dda0863 -r91b0e49f36fad6ecf5bc8c233619e196a962dde0 --- arms/js/analysis/cost/circularPackingChart.js (.../circularPackingChart.js) (revision fed30a6b92ea8a3909b74fbe1daadf0d9dda0863) +++ arms/js/analysis/cost/circularPackingChart.js (.../circularPackingChart.js) (revision 91b0e49f36fad6ecf5bc8c233619e196a962dde0) @@ -8,7 +8,15 @@ let statusDataArr = []; var colorPalette = [ //e chart 컬러 팔레트 - '#546570', '#c4ccd3' , '#749f83','#91c7ae' + /*"rgba(55,125,184,0.62)", + "rgba(255,255,51,0.71)", + "rgba(151,78,163,0.73)", + "rgba(77,175,74,0.65)", + "rgba(255,127,0,0.7)", + "rgba(55,125,184,0.62)", + "rgba(166,86,40,0.7)", + "rgba(227,26,27,0.66)"*/ + '#546570', '#c4ccd3' , '#749f83','#91c7ae' ]; if(rawData) { @@ -18,8 +26,6 @@ function run(rawData) { const dataWrap = prepareData(rawData); - console.log(dataWrap); - initChart(dataWrap.seriesData, dataWrap.maxDepth); } @@ -31,56 +37,53 @@ function convert(source, basePath, depth) { maxDepth = Math.max(maxDepth, depth); let value = 0; - let version, req_name; // version과 req_name을 선언 + let version_id, version_name,req_id, req_name; for (let key in source) { let path = `${basePath}.${key}`; + let newDepth = depth; + if (Array.isArray(source[key])) { let subValue = 0; + version_id = source[key][0].c_pds_version_link; + version_name = source[key][0].c_pds_version_name; + req_id = source[key][0].c_req_link; + req_name = source[key][0].c_req_name; source[key].forEach(item => { - for(let subkey in item) { - let subPath = `${path}.${subkey}`; - let subsubValue = 0; - item[subkey].forEach(subItem => { - version = subItem.version; // version 업데이트 - req_name = subItem.req_name; // req_name 업데이트 - let itemPath = `${subPath}.${subItem.project}`; - subsubValue += subItem.cost; - seriesData.push({ - id: itemPath, - value: subItem.cost, - depth: depth + 3, - index: index++, - version: version, - req_name: req_name - }); // 3 depth - }); - if (subsubValue !== 0) { - subValue += subsubValue; - seriesData.push({ - id: subPath, - value: subsubValue, - depth: depth + 2, - index: index++, - version: version, - req_name: req_name - }); // 2 depth - } - } + let project = item.c_issue_key; + let cost = 300; // 임시 설정 + subValue += cost; + seriesData.push({ + id: `${path}.${project}`, + value: cost, + depth: newDepth +2 , + index: index++, + version_id: item.c_pds_version_link, + version_name: item.c_pds_version_name, + req_id : item.c_req_link, + req_name: item.c_req_name + }); }); + if (subValue !== 0) { value += subValue; seriesData.push({ id: path, value: subValue, - depth: depth + 1, + depth: newDepth+1, index: index++, - version: version, + version_id: version_id, + version_name: version_name, + req_id : req_id, req_name: req_name }); } } else if (typeof source[key] === 'object' && source[key] !== null) { - value += convert(source[key], path, depth + 1); + version_id = source[key].c_pds_version_link; + version_name = source[key].c_pds_version_name; + req_id = source[key].c_req_link; + req_name = source[key].c_req_name; + value += convert(source[key], path, newDepth+1); } } @@ -90,8 +93,10 @@ value: value, depth: depth, index: index++, - version: version, - req_name: req_name + version_id:version_id, + version_name:version_name, + req_id:req_id, + req_name:req_name }); } @@ -241,31 +246,31 @@ progressive: 0, coordinateSystem: 'none', itemStyle: { - color: function(params) { - if (params.data.value) { - return colorPalette[params.value.depth]; - } else { - return "rgba(55,125,184,0.62)"; - } + color: function(params) { + var colorIndex; + if (params.data.value) { + return colorPalette[params.value.depth]; + } else {// 기본 색상 사용 + return "rgba(55,125,184,0.62)"; // 파란색 } + return colorPalette[colorIndex]; + } }, tooltip: { formatter: function(params) { // params.value에는 원본 값이 들어있을 것입니다. 여기에 단위를 붙여 반환하면 됩니다. let id = params.data.id; let parts = id.split('.'); - - if(params.data.value) { - if(params.data.depth === 0){ - return "제품(서비스) 정보
● 제품(서비스) :"+ parts[0] +"
● 비용 :"+params.data.value ; - }else if(params.data.depth === 1){ - return "버전 정보
● 버전 :"+ params.data.version +"
● 비용 :"+params.data.value ; - }else if(params.data.depth === 2){ - return "요구사항 정보
● 버전 :"+ params.data.version +"
● 요구사항 :"+ params.data.req_name +"
● 비용 :"+params.data.value ; - }else if(params.data.depth === 3){ - return "요구사항 키 정보
● 버전 :"+ params.data.version +"
● 요구사항 :"+ params.data.req_name +"
● 요구사항 키 :"+ parts[3] +"
● 비용 :"+params.data.value ; - } - } else { + if(params.data.depth === 0){ + return "제품(서비스) 정보
● 제품(서비스) :"+ parts[0] +"
● 비용 :"+params.data.value ; + }else if(params.data.depth === 1){ + return "버전 정보
● 버전 :"+ params.data.version_name +"
● 비용 :"+params.data.value ; + }else if(params.data.depth === 2){ + return "요구사항 정보
● 버전 :"+ params.data.version_name +"
● 요구사항 :"+ params.data.req_name +"
● 비용 :"+params.data.value ; + }else if(params.data.depth === 3){ + return "요구사항 키 정보
● 버전 :"+ params.data.version_name +"
● 요구사항 :"+ params.data.req_name +"
● 요구사항 키 :"+ parts[3] ; + } + else { return `${params.data.id}`; } } @@ -305,7 +310,10 @@ option && myChart.setOption(option, true); myChart.on('click', { seriesIndex: 0 }, function (params) { - drillDown(params.data.id); + if(params.data.depth != 3){ + drillDown(params.data.id); + } + }); function drillDown(targetNodeId) { @@ -331,9 +339,6 @@ }); } - - - function replaceNaN(value) { if (isNaN(value)) { return " - "; Index: arms/js/analysisCost.js =================================================================== diff -u -r41f8b0fecb1ae5d38d8e97626e2c215fbd645477 -r91b0e49f36fad6ecf5bc8c233619e196a962dde0 --- arms/js/analysisCost.js (.../analysisCost.js) (revision 41f8b0fecb1ae5d38d8e97626e2c215fbd645477) +++ arms/js/analysisCost.js (.../analysisCost.js) (revision 91b0e49f36fad6ecf5bc8c233619e196a962dde0) @@ -1076,7 +1076,7 @@ function getReqCostRatio(pdServiceLink, pdServiceVersionLinks) { const url = new UrlBuilder() - .setBaseUrl("/auth-user/api/arms/analysis/cost/req-activated-issue") + .setBaseUrl("/auth-user/api/arms/analysis/cost/req-linked-issue") .addQueryParam("pdServiceLink", pdServiceLink) .addQueryParam("pdServiceVersionLinks", pdServiceVersionLinks) .build(); @@ -1088,41 +1088,19 @@ dataType: "json", progress: true, statusCode: { - 200: function (result) { + 200: function (data) { console.log("[ analysisCost :: getReqCostRatio ] :: = "); - console.log(result); - let 변환된_데이터 = {}; - Object.keys(result.버전별_그룹).forEach((버전) => { - let 요구사항별_그룹 = result.버전별_그룹[버전].요구사항별_그룹; - let 변환된_요구사항들 = []; - Object.keys(요구사항별_그룹).forEach((요구사항) => { - let 변환된_요구사항 = {}; - 변환된_요구사항[요구사항] = 요구사항별_그룹[요구사항].map((데이터) => { - let 치환된_버전 = 데이터.c_pds_version_name; - let 치환된_요구사항 = 데이터.c_req_name; - return { - project: 데이터.c_issue_key, - cost: 300, // 임시데이터 - version: 데이터.c_pds_version_name, - req_name : 데이터.c_req_name - }; - }); - 변환된_요구사항들.push(변환된_요구사항); - }); + let 필요_데이터 = data.버전별_요구사항별_연결된지_지라이슈; + console.log(필요_데이터); // 결과 출력 - 변환된_데이터[버전] = 변환된_요구사항들; - }); - - console.log(변환된_데이터); - let pdServiceName; pdServiceListData.forEach(elements => { if (elements["pdServiceId"] === +pdServiceLink) { pdServiceName = elements["pdServiceName"]; } }); - drawCircularPacking("circularPacking",pdServiceName,변환된_데이터); + drawCircularPacking("circularPacking",pdServiceName,필요_데이터); } } });