@dssp/dkpi 1.0.0-alpha.57 → 1.0.0-alpha.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/project-image.png +0 -0
- package/dist-client/components/kpi-boxplot-chart.d.ts +1 -1
- package/dist-client/components/kpi-boxplot-chart.js +29 -65
- package/dist-client/components/kpi-boxplot-chart.js.map +1 -1
- package/dist-client/components/kpi-lookup-chart.d.ts +29 -0
- package/dist-client/components/kpi-lookup-chart.js +434 -0
- package/dist-client/components/kpi-lookup-chart.js.map +1 -0
- package/dist-client/components/kpi-mini-trend-chart.d.ts +14 -0
- package/dist-client/components/kpi-mini-trend-chart.js +148 -0
- package/dist-client/components/kpi-mini-trend-chart.js.map +1 -0
- package/dist-client/components/kpi-radar-chart.d.ts +1 -1
- package/dist-client/components/kpi-radar-chart.js +73 -55
- package/dist-client/components/kpi-radar-chart.js.map +1 -1
- package/dist-client/components/kpi-trend-chart.d.ts +25 -0
- package/dist-client/components/kpi-trend-chart.js +220 -0
- package/dist-client/components/kpi-trend-chart.js.map +1 -0
- package/dist-client/google-map/common-google-map.d.ts +35 -0
- package/dist-client/google-map/common-google-map.js +343 -0
- package/dist-client/google-map/common-google-map.js.map +1 -0
- package/dist-client/google-map/google-map-loader.d.ts +6 -0
- package/dist-client/google-map/google-map-loader.js +23 -0
- package/dist-client/google-map/google-map-loader.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +17 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +280 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +21 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +389 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +25 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +469 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +8 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +78 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +34 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +642 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +38 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +501 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +26 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +439 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +18 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +131 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +36 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +572 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +59 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +1027 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +12 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +82 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +11 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +65 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +13 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +115 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +15 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +147 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +7 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +86 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
- package/dist-client/pages/sv-project-detail.d.ts +10 -0
- package/dist-client/pages/sv-project-detail.js +381 -3
- package/dist-client/pages/sv-project-detail.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +3 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/menu-tools.d.ts +10 -1
- package/dist-client/viewparts/menu-tools.js +36 -7
- package/dist-client/viewparts/menu-tools.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +54 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +443 -18
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-stat/kpi-stat-query.d.ts +6 -4
- package/dist-server/service/kpi-stat/kpi-stat-query.js +232 -22
- package/dist-server/service/kpi-stat/kpi-stat-query.js.map +1 -1
- package/dist-server/service/kpi-stat/kpi-stat-types.d.ts +6 -0
- package/dist-server/service/kpi-stat/kpi-stat-types.js +23 -1
- package/dist-server/service/kpi-stat/kpi-stat-types.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-query.d.ts +1 -0
- package/dist-server/service/kpi-value/kpi-value-query.js +22 -0
- package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/schema.graphql +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-mini-trend-chart.js","sourceRoot":"","sources":["../../client/components/kpi-mini-trend-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU;IAA5C;;QACsB,SAAI,GAAa,EAAE,CAAA;QAClB,UAAK,GAAW,EAAE,CAAA;QAClB,WAAM,GAAW,EAAE,CAAA;QACnB,cAAS,GAAW,SAAS,CAAA;QAC7B,gBAAW,GAAW,GAAG,CAAA;QACxB,eAAU,GAAY,IAAI,CAAA;QAC3B,gBAAW,GAAW,GAAG,CAAA;IAgHvD,CAAC;IAjFC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;kBAIG,IAAI,CAAC,KAAK;mBACT,IAAI,CAAC,MAAM;yBACL,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;;;;KAI7C,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;Y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CAAC;qBAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;qBACxC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;qBACnD,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC;qBAC3B,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC;qBACzB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;;AA7GM,0BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BlB,AA3BY,CA2BZ;AAnC0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAoB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAA8B;AAC7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAA0B;AACxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;uDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAA0B;AAP1C,mBAAmB;IAD/B,aAAa,CAAC,yBAAyB,CAAC;GAC5B,mBAAmB,CAuH/B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('sv-kpi-mini-trend-chart')\nexport class SvKpiMiniTrendChart extends LitElement {\n @property({ type: Array }) data: number[] = []\n @property({ type: Number }) width: number = 60\n @property({ type: Number }) height: number = 30\n @property({ type: String }) lineColor: string = '#2196f3'\n @property({ type: Number }) strokeWidth: number = 1.5\n @property({ type: Boolean }) showPoints: boolean = true\n @property({ type: Number }) pointRadius: number = 1.5\n\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .mini-chart {\n width: 100%;\n height: 100%;\n background: #f8f9fa;\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .trend-line {\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n\n .data-point {\n fill: white;\n stroke-width: 1;\n }\n `\n\n render() {\n return html`\n <div class=\"mini-chart\">\n <svg\n id=\"mini-trend\"\n width=${this.width}\n height=${this.height}\n viewBox=\"0 0 ${this.width} ${this.height}\"\n preserveAspectRatio=\"xMidYMid meet\"\n ></svg>\n </div>\n `\n }\n\n updated() {\n this.drawMiniTrend()\n }\n\n drawMiniTrend() {\n if (!this.data || this.data.length === 0) return\n\n const svg = d3.select(this.renderRoot.querySelector('#mini-trend'))\n svg.selectAll('*').remove()\n\n const margin = { top: 2, right: 2, bottom: 2, left: 2 }\n const width = this.width - margin.left - margin.right\n const height = this.height - margin.top - margin.bottom\n\n // 스케일 설정\n const xScale = d3\n .scaleLinear()\n .domain([0, this.data.length - 1])\n .range([0, width])\n\n const yScale = d3\n .scaleLinear()\n .domain([0, d3.max(this.data) || 100])\n .range([height, 0])\n\n // SVG 설정\n svg.attr('width', this.width).attr('height', this.height)\n const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`)\n\n // 라인 생성기\n const line = d3\n .line<number>()\n .x((d, i) => xScale(i))\n .y(d => yScale(d))\n .curve(d3.curveMonotoneX)\n\n // 트렌드 라인 그리기\n g.append('path')\n .datum(this.data)\n .attr('class', 'trend-line')\n .attr('d', line as any)\n .attr('stroke', this.lineColor)\n .attr('stroke-width', this.strokeWidth)\n\n // 데이터 포인트 그리기 (첫 번째와 마지막 포인트만)\n if (this.showPoints && this.data.length > 0) {\n // 첫 번째 포인트\n g.append('circle')\n .attr('class', 'data-point')\n .attr('cx', xScale(0))\n .attr('cy', yScale(this.data[0]))\n .attr('r', this.pointRadius)\n .attr('stroke', '#4caf50')\n .attr('fill', 'white')\n\n // 마지막 포인트\n if (this.data.length > 1) {\n g.append('circle')\n .attr('class', 'data-point')\n .attr('cx', xScale(this.data.length - 1))\n .attr('cy', yScale(this.data[this.data.length - 1]))\n .attr('r', this.pointRadius)\n .attr('stroke', '#2196f3')\n .attr('fill', 'white')\n }\n }\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { LitElement, html, css } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import * as d3 from 'd3';
|
|
5
|
-
let
|
|
5
|
+
let SvKpiRadarChart = class SvKpiRadarChart extends LitElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.data = [];
|
|
@@ -50,12 +50,6 @@ let KpiRadarChart = class KpiRadarChart extends LitElement {
|
|
|
50
50
|
svg.selectAll('*').remove();
|
|
51
51
|
const w = this.chartWidth || 300;
|
|
52
52
|
const h = this.chartHeight || 300;
|
|
53
|
-
// 레전드를 위한 공간 확보 (오른쪽에 120px)
|
|
54
|
-
const legendWidth = 120;
|
|
55
|
-
const chartWidth = w - legendWidth;
|
|
56
|
-
const chartHeight = h;
|
|
57
|
-
const r = Math.min(chartWidth, chartHeight) / 2 - 40;
|
|
58
|
-
const angleSlice = (2 * Math.PI) / (this.categories.length || 1);
|
|
59
53
|
// 데이터 변환: { org, values: [ {category, value} ... ] }
|
|
60
54
|
const orgData = d3
|
|
61
55
|
.groups(this.data, d => d.org)
|
|
@@ -66,18 +60,36 @@ let KpiRadarChart = class KpiRadarChart extends LitElement {
|
|
|
66
60
|
return { category: cat, value: found ? found[this.valueKey] : 0 };
|
|
67
61
|
})
|
|
68
62
|
}));
|
|
69
|
-
//
|
|
70
|
-
const
|
|
63
|
+
// 레전드를 위한 공간 확보 (org가 2개 이상일 때만)
|
|
64
|
+
const legendWidth = orgData.length > 1 ? 120 : 0;
|
|
65
|
+
const chartWidth = w - legendWidth;
|
|
66
|
+
const chartHeight = h;
|
|
67
|
+
const r = Math.min(chartWidth, chartHeight) / 2 - 40;
|
|
68
|
+
const angleSlice = (2 * Math.PI) / (this.categories.length || 1);
|
|
69
|
+
// 스케일 - 0-100 고정 범위 사용 (박스플롯과 동일한 범위)
|
|
70
|
+
const dataMaxValue = d3.max(this.data, d => d[this.valueKey]) || 1;
|
|
71
|
+
const maxValue = Math.max(100, dataMaxValue); // 최소 100까지 표시
|
|
71
72
|
const radius = d3.scaleLinear().domain([0, maxValue]).range([0, r]);
|
|
72
73
|
// SVG 기본
|
|
73
74
|
svg.attr('width', w).attr('height', h);
|
|
74
75
|
const g = svg.append('g').attr('transform', `translate(${chartWidth / 2},${chartHeight / 2})`);
|
|
75
76
|
// 그리드/축
|
|
76
77
|
for (let i = 1; i <= 5; i++) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const gridRadius = (r / 5) * i;
|
|
79
|
+
const gridValue = (maxValue / 5) * i;
|
|
80
|
+
g.append('circle').attr('r', gridRadius).attr('fill', 'none').attr('stroke', '#ccc');
|
|
81
|
+
// 그리드 값 라벨 (30도 시계방향 = Y1에서 30도 회전)
|
|
82
|
+
// 차트가 위쪽에서 시작하므로 -90도 + 30도 = -60도
|
|
83
|
+
const labelAngle = (-60 * Math.PI) / 180;
|
|
84
|
+
g.append('text')
|
|
85
|
+
.attr('x', gridRadius * Math.cos(labelAngle))
|
|
86
|
+
.attr('y', gridRadius * Math.sin(labelAngle))
|
|
87
|
+
.attr('text-anchor', 'middle')
|
|
88
|
+
.attr('alignment-baseline', 'middle')
|
|
89
|
+
.attr('font-size', 10)
|
|
90
|
+
.attr('fill', '#999')
|
|
91
|
+
.attr('background', '#fff')
|
|
92
|
+
.text(gridValue.toFixed(0));
|
|
81
93
|
}
|
|
82
94
|
this.categories.forEach((cat, i) => {
|
|
83
95
|
const angle = i * angleSlice - Math.PI / 2;
|
|
@@ -144,41 +156,47 @@ let KpiRadarChart = class KpiRadarChart extends LitElement {
|
|
|
144
156
|
.attr('stroke-width', 1);
|
|
145
157
|
});
|
|
146
158
|
});
|
|
147
|
-
// 레전드 추가
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
159
|
+
// 레전드 추가 (org가 2개 이상일 때만)
|
|
160
|
+
if (orgData.length > 1) {
|
|
161
|
+
const legend = svg
|
|
162
|
+
.append('g')
|
|
163
|
+
.attr('class', 'legend')
|
|
164
|
+
.attr('transform', `translate(${chartWidth + 20}, ${chartHeight / 2 - 30})`);
|
|
165
|
+
const legendData = [
|
|
166
|
+
{ label: '기준평균값', color: '#4CAF50', strokeStyle: 'none' },
|
|
167
|
+
{ label: '프로젝트 성과', color: '#2196F3', strokeStyle: 'none' }
|
|
168
|
+
];
|
|
169
|
+
const legendItems = legend
|
|
170
|
+
.selectAll('.legend-item')
|
|
171
|
+
.data(legendData)
|
|
172
|
+
.enter()
|
|
173
|
+
.append('g')
|
|
174
|
+
.attr('class', 'legend-item')
|
|
175
|
+
.attr('transform', (d, i) => `translate(0, ${i * 25})`);
|
|
176
|
+
// 레전드 아이콘 (작은 사각형)
|
|
177
|
+
legendItems
|
|
178
|
+
.append('rect')
|
|
179
|
+
.attr('x', 0)
|
|
180
|
+
.attr('y', 0)
|
|
181
|
+
.attr('width', 12)
|
|
182
|
+
.attr('height', 12)
|
|
183
|
+
.attr('fill', d => d.color)
|
|
184
|
+
.attr('opacity', 0.6)
|
|
185
|
+
.attr('stroke', d => d.color)
|
|
186
|
+
.attr('stroke-width', 1.5);
|
|
187
|
+
// 레전드 텍스트
|
|
188
|
+
legendItems
|
|
189
|
+
.append('text')
|
|
190
|
+
.attr('x', 18)
|
|
191
|
+
.attr('y', 9)
|
|
192
|
+
.attr('font-size', '12px')
|
|
193
|
+
.attr('fill', '#333')
|
|
194
|
+
.attr('alignment-baseline', 'middle')
|
|
195
|
+
.text(d => d.label);
|
|
196
|
+
}
|
|
179
197
|
}
|
|
180
198
|
};
|
|
181
|
-
|
|
199
|
+
SvKpiRadarChart.styles = css `
|
|
182
200
|
:host {
|
|
183
201
|
display: block;
|
|
184
202
|
width: 100%;
|
|
@@ -193,25 +211,25 @@ KpiRadarChart.styles = css `
|
|
|
193
211
|
__decorate([
|
|
194
212
|
property({ type: Array }),
|
|
195
213
|
__metadata("design:type", Array)
|
|
196
|
-
],
|
|
214
|
+
], SvKpiRadarChart.prototype, "data", void 0);
|
|
197
215
|
__decorate([
|
|
198
216
|
property({ type: Array }),
|
|
199
217
|
__metadata("design:type", Array)
|
|
200
|
-
],
|
|
218
|
+
], SvKpiRadarChart.prototype, "categories", void 0);
|
|
201
219
|
__decorate([
|
|
202
220
|
property({ type: String }),
|
|
203
221
|
__metadata("design:type", String)
|
|
204
|
-
],
|
|
222
|
+
], SvKpiRadarChart.prototype, "valueKey", void 0);
|
|
205
223
|
__decorate([
|
|
206
224
|
property({ type: String }),
|
|
207
225
|
__metadata("design:type", String)
|
|
208
|
-
],
|
|
226
|
+
], SvKpiRadarChart.prototype, "currentGroup", void 0);
|
|
209
227
|
__decorate([
|
|
210
228
|
property({ type: Object }),
|
|
211
229
|
__metadata("design:type", Object)
|
|
212
|
-
],
|
|
213
|
-
|
|
214
|
-
customElement('kpi-radar-chart')
|
|
215
|
-
],
|
|
216
|
-
export {
|
|
230
|
+
], SvKpiRadarChart.prototype, "seriesColors", void 0);
|
|
231
|
+
SvKpiRadarChart = __decorate([
|
|
232
|
+
customElement('sv-kpi-radar-chart')
|
|
233
|
+
], SvKpiRadarChart);
|
|
234
|
+
export { SvKpiRadarChart };
|
|
217
235
|
//# sourceMappingURL=kpi-radar-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-radar-chart.js","sourceRoot":"","sources":["../../client/components/kpi-radar-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACsB,SAAI,GAAU,EAAE,CAAA;QAChB,eAAU,GAAa,EAAE,CAAA;QACxB,aAAQ,GAAW,OAAO,CAAA;QAC1B,iBAAY,GAAW,EAAE,CAAA;QACzB,iBAAY,GAA2B;YACjE,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;SAClB,CAAA;QAeO,eAAU,GAAG,CAAC,CAAA;QACd,gBAAW,GAAG,CAAC,CAAA;IAuLzB,CAAC;IApLC,MAAM;QACJ,OAAO,IAAI,CAAA;;cAED,IAAI,CAAC,UAAU;eACd,IAAI,CAAC,WAAW;qBACV,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW;;YAE5C,CAAA;IACV,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YACjD,KAAK,MAAM,KAAK,IAAI,OAAO,E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AAC,cAAc,EAAE,GAAG,CAAC,CAAA;QAE5B,UAAU;QACV,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;aACvB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;aACb,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;aACZ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;aACzB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;aACpB,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;aACpC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;;AApMM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;GAWlB,AAXY,CAWZ;AApB0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;2CAAiB;AAChB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAA0B;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAG1B;AARU,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA+MzB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('kpi-radar-chart')\nexport class KpiRadarChart extends LitElement {\n @property({ type: Array }) data: any[] = []\n @property({ type: Array }) categories: string[] = []\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) currentGroup: string = ''\n @property({ type: Object }) seriesColors: Record<string, string> = {\n 기준평균: '#E3F2FD',\n 프로젝트성과: '#2196F3'\n }\n\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n `\n\n private chartWidth = 0\n private chartHeight = 0\n private resizeObserver?: ResizeObserver\n\n render() {\n return html`<svg\n id=\"radar\"\n width=${this.chartWidth}\n height=${this.chartHeight}\n viewBox=\"0 0 ${this.chartWidth} ${this.chartHeight}\"\n preserveAspectRatio=\"xMidYMid meet\"\n ></svg>`\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const rect = entry.contentRect\n this.chartWidth = rect.width\n this.chartHeight = rect.height\n this.requestUpdate()\n }\n })\n this.resizeObserver.observe(this)\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect()\n super.disconnectedCallback()\n }\n\n updated() {\n this.drawRadar()\n }\n\n drawRadar() {\n const svg = d3.select(this.renderRoot.querySelector('#radar'))\n svg.selectAll('*').remove()\n const w = this.chartWidth || 300\n const h = this.chartHeight || 300\n\n // 레전드를 위한 공간 확보 (오른쪽에 120px)\n const legendWidth = 120\n const chartWidth = w - legendWidth\n const chartHeight = h\n const r = Math.min(chartWidth, chartHeight) / 2 - 40\n const angleSlice = (2 * Math.PI) / (this.categories.length || 1)\n\n // 데이터 변환: { org, values: [ {category, value} ... ] }\n const orgData = d3\n .groups(this.data, d => d.org)\n .map(([org, values]) => ({\n org,\n values: this.categories.map((cat, i) => {\n const found = values.find(v => v.category === cat)\n return { category: cat, value: found ? found[this.valueKey] : 0 }\n })\n }))\n\n // 스케일\n const maxValue = d3.max(this.data, d => d[this.valueKey]) || 1\n const radius = d3.scaleLinear().domain([0, maxValue]).range([0, r])\n\n // SVG 기본\n svg.attr('width', w).attr('height', h)\n const g = svg.append('g').attr('transform', `translate(${chartWidth / 2},${chartHeight / 2})`)\n\n // 그리드/축\n for (let i = 1; i <= 5; i++) {\n g.append('circle')\n .attr('r', (r / 5) * i)\n .attr('fill', 'none')\n .attr('stroke', '#ccc')\n }\n this.categories.forEach((cat, i) => {\n const angle = i * angleSlice - Math.PI / 2\n g.append('line')\n .attr('x1', 0)\n .attr('y1', 0)\n .attr('x2', radius(maxValue) * Math.cos(angle))\n .attr('y2', radius(maxValue) * Math.sin(angle))\n .attr('stroke', '#ccc')\n g.append('text')\n .attr('x', (radius(maxValue) + 10) * Math.cos(angle))\n .attr('y', (radius(maxValue) + 10) * Math.sin(angle))\n .attr('text-anchor', 'middle')\n .attr('alignment-baseline', 'middle')\n .attr('font-size', 12)\n .attr('fill', '#333')\n .text(cat)\n })\n\n // 그룹별 폴리곤 - 기준평균을 먼저 그리고 프로젝트성과를 위에 그리기\n const sortedOrgData = orgData.sort((a, b) => {\n if (a.org === '기준평균') return -1\n if (b.org === '기준평균') return 1\n return 0\n })\n\n sortedOrgData.forEach(gd => {\n // 마지막에 첫 점을 한 번 더 추가\n const closedValues = [...gd.values, gd.values[0]]\n const line = d3\n .lineRadial()\n .radius((d: any) => radius(d.value))\n .angle((d, i) => i * angleSlice)\n\n // 색상 및 스타일 결정\n const baseColor = this.seriesColors[gd.org] || '#ccc'\n const fillColor =\n gd.org === '기준평균'\n ? 'rgba(76,175,80,0.4)' // 진한 녹색 배경\n : 'rgba(33,150,243,0.4)' // 진한 파란색 배경\n const strokeColor =\n gd.org === '기준평균'\n ? '#4CAF50' // 진한 녹색 선\n : '#2196F3' // 진한 파란색 선\n const strokeWidth = gd.org === '프로젝트성과' ? 1.5 : 1.5\n\n g.append('path')\n .datum(closedValues)\n .attr('d', line as any)\n .attr('fill', fillColor)\n .attr('stroke', strokeColor)\n .attr('stroke-width', strokeWidth)\n .attr('stroke-dasharray', 'none') // 모두 직선으로 변경\n })\n\n // 데이터 포인트 표시\n sortedOrgData.forEach(gd => {\n gd.values.forEach((d, i) => {\n const angle = i * angleSlice - Math.PI / 2\n const pointRadius = radius(d.value)\n const x = pointRadius * Math.cos(angle)\n const y = pointRadius * Math.sin(angle)\n\n g.append('circle')\n .attr('cx', x)\n .attr('cy', y)\n .attr('r', 3)\n .attr('fill', gd.org === '기준평균' ? '#4CAF50' : '#2196F3')\n .attr('stroke', '#fff')\n .attr('stroke-width', 1)\n })\n })\n\n // 레전드 추가\n const legend = svg.append('g')\n .attr('class', 'legend')\n .attr('transform', `translate(${chartWidth + 20}, ${chartHeight / 2 - 30})`)\n\n const legendData = [\n { label: '기준평균값', color: '#4CAF50', strokeStyle: 'none' },\n { label: '프로젝트 성과', color: '#2196F3', strokeStyle: 'none' }\n ]\n\n const legendItems = legend.selectAll('.legend-item')\n .data(legendData)\n .enter()\n .append('g')\n .attr('class', 'legend-item')\n .attr('transform', (d, i) => `translate(0, ${i * 25})`)\n\n // 레전드 아이콘 (작은 사각형)\n legendItems.append('rect')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', 12)\n .attr('height', 12)\n .attr('fill', d => d.color)\n .attr('opacity', 0.6)\n .attr('stroke', d => d.color)\n .attr('stroke-width', 1.5)\n\n // 레전드 텍스트\n legendItems.append('text')\n .attr('x', 18)\n .attr('y', 9)\n .attr('font-size', '12px')\n .attr('fill', '#333')\n .attr('alignment-baseline', 'middle')\n .text(d => d.label)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"kpi-radar-chart.js","sourceRoot":"","sources":["../../client/components/kpi-radar-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QACsB,SAAI,GAAU,EAAE,CAAA;QAChB,eAAU,GAAa,EAAE,CAAA;QACxB,aAAQ,GAAW,OAAO,CAAA;QAC1B,iBAAY,GAAW,EAAE,CAAA;QACzB,iBAAY,GAA2B;YACjE,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;SAClB,CAAA;QAeO,eAAU,GAAG,C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AE,GAAG,CAAC;iBACpB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;iBAC5B,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;YAE5B,UAAU;YACV,WAAW;iBACR,MAAM,CAAC,MAAM,CAAC;iBACd,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;iBACb,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;iBACZ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;iBACzB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;iBACpB,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;iBACpC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC;IACH,CAAC;;AAxNM,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;GAWlB,AAXY,CAWZ;AApB0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAiB;AAChB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mDAA0B;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAG1B;AARU,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CAmO3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('sv-kpi-radar-chart')\nexport class SvKpiRadarChart extends LitElement {\n @property({ type: Array }) data: any[] = []\n @property({ type: Array }) categories: string[] = []\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) currentGroup: string = ''\n @property({ type: Object }) seriesColors: Record<string, string> = {\n 기준평균: '#E3F2FD',\n 프로젝트성과: '#2196F3'\n }\n\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n `\n\n private chartWidth = 0\n private chartHeight = 0\n private resizeObserver?: ResizeObserver\n\n render() {\n return html`<svg\n id=\"radar\"\n width=${this.chartWidth}\n height=${this.chartHeight}\n viewBox=\"0 0 ${this.chartWidth} ${this.chartHeight}\"\n preserveAspectRatio=\"xMidYMid meet\"\n ></svg>`\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const rect = entry.contentRect\n this.chartWidth = rect.width\n this.chartHeight = rect.height\n this.requestUpdate()\n }\n })\n this.resizeObserver.observe(this)\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect()\n super.disconnectedCallback()\n }\n\n updated() {\n this.drawRadar()\n }\n\n drawRadar() {\n const svg = d3.select(this.renderRoot.querySelector('#radar'))\n svg.selectAll('*').remove()\n const w = this.chartWidth || 300\n const h = this.chartHeight || 300\n\n // 데이터 변환: { org, values: [ {category, value} ... ] }\n const orgData = d3\n .groups(this.data, d => d.org)\n .map(([org, values]) => ({\n org,\n values: this.categories.map((cat, i) => {\n const found = values.find(v => v.category === cat)\n return { category: cat, value: found ? found[this.valueKey] : 0 }\n })\n }))\n\n // 레전드를 위한 공간 확보 (org가 2개 이상일 때만)\n const legendWidth = orgData.length > 1 ? 120 : 0\n const chartWidth = w - legendWidth\n const chartHeight = h\n const r = Math.min(chartWidth, chartHeight) / 2 - 40\n const angleSlice = (2 * Math.PI) / (this.categories.length || 1)\n\n // 스케일 - 0-100 고정 범위 사용 (박스플롯과 동일한 범위)\n const dataMaxValue = d3.max(this.data, d => d[this.valueKey]) || 1\n const maxValue = Math.max(100, dataMaxValue) // 최소 100까지 표시\n const radius = d3.scaleLinear().domain([0, maxValue]).range([0, r])\n\n // SVG 기본\n svg.attr('width', w).attr('height', h)\n const g = svg.append('g').attr('transform', `translate(${chartWidth / 2},${chartHeight / 2})`)\n\n // 그리드/축\n for (let i = 1; i <= 5; i++) {\n const gridRadius = (r / 5) * i\n const gridValue = (maxValue / 5) * i\n\n g.append('circle').attr('r', gridRadius).attr('fill', 'none').attr('stroke', '#ccc')\n\n // 그리드 값 라벨 (30도 시계방향 = Y1에서 30도 회전)\n // 차트가 위쪽에서 시작하므로 -90도 + 30도 = -60도\n const labelAngle = (-60 * Math.PI) / 180\n g.append('text')\n .attr('x', gridRadius * Math.cos(labelAngle))\n .attr('y', gridRadius * Math.sin(labelAngle))\n .attr('text-anchor', 'middle')\n .attr('alignment-baseline', 'middle')\n .attr('font-size', 10)\n .attr('fill', '#999')\n .attr('background', '#fff')\n .text(gridValue.toFixed(0))\n }\n this.categories.forEach((cat, i) => {\n const angle = i * angleSlice - Math.PI / 2\n g.append('line')\n .attr('x1', 0)\n .attr('y1', 0)\n .attr('x2', radius(maxValue) * Math.cos(angle))\n .attr('y2', radius(maxValue) * Math.sin(angle))\n .attr('stroke', '#ccc')\n g.append('text')\n .attr('x', (radius(maxValue) + 10) * Math.cos(angle))\n .attr('y', (radius(maxValue) + 10) * Math.sin(angle))\n .attr('text-anchor', 'middle')\n .attr('alignment-baseline', 'middle')\n .attr('font-size', 12)\n .attr('fill', '#333')\n .text(cat)\n })\n\n // 그룹별 폴리곤 - 기준평균을 먼저 그리고 프로젝트성과를 위에 그리기\n const sortedOrgData = orgData.sort((a, b) => {\n if (a.org === '기준평균') return -1\n if (b.org === '기준평균') return 1\n return 0\n })\n\n sortedOrgData.forEach(gd => {\n // 마지막에 첫 점을 한 번 더 추가\n const closedValues = [...gd.values, gd.values[0]]\n const line = d3\n .lineRadial()\n .radius((d: any) => radius(d.value))\n .angle((d, i) => i * angleSlice)\n\n // 색상 및 스타일 결정\n const baseColor = this.seriesColors[gd.org] || '#ccc'\n const fillColor =\n gd.org === '기준평균'\n ? 'rgba(76,175,80,0.4)' // 진한 녹색 배경\n : 'rgba(33,150,243,0.4)' // 진한 파란색 배경\n const strokeColor =\n gd.org === '기준평균'\n ? '#4CAF50' // 진한 녹색 선\n : '#2196F3' // 진한 파란색 선\n const strokeWidth = gd.org === '프로젝트성과' ? 1.5 : 1.5\n\n g.append('path')\n .datum(closedValues)\n .attr('d', line as any)\n .attr('fill', fillColor)\n .attr('stroke', strokeColor)\n .attr('stroke-width', strokeWidth)\n .attr('stroke-dasharray', 'none') // 모두 직선으로 변경\n })\n\n // 데이터 포인트 표시\n sortedOrgData.forEach(gd => {\n gd.values.forEach((d, i) => {\n const angle = i * angleSlice - Math.PI / 2\n const pointRadius = radius(d.value)\n const x = pointRadius * Math.cos(angle)\n const y = pointRadius * Math.sin(angle)\n\n g.append('circle')\n .attr('cx', x)\n .attr('cy', y)\n .attr('r', 3)\n .attr('fill', gd.org === '기준평균' ? '#4CAF50' : '#2196F3')\n .attr('stroke', '#fff')\n .attr('stroke-width', 1)\n })\n })\n\n // 레전드 추가 (org가 2개 이상일 때만)\n if (orgData.length > 1) {\n const legend = svg\n .append('g')\n .attr('class', 'legend')\n .attr('transform', `translate(${chartWidth + 20}, ${chartHeight / 2 - 30})`)\n\n const legendData = [\n { label: '기준평균값', color: '#4CAF50', strokeStyle: 'none' },\n { label: '프로젝트 성과', color: '#2196F3', strokeStyle: 'none' }\n ]\n\n const legendItems = legend\n .selectAll('.legend-item')\n .data(legendData)\n .enter()\n .append('g')\n .attr('class', 'legend-item')\n .attr('transform', (d, i) => `translate(0, ${i * 25})`)\n\n // 레전드 아이콘 (작은 사각형)\n legendItems\n .append('rect')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', 12)\n .attr('height', 12)\n .attr('fill', d => d.color)\n .attr('opacity', 0.6)\n .attr('stroke', d => d.color)\n .attr('stroke-width', 1.5)\n\n // 레전드 텍스트\n legendItems\n .append('text')\n .attr('x', 18)\n .attr('y', 9)\n .attr('font-size', '12px')\n .attr('fill', '#333')\n .attr('alignment-baseline', 'middle')\n .text(d => d.label)\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class SvKpiTrendChart extends LitElement {
|
|
3
|
+
data: {
|
|
4
|
+
date: string;
|
|
5
|
+
value: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
}[];
|
|
8
|
+
valueKey: string;
|
|
9
|
+
dateKey: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
lineColor: string;
|
|
13
|
+
strokeWidth: number;
|
|
14
|
+
showPoints: boolean;
|
|
15
|
+
pointRadius: number;
|
|
16
|
+
private chartWidth;
|
|
17
|
+
private chartHeight;
|
|
18
|
+
private resizeObserver?;
|
|
19
|
+
static styles: import("lit").CSSResult;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
updated(): void;
|
|
24
|
+
drawTrendChart(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
let SvKpiTrendChart = class SvKpiTrendChart extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.data = [];
|
|
9
|
+
this.valueKey = 'value';
|
|
10
|
+
this.dateKey = 'date';
|
|
11
|
+
this.width = 400;
|
|
12
|
+
this.height = 200;
|
|
13
|
+
this.lineColor = '#2196f3';
|
|
14
|
+
this.strokeWidth = 2;
|
|
15
|
+
this.showPoints = true;
|
|
16
|
+
this.pointRadius = 4;
|
|
17
|
+
this.chartWidth = 0;
|
|
18
|
+
this.chartHeight = 0;
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return html `
|
|
22
|
+
<div class="chart-container">
|
|
23
|
+
<svg
|
|
24
|
+
id="trend-chart"
|
|
25
|
+
width=${this.chartWidth || this.width}
|
|
26
|
+
height=${this.chartHeight || this.height}
|
|
27
|
+
viewBox="0 0 ${this.chartWidth || this.width} ${this.chartHeight || this.height}"
|
|
28
|
+
preserveAspectRatio="xMidYMid meet"
|
|
29
|
+
></svg>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
const rect = entry.contentRect;
|
|
38
|
+
this.chartWidth = rect.width;
|
|
39
|
+
this.chartHeight = rect.height;
|
|
40
|
+
this.requestUpdate();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
this.resizeObserver.observe(this);
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
48
|
+
super.disconnectedCallback();
|
|
49
|
+
}
|
|
50
|
+
updated() {
|
|
51
|
+
this.drawTrendChart();
|
|
52
|
+
}
|
|
53
|
+
drawTrendChart() {
|
|
54
|
+
if (!this.data || this.data.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
const svg = d3.select(this.renderRoot.querySelector('#trend-chart'));
|
|
57
|
+
svg.selectAll('*').remove();
|
|
58
|
+
const margin = { top: 20, right: 20, bottom: 50, left: 40 };
|
|
59
|
+
const width = this.chartWidth || this.width;
|
|
60
|
+
const height = this.chartHeight || this.height;
|
|
61
|
+
const chartWidth = width - margin.left - margin.right;
|
|
62
|
+
const chartHeight = height - margin.top - margin.bottom;
|
|
63
|
+
// 데이터 파싱
|
|
64
|
+
const parsedData = this.data.map(d => ({
|
|
65
|
+
date: new Date(d[this.dateKey]),
|
|
66
|
+
value: +d[this.valueKey],
|
|
67
|
+
color: d.color || this.lineColor
|
|
68
|
+
}));
|
|
69
|
+
// 스케일 설정
|
|
70
|
+
const xScale = d3
|
|
71
|
+
.scaleTime()
|
|
72
|
+
.domain(d3.extent(parsedData, d => d.date))
|
|
73
|
+
.range([0, chartWidth]);
|
|
74
|
+
const yScale = d3
|
|
75
|
+
.scaleLinear()
|
|
76
|
+
.domain([0, d3.max(parsedData, d => d.value) || 100])
|
|
77
|
+
.range([chartHeight, 0]);
|
|
78
|
+
// SVG 설정
|
|
79
|
+
svg.attr('width', width).attr('height', height);
|
|
80
|
+
const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`);
|
|
81
|
+
// 축 생성 - 연도가 바뀌면 연도 포함
|
|
82
|
+
const timeFormat = (date) => {
|
|
83
|
+
const dates = parsedData.map(d => d.date);
|
|
84
|
+
const years = [...new Set(dates.map(d => d.getFullYear()))];
|
|
85
|
+
// 여러 연도가 있으면 연도 포함
|
|
86
|
+
if (years.length > 1) {
|
|
87
|
+
return d3.timeFormat('%Y-%m')(date);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return d3.timeFormat('%m/%d')(date);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const xAxis = d3.axisBottom(xScale).tickFormat(timeFormat).ticks(Math.min(parsedData.length, 10));
|
|
94
|
+
const yAxis = d3.axisLeft(yScale).ticks(5);
|
|
95
|
+
// X축 그리드 라인 추가
|
|
96
|
+
g.append('g')
|
|
97
|
+
.attr('class', 'grid')
|
|
98
|
+
.attr('transform', `translate(0,${chartHeight})`)
|
|
99
|
+
.call(d3
|
|
100
|
+
.axisBottom(xScale)
|
|
101
|
+
.ticks(Math.min(parsedData.length, 10))
|
|
102
|
+
.tickSize(-chartHeight)
|
|
103
|
+
.tickFormat(() => ''));
|
|
104
|
+
g.append('g')
|
|
105
|
+
.attr('class', 'axis')
|
|
106
|
+
.attr('transform', `translate(0,${chartHeight})`)
|
|
107
|
+
.call(xAxis)
|
|
108
|
+
.selectAll('text')
|
|
109
|
+
.style('text-anchor', 'end')
|
|
110
|
+
.attr('dx', '-.5em')
|
|
111
|
+
.attr('dy', '.3em')
|
|
112
|
+
.attr('transform', 'rotate(-30)');
|
|
113
|
+
g.append('g').attr('class', 'axis').call(yAxis);
|
|
114
|
+
// 라인 생성기
|
|
115
|
+
const line = d3
|
|
116
|
+
.line()
|
|
117
|
+
.x(d => xScale(d.date))
|
|
118
|
+
.y(d => yScale(d.value))
|
|
119
|
+
.curve(d3.curveMonotoneX);
|
|
120
|
+
// 트렌드 라인 그리기
|
|
121
|
+
g.append('path')
|
|
122
|
+
.datum(parsedData)
|
|
123
|
+
.attr('class', 'trend-line')
|
|
124
|
+
.attr('d', line)
|
|
125
|
+
.attr('stroke', this.lineColor)
|
|
126
|
+
.attr('stroke-width', this.strokeWidth);
|
|
127
|
+
// 데이터 포인트 그리기
|
|
128
|
+
if (this.showPoints) {
|
|
129
|
+
g.selectAll('.data-point')
|
|
130
|
+
.data(parsedData)
|
|
131
|
+
.enter()
|
|
132
|
+
.append('circle')
|
|
133
|
+
.attr('class', 'data-point')
|
|
134
|
+
.attr('cx', d => xScale(d.date))
|
|
135
|
+
.attr('cy', d => yScale(d.value))
|
|
136
|
+
.attr('r', this.pointRadius)
|
|
137
|
+
.attr('stroke', d => d.color)
|
|
138
|
+
.attr('fill', 'white');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
SvKpiTrendChart.styles = css `
|
|
143
|
+
:host {
|
|
144
|
+
display: block;
|
|
145
|
+
width: 100%;
|
|
146
|
+
height: 100%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.chart-container {
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100%;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.trend-line {
|
|
155
|
+
fill: none;
|
|
156
|
+
stroke-linecap: round;
|
|
157
|
+
stroke-linejoin: round;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.data-point {
|
|
161
|
+
fill: white;
|
|
162
|
+
stroke-width: 2;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.axis line,
|
|
166
|
+
.axis path,
|
|
167
|
+
.grid line {
|
|
168
|
+
stroke: #ddd;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.grid path {
|
|
172
|
+
stroke: none;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.axis text {
|
|
176
|
+
font-size: 10px;
|
|
177
|
+
fill: #666;
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
__decorate([
|
|
181
|
+
property({ type: Array }),
|
|
182
|
+
__metadata("design:type", Array)
|
|
183
|
+
], SvKpiTrendChart.prototype, "data", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: String }),
|
|
186
|
+
__metadata("design:type", String)
|
|
187
|
+
], SvKpiTrendChart.prototype, "valueKey", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
property({ type: String }),
|
|
190
|
+
__metadata("design:type", String)
|
|
191
|
+
], SvKpiTrendChart.prototype, "dateKey", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: Number }),
|
|
194
|
+
__metadata("design:type", Number)
|
|
195
|
+
], SvKpiTrendChart.prototype, "width", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: Number }),
|
|
198
|
+
__metadata("design:type", Number)
|
|
199
|
+
], SvKpiTrendChart.prototype, "height", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: String }),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], SvKpiTrendChart.prototype, "lineColor", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Number }),
|
|
206
|
+
__metadata("design:type", Number)
|
|
207
|
+
], SvKpiTrendChart.prototype, "strokeWidth", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ type: Boolean }),
|
|
210
|
+
__metadata("design:type", Boolean)
|
|
211
|
+
], SvKpiTrendChart.prototype, "showPoints", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Number }),
|
|
214
|
+
__metadata("design:type", Number)
|
|
215
|
+
], SvKpiTrendChart.prototype, "pointRadius", void 0);
|
|
216
|
+
SvKpiTrendChart = __decorate([
|
|
217
|
+
customElement('sv-kpi-trend-chart')
|
|
218
|
+
], SvKpiTrendChart);
|
|
219
|
+
export { SvKpiTrendChart };
|
|
220
|
+
//# sourceMappingURL=kpi-trend-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-trend-chart.js","sourceRoot":"","sources":["../../client/components/kpi-trend-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QACsB,SAAI,GAAsD,EAAE,CAAA;QAC3D,aAAQ,GAAW,OAAO,CAAA;QAC1B,YAAO,GAAW,MAAM,CAAA;QACxB,UAAK,GAAW,GAAG,CAAA;QACnB,WAAM,GAAW,GAAG,CAAA;QACpB,cAAS,GAAW,SAAS,CAAA;QAC7B,gBAAW,GAAW,CAAC,CAAA;QACtB,eAAU,GAAY,IAAI,CAAA;QAC3B,gBAAW,GAAW,CAAC,CAAA;QAE3C,eAAU,GAAG,CAAC,CAAA;QACd,gBAAW,GAAG,CAAC,CAAA;IAsLzB,CAAC;IA5IC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;kBAIG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK;mBAC5B,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM;yBACzB,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,IAA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AA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAwB;AATxC,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CAkM3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('sv-kpi-trend-chart')\nexport class SvKpiTrendChart extends LitElement {\n @property({ type: Array }) data: { date: string; value: number; color?: string }[] = []\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) dateKey: string = 'date'\n @property({ type: Number }) width: number = 400\n @property({ type: Number }) height: number = 200\n @property({ type: String }) lineColor: string = '#2196f3'\n @property({ type: Number }) strokeWidth: number = 2\n @property({ type: Boolean }) showPoints: boolean = true\n @property({ type: Number }) pointRadius: number = 4\n\n private chartWidth = 0\n private chartHeight = 0\n private resizeObserver?: ResizeObserver\n\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .chart-container {\n width: 100%;\n height: 100%;\n }\n\n .trend-line {\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n\n .data-point {\n fill: white;\n stroke-width: 2;\n }\n\n .axis line,\n .axis path,\n .grid line {\n stroke: #ddd;\n }\n\n .grid path {\n stroke: none;\n }\n\n .axis text {\n font-size: 10px;\n fill: #666;\n }\n `\n\n render() {\n return html`\n <div class=\"chart-container\">\n <svg\n id=\"trend-chart\"\n width=${this.chartWidth || this.width}\n height=${this.chartHeight || this.height}\n viewBox=\"0 0 ${this.chartWidth || this.width} ${this.chartHeight || this.height}\"\n preserveAspectRatio=\"xMidYMid meet\"\n ></svg>\n </div>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const rect = entry.contentRect\n this.chartWidth = rect.width\n this.chartHeight = rect.height\n this.requestUpdate()\n }\n })\n this.resizeObserver.observe(this)\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect()\n super.disconnectedCallback()\n }\n\n updated() {\n this.drawTrendChart()\n }\n\n drawTrendChart() {\n if (!this.data || this.data.length === 0) return\n\n const svg = d3.select(this.renderRoot.querySelector('#trend-chart'))\n svg.selectAll('*').remove()\n\n const margin = { top: 20, right: 20, bottom: 50, left: 40 }\n const width = this.chartWidth || this.width\n const height = this.chartHeight || this.height\n const chartWidth = width - margin.left - margin.right\n const chartHeight = height - margin.top - margin.bottom\n\n // 데이터 파싱\n const parsedData = this.data.map(d => ({\n date: new Date(d[this.dateKey]),\n value: +d[this.valueKey],\n color: d.color || this.lineColor\n }))\n\n // 스케일 설정\n const xScale = d3\n .scaleTime()\n .domain(d3.extent(parsedData, d => d.date) as [Date, Date])\n .range([0, chartWidth])\n\n const yScale = d3\n .scaleLinear()\n .domain([0, d3.max(parsedData, d => d.value) || 100])\n .range([chartHeight, 0])\n\n // SVG 설정\n svg.attr('width', width).attr('height', height)\n const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`)\n\n // 축 생성 - 연도가 바뀌면 연도 포함\n const timeFormat = (date: Date) => {\n const dates = parsedData.map(d => d.date)\n const years = [...new Set(dates.map(d => d.getFullYear()))]\n\n // 여러 연도가 있으면 연도 포함\n if (years.length > 1) {\n return d3.timeFormat('%Y-%m')(date)\n } else {\n return d3.timeFormat('%m/%d')(date)\n }\n }\n\n const xAxis = d3.axisBottom(xScale).tickFormat(timeFormat as any).ticks(Math.min(parsedData.length, 10))\n\n const yAxis = d3.axisLeft(yScale).ticks(5)\n\n // X축 그리드 라인 추가\n g.append('g')\n .attr('class', 'grid')\n .attr('transform', `translate(0,${chartHeight})`)\n .call(\n d3\n .axisBottom(xScale)\n .ticks(Math.min(parsedData.length, 10))\n .tickSize(-chartHeight)\n .tickFormat(() => '')\n )\n\n g.append('g')\n .attr('class', 'axis')\n .attr('transform', `translate(0,${chartHeight})`)\n .call(xAxis)\n .selectAll('text')\n .style('text-anchor', 'end')\n .attr('dx', '-.5em')\n .attr('dy', '.3em')\n .attr('transform', 'rotate(-30)')\n\n g.append('g').attr('class', 'axis').call(yAxis)\n\n // 라인 생성기\n const line = d3\n .line<{ date: Date; value: number; color: string }>()\n .x(d => xScale(d.date))\n .y(d => yScale(d.value))\n .curve(d3.curveMonotoneX)\n\n // 트렌드 라인 그리기\n g.append('path')\n .datum(parsedData)\n .attr('class', 'trend-line')\n .attr('d', line as any)\n .attr('stroke', this.lineColor)\n .attr('stroke-width', this.strokeWidth)\n\n // 데이터 포인트 그리기\n if (this.showPoints) {\n g.selectAll('.data-point')\n .data(parsedData)\n .enter()\n .append('circle')\n .attr('class', 'data-point')\n .attr('cx', d => xScale(d.date))\n .attr('cy', d => yScale(d.value))\n .attr('r', this.pointRadius)\n .attr('stroke', d => d.color)\n .attr('fill', 'white')\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
google: any;
|
|
5
|
+
markerClusterer?: any;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class CommonGoogleMap extends LitElement {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
center: any;
|
|
11
|
+
zoom: any;
|
|
12
|
+
locations: any[];
|
|
13
|
+
focused: any;
|
|
14
|
+
polygons: any;
|
|
15
|
+
polylines: any;
|
|
16
|
+
markers: any;
|
|
17
|
+
boundCoords: any;
|
|
18
|
+
controls: any;
|
|
19
|
+
clusterZoom: number;
|
|
20
|
+
map: any;
|
|
21
|
+
defaultCenter: any;
|
|
22
|
+
private _infoWindow;
|
|
23
|
+
private _markerClusterer;
|
|
24
|
+
private _buildMarkersTimer;
|
|
25
|
+
get anchor(): Element | null;
|
|
26
|
+
readyMap(): Promise<void>;
|
|
27
|
+
buildMarkers(locations?: any[]): Promise<void>;
|
|
28
|
+
get infoWindow(): any;
|
|
29
|
+
setFocus(focus: any, icon: any): void;
|
|
30
|
+
resetFocus(focus: any, icon: any): void;
|
|
31
|
+
changeFocus(after: any, before: any): Promise<void>;
|
|
32
|
+
updated(changes: any): Promise<void>;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
resetBounds(): void;
|
|
35
|
+
}
|