- 요구사항 및 이슈 상태 누적 현황
+ 요구사항 이슈 상태 누적 현황
{
+ 대시보드_도넛차트("donut-chart");
+ })
.catch((error) => {
console.error('Error occurred:', error);
});
@@ -320,6 +323,100 @@
$("#no_assigned_linkedIssue_subtask_count").text(" - "); //생성한 연결이슈(미할당)
}
+ function 대시보드_변수_초기화() {
+ // 선언 예정
+ }
+ function 대시보드_도넛차트(targetElementId) {
+ if(!targetElementId) {
+ donutChartNoData();
+ return false;
+ }
+ let $targetId = "#"+targetElementId; // "#donut-chart"
+
+ let reqStateData = getReqStateData();
+ let reqStateKey = ["open", "in-progress", "resolved", "closed"];
+
+ console.log("[ dashboardApi :: 대시보드_도넛차트 ] total => " + reqStateData["total"]);
+
+ function donutChartNoData() {
+ c3.generate({
+ bindto: $targetId,
+ data: {
+ columns: [],
+ type: 'donut',
+ },
+ donut: {
+ title: "Total : 0"
+ },
+ });
+ }
+
+ if(reqStateData.total === 0) {
+ donutChartNoData();
+ return;
+ }
+
+ const columnsData = [];
+
+ reqStateKey.forEach( key => {
+ if(reqStateData.hasOwnProperty(key)) {
+ columnsData.push([key,reqStateData[key]]);
+ }
+ });
+
+ let totalDocCount = reqStateData["total"];
+
+ const chart = c3.generate({
+ bindto: '#donut-chart',
+ data: {
+ columns: columnsData,
+ type: 'donut',
+ },
+ donut: {
+ title: "Total : " + totalDocCount
+ },
+ color: {
+ pattern: dashboardColor.reqStateColor
+ },
+ tooltip: {
+ format: {
+ value: function (value, ratio, id, index) {
+ return value;
+ }
+ },
+ },
+ });
+
+ $(document).on('click', '#donut-chart .c3-legend-item', function () {
+ const id = $(this).text();
+ let isHidden = false;
+
+ if($(this).hasClass('c3-legend-item-hidden')) {
+ isHidden = false;
+ $(this).removeClass('c3-legend-item-hidden');
+ } else {
+ isHidden = true;
+ $(this).addClass('c3-legend-item-hidden');
+ }
+ let docCount = 0;
+
+ for (const key of reqStateKey) {
+ if (key === id) {
+ docCount = reqStateData[key];
+ break;
+ }
+ }
+ if (docCount) {
+ if (isHidden) {
+ totalDocCount -= docCount;
+ } else {
+ totalDocCount += docCount;
+ }
+ }
+ $($targetId +'.c3-chart-arcs-title').text("Total : " + totalDocCount);
+ });
+ }
+
return {
대시보드_톱메뉴_세팅, 대시보드_톱메뉴_초기화,
pullTotalApi,
Index: arms/js/dashboard/chart/colorPalette.js
===================================================================
diff -u -rfceb15f8f3bd9605d3def934528d7c4af1b18c45 -r8b7f73456cca89b6dd4ba0f4787e5a437cffe1ef
--- arms/js/dashboard/chart/colorPalette.js (.../colorPalette.js) (revision fceb15f8f3bd9605d3def934528d7c4af1b18c45)
+++ arms/js/dashboard/chart/colorPalette.js (.../colorPalette.js) (revision 8b7f73456cca89b6dd4ba0f4787e5a437cffe1ef)
@@ -575,6 +575,12 @@
"rgba(255,255,51,0.71)",
"rgba(151,78,163,0.73)",
"rgba(166,86,40,0.7)"
+ ],
+ reqStateColor: [
+ "rgba(219, 42, 52, 0.8)",
+ "rgba(228, 148, 0, 0.8)",
+ "rgba(45, 133, 21, 0.8)",
+ "rgba(36, 119, 255,0.8)"
]
}
};
\ No newline at end of file