@dssp/dkpi 1.0.0-alpha.53 → 1.0.0-alpha.54
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/KPI-STATISTICS-SERVICE.md +233 -0
- package/dist-client/components/kpi-single-boxplot-chart.js +109 -111
- package/dist-client/components/kpi-single-boxplot-chart.js.map +1 -1
- package/dist-client/pages/sv-project-completed-list.d.ts +3 -0
- package/dist-client/pages/sv-project-completed-list.js +70 -11
- package/dist-client/pages/sv-project-completed-list.js.map +1 -1
- package/dist-client/pages/sv-project-list.d.ts +3 -0
- package/dist-client/pages/sv-project-list.js +69 -11
- package/dist-client/pages/sv-project-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/index.d.ts +1 -3
- package/dist-server/service/index.js +3 -4
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi-stat/index.d.ts +4 -0
- package/dist-server/service/kpi-stat/index.js +8 -0
- package/dist-server/service/kpi-stat/index.js.map +1 -0
- package/dist-server/service/kpi-stat/kpi-stat-query.d.ts +8 -0
- package/dist-server/service/kpi-stat/kpi-stat-query.js +225 -0
- package/dist-server/service/kpi-stat/kpi-stat-query.js.map +1 -0
- package/dist-server/service/kpi-stat/kpi-stat-types.d.ts +20 -0
- package/dist-server/service/kpi-stat/kpi-stat-types.js +78 -0
- package/dist-server/service/kpi-stat/kpi-stat-types.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/kpi-module-service-tests.md +1286 -0
- package/kpi-module-test-report.md +676 -0
- package/kpi-module-unit-test-detailed-report.md +925 -0
- package/kpi-module-unit-tests-detailed.md +1452 -0
- package/package.json +3 -3
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# KPI Statistics Service Implementation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This implementation provides GraphQL services for KPI statistics visualization, specifically designed for box plots and radar charts. The service analyzes KPI values across different geographical groups and provides real-time statistical data for completed projects.
|
|
6
|
+
|
|
7
|
+
## GraphQL Types
|
|
8
|
+
|
|
9
|
+
### KpiBoxPlotStats
|
|
10
|
+
Box plot statistics for KPI values:
|
|
11
|
+
- `geoGroup`: Geographical group identifier
|
|
12
|
+
- `kpiName`: KPI name (optional for aggregated data)
|
|
13
|
+
- `minVal`: Minimum score value
|
|
14
|
+
- `q1Val`: First quartile (25th percentile)
|
|
15
|
+
- `medVal`: Median value (50th percentile)
|
|
16
|
+
- `q3Val`: Third quartile (75th percentile)
|
|
17
|
+
- `maxVal`: Maximum score value
|
|
18
|
+
|
|
19
|
+
### KpiRadarStats
|
|
20
|
+
Radar chart statistics for KPI values:
|
|
21
|
+
- `geoGroup`: Geographical group identifier
|
|
22
|
+
- `kpiName`: KPI name
|
|
23
|
+
- `avgScore`: Average KPI score
|
|
24
|
+
- `projectCount`: Number of projects in calculation
|
|
25
|
+
|
|
26
|
+
## GraphQL Queries
|
|
27
|
+
|
|
28
|
+
### 1. kpiZValueBoxPlotStats
|
|
29
|
+
Returns box plot statistics for Z-category KPIs grouped by geographical region.
|
|
30
|
+
|
|
31
|
+
**Query:**
|
|
32
|
+
```graphql
|
|
33
|
+
query GetZValueBoxPlot($geoGroup: String) {
|
|
34
|
+
kpiZValueBoxPlotStats(geoGroup: $geoGroup) {
|
|
35
|
+
geoGroup
|
|
36
|
+
minVal
|
|
37
|
+
q1Val
|
|
38
|
+
medVal
|
|
39
|
+
q3Val
|
|
40
|
+
maxVal
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Parameters:**
|
|
46
|
+
- `geoGroup` (optional): Filter by specific geographical group
|
|
47
|
+
|
|
48
|
+
### 2. kpiYValueBoxPlotStats
|
|
49
|
+
Returns box plot statistics for Y-category KPIs, broken down by both geographical region and individual KPI names.
|
|
50
|
+
|
|
51
|
+
**Query:**
|
|
52
|
+
```graphql
|
|
53
|
+
query GetYValueBoxPlot($geoGroup: String) {
|
|
54
|
+
kpiYValueBoxPlotStats(geoGroup: $geoGroup) {
|
|
55
|
+
geoGroup
|
|
56
|
+
kpiName
|
|
57
|
+
minVal
|
|
58
|
+
q1Val
|
|
59
|
+
medVal
|
|
60
|
+
q3Val
|
|
61
|
+
maxVal
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Parameters:**
|
|
67
|
+
- `geoGroup` (optional): Filter by specific geographical group
|
|
68
|
+
|
|
69
|
+
### 3. kpiRadarStats
|
|
70
|
+
Returns radar chart statistics for KPIs matching a specific pattern.
|
|
71
|
+
|
|
72
|
+
**Query:**
|
|
73
|
+
```graphql
|
|
74
|
+
query GetRadarStats($kpiPattern: String!, $geoGroup: String) {
|
|
75
|
+
kpiRadarStats(kpiPattern: $kpiPattern, geoGroup: $geoGroup) {
|
|
76
|
+
geoGroup
|
|
77
|
+
kpiName
|
|
78
|
+
avgScore
|
|
79
|
+
projectCount
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Parameters:**
|
|
85
|
+
- `kpiPattern`: SQL LIKE pattern for KPI names (default: '%')
|
|
86
|
+
- `geoGroup` (optional): Filter by specific geographical group
|
|
87
|
+
|
|
88
|
+
### 4. kpiComprehensiveStats
|
|
89
|
+
Returns comprehensive statistics for all KPIs across completed projects.
|
|
90
|
+
|
|
91
|
+
**Query:**
|
|
92
|
+
```graphql
|
|
93
|
+
query GetComprehensiveStats($geoGroup: String, $includeOngoing: Boolean) {
|
|
94
|
+
kpiComprehensiveStats(geoGroup: $geoGroup, includeOngoing: $includeOngoing) {
|
|
95
|
+
geoGroup
|
|
96
|
+
kpiName
|
|
97
|
+
avgScore
|
|
98
|
+
projectCount
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Parameters:**
|
|
104
|
+
- `geoGroup` (optional): Filter by specific geographical group
|
|
105
|
+
- `includeOngoing` (default: false): Include ongoing projects in analysis
|
|
106
|
+
|
|
107
|
+
## Usage Examples
|
|
108
|
+
|
|
109
|
+
### JavaScript/Frontend Usage
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { client } from '@operato/graphql'
|
|
113
|
+
import gql from 'graphql-tag'
|
|
114
|
+
|
|
115
|
+
// Get Z-category box plot data for all regions
|
|
116
|
+
const getZBoxPlotData = async () => {
|
|
117
|
+
const result = await client.query({
|
|
118
|
+
query: gql`
|
|
119
|
+
query {
|
|
120
|
+
kpiZValueBoxPlotStats {
|
|
121
|
+
geoGroup
|
|
122
|
+
minVal
|
|
123
|
+
q1Val
|
|
124
|
+
medVal
|
|
125
|
+
q3Val
|
|
126
|
+
maxVal
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
})
|
|
131
|
+
return result.data.kpiZValueBoxPlotStats
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Get Y-category box plot data for specific region
|
|
135
|
+
const getYBoxPlotData = async (region: string) => {
|
|
136
|
+
const result = await client.query({
|
|
137
|
+
query: gql`
|
|
138
|
+
query GetYBoxPlot($geoGroup: String) {
|
|
139
|
+
kpiYValueBoxPlotStats(geoGroup: $geoGroup) {
|
|
140
|
+
geoGroup
|
|
141
|
+
kpiName
|
|
142
|
+
minVal
|
|
143
|
+
q1Val
|
|
144
|
+
medVal
|
|
145
|
+
q3Val
|
|
146
|
+
maxVal
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`,
|
|
150
|
+
variables: { geoGroup: region }
|
|
151
|
+
})
|
|
152
|
+
return result.data.kpiYValueBoxPlotStats
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Get radar chart data for X-category KPIs
|
|
156
|
+
const getRadarData = async () => {
|
|
157
|
+
const result = await client.query({
|
|
158
|
+
query: gql`
|
|
159
|
+
query {
|
|
160
|
+
kpiRadarStats(kpiPattern: "X%") {
|
|
161
|
+
geoGroup
|
|
162
|
+
kpiName
|
|
163
|
+
avgScore
|
|
164
|
+
projectCount
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`
|
|
168
|
+
})
|
|
169
|
+
return result.data.kpiRadarStats
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Data Processing for Charts
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
// Process box plot data for Chart.js or similar
|
|
177
|
+
const processBoxPlotData = (data: KpiBoxPlotStats[]) => {
|
|
178
|
+
return data.map(item => ({
|
|
179
|
+
label: item.geoGroup,
|
|
180
|
+
data: [item.minVal, item.q1Val, item.medVal, item.q3Val, item.maxVal]
|
|
181
|
+
}))
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Process radar data for radar charts
|
|
185
|
+
const processRadarData = (data: KpiRadarStats[]) => {
|
|
186
|
+
const groupedData = data.reduce((acc, item) => {
|
|
187
|
+
if (!acc[item.geoGroup]) {
|
|
188
|
+
acc[item.geoGroup] = []
|
|
189
|
+
}
|
|
190
|
+
acc[item.geoGroup].push({
|
|
191
|
+
label: item.kpiName,
|
|
192
|
+
value: item.avgScore
|
|
193
|
+
})
|
|
194
|
+
return acc
|
|
195
|
+
}, {} as Record<string, Array<{label: string, value: number}>>)
|
|
196
|
+
|
|
197
|
+
return groupedData
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Database Schema Requirements
|
|
202
|
+
|
|
203
|
+
The service expects the following database structure:
|
|
204
|
+
|
|
205
|
+
- `kpi_values` table with columns: `id`, `score`, `kpi_id`, `kpi_org_scope_id`, `domain_id`
|
|
206
|
+
- `kpis` table with columns: `id`, `name`
|
|
207
|
+
- `projects` table with columns: `id`, `geo_group`, `end_date`
|
|
208
|
+
|
|
209
|
+
## Security
|
|
210
|
+
|
|
211
|
+
All queries require KPI query privileges:
|
|
212
|
+
- Category: "kpi"
|
|
213
|
+
- Privilege: "query"
|
|
214
|
+
- Domain owner granted: true
|
|
215
|
+
- Super user granted: true
|
|
216
|
+
|
|
217
|
+
## Performance Considerations
|
|
218
|
+
|
|
219
|
+
1. **Indexing**: Ensure indexes on:
|
|
220
|
+
- `kpi_values.kpi_id`
|
|
221
|
+
- `kpi_values.kpi_org_scope_id`
|
|
222
|
+
- `kpi_values.domain_id`
|
|
223
|
+
- `projects.end_date`
|
|
224
|
+
- `projects.geo_group`
|
|
225
|
+
- `kpis.name`
|
|
226
|
+
|
|
227
|
+
2. **Caching**: Consider implementing GraphQL query result caching for frequently accessed statistics.
|
|
228
|
+
|
|
229
|
+
3. **Aggregation**: The percentile calculations may be expensive on large datasets. Consider pre-computing statistics for better performance.
|
|
230
|
+
|
|
231
|
+
## File Location
|
|
232
|
+
|
|
233
|
+
Implementation: `/Users/super/Documents/GitHub/dssp/packages/dkpi/server/service/kpi/kpi-query.ts`
|
|
@@ -86,175 +86,173 @@ let KpiSingleBoxplotChart = class KpiSingleBoxplotChart extends LitElement {
|
|
|
86
86
|
.attr('transform', `translate(${margin}, ${margin})`);
|
|
87
87
|
if (this.vertical) {
|
|
88
88
|
// 세로형 boxplot (기본)
|
|
89
|
-
this.drawVerticalBoxplot(g, plotW, plotH
|
|
89
|
+
this.drawVerticalBoxplot(g, plotW, plotH);
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
92
|
// 가로형 boxplot
|
|
93
|
-
this.drawHorizontalBoxplot(g, plotW, plotH
|
|
93
|
+
this.drawHorizontalBoxplot(g, plotW, plotH);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
drawVerticalBoxplot(g, plotW, plotH
|
|
97
|
-
|
|
96
|
+
drawVerticalBoxplot(g, plotW, plotH) {
|
|
97
|
+
// 박스플롯 도메인은 min/max 통계 범위로 유지
|
|
98
98
|
const y = d3
|
|
99
99
|
.scaleLinear()
|
|
100
|
-
.domain([
|
|
101
|
-
.nice()
|
|
100
|
+
.domain([this.data[this.minKey], this.data[this.maxKey]])
|
|
102
101
|
.range([plotH, 0]);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
// 현재값이 범위를 벗어나면 도메인 확장
|
|
103
|
+
if (this.data[this.valueKey] != null) {
|
|
104
|
+
const currentValue = this.data[this.valueKey];
|
|
105
|
+
if (currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]) {
|
|
106
|
+
const allValues = [this.data[this.minKey], this.data[this.maxKey], currentValue];
|
|
107
|
+
y.domain([Math.min(...allValues), Math.max(...allValues)]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const boxWidth = Math.min(plotW * 0.6, 80);
|
|
111
|
+
const centerX = plotW / 2;
|
|
112
|
+
// 박스 (Q1 ~ Q3)
|
|
113
|
+
const boxHeight = y(this.data[this.q1Key]) - y(this.data[this.q3Key]);
|
|
112
114
|
g.append('rect')
|
|
113
|
-
.attr('x',
|
|
114
|
-
.attr('y', y(
|
|
115
|
+
.attr('x', centerX - boxWidth / 2)
|
|
116
|
+
.attr('y', y(this.data[this.q3Key]))
|
|
115
117
|
.attr('width', boxWidth)
|
|
116
|
-
.attr('height',
|
|
117
|
-
.attr('fill',
|
|
118
|
-
.attr('opacity', 0.
|
|
119
|
-
.attr('stroke', '#
|
|
118
|
+
.attr('height', boxHeight)
|
|
119
|
+
.attr('fill', '#B3D4FC')
|
|
120
|
+
.attr('opacity', 0.8)
|
|
121
|
+
.attr('stroke', '#7BB3F0')
|
|
120
122
|
.attr('stroke-width', 1);
|
|
121
|
-
// 중앙선(
|
|
123
|
+
// 중앙선 (Median)
|
|
122
124
|
g.append('line')
|
|
123
|
-
.attr('x1',
|
|
124
|
-
.attr('x2',
|
|
125
|
+
.attr('x1', centerX - boxWidth / 2)
|
|
126
|
+
.attr('x2', centerX + boxWidth / 2)
|
|
125
127
|
.attr('y1', y(this.data[this.medianKey]))
|
|
126
128
|
.attr('y2', y(this.data[this.medianKey]))
|
|
127
|
-
.attr('stroke', '#
|
|
128
|
-
.attr('stroke-width',
|
|
129
|
-
// 수염
|
|
130
|
-
|
|
129
|
+
.attr('stroke', '#7BB3F0')
|
|
130
|
+
.attr('stroke-width', 1.5);
|
|
131
|
+
// 위쪽 수염 (Q3 ~ Max)
|
|
132
|
+
g.append('line')
|
|
133
|
+
.attr('x1', centerX)
|
|
134
|
+
.attr('x2', centerX)
|
|
135
|
+
.attr('y1', y(this.data[this.q3Key]))
|
|
136
|
+
.attr('y2', y(this.data[this.maxKey]))
|
|
137
|
+
.attr('stroke', '#7BB3F0')
|
|
138
|
+
.attr('stroke-width', 1);
|
|
139
|
+
// 아래쪽 수염 (Min ~ Q1)
|
|
131
140
|
g.append('line')
|
|
132
141
|
.attr('x1', centerX)
|
|
133
142
|
.attr('x2', centerX)
|
|
134
|
-
.attr('y1', y(
|
|
135
|
-
.attr('y2', y(
|
|
136
|
-
.attr('stroke', '#
|
|
143
|
+
.attr('y1', y(this.data[this.minKey]))
|
|
144
|
+
.attr('y2', y(this.data[this.q1Key]))
|
|
145
|
+
.attr('stroke', '#7BB3F0')
|
|
137
146
|
.attr('stroke-width', 1);
|
|
138
|
-
//
|
|
139
|
-
const capWidth = boxWidth
|
|
147
|
+
// Max 캡
|
|
148
|
+
const capWidth = boxWidth * 0.6;
|
|
140
149
|
g.append('line')
|
|
141
150
|
.attr('x1', centerX - capWidth / 2)
|
|
142
151
|
.attr('x2', centerX + capWidth / 2)
|
|
143
|
-
.attr('y1', y(
|
|
144
|
-
.attr('y2', y(
|
|
145
|
-
.attr('stroke', '#
|
|
152
|
+
.attr('y1', y(this.data[this.maxKey]))
|
|
153
|
+
.attr('y2', y(this.data[this.maxKey]))
|
|
154
|
+
.attr('stroke', '#7BB3F0')
|
|
146
155
|
.attr('stroke-width', 1);
|
|
156
|
+
// Min 캡
|
|
147
157
|
g.append('line')
|
|
148
158
|
.attr('x1', centerX - capWidth / 2)
|
|
149
159
|
.attr('x2', centerX + capWidth / 2)
|
|
150
|
-
.attr('y1', y(
|
|
151
|
-
.attr('y2', y(
|
|
152
|
-
.attr('stroke', '#
|
|
160
|
+
.attr('y1', y(this.data[this.minKey]))
|
|
161
|
+
.attr('y2', y(this.data[this.minKey]))
|
|
162
|
+
.attr('stroke', '#7BB3F0')
|
|
153
163
|
.attr('stroke-width', 1);
|
|
154
|
-
// Outliers
|
|
155
|
-
if (this.data[this.minKey] < lowerFence) {
|
|
156
|
-
g.append('circle')
|
|
157
|
-
.attr('cx', centerX)
|
|
158
|
-
.attr('cy', y(this.data[this.minKey]))
|
|
159
|
-
.attr('r', 4.5)
|
|
160
|
-
.attr('fill', '#ff4444');
|
|
161
|
-
}
|
|
162
|
-
if (this.data[this.maxKey] > upperFence) {
|
|
163
|
-
g.append('circle')
|
|
164
|
-
.attr('cx', centerX)
|
|
165
|
-
.attr('cy', y(this.data[this.maxKey]))
|
|
166
|
-
.attr('r', 4.5)
|
|
167
|
-
.attr('fill', '#ff4444');
|
|
168
|
-
}
|
|
169
164
|
// 현재값 (있는 경우)
|
|
170
165
|
if (this.data[this.valueKey] != null) {
|
|
166
|
+
const currentValue = this.data[this.valueKey];
|
|
167
|
+
const isOutlier = currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey];
|
|
171
168
|
g.append('circle')
|
|
172
169
|
.attr('cx', centerX)
|
|
173
|
-
.attr('cy', y(
|
|
170
|
+
.attr('cy', y(currentValue))
|
|
174
171
|
.attr('r', 3)
|
|
175
|
-
.attr('fill', '#ff4444')
|
|
172
|
+
.attr('fill', isOutlier ? '#ff4444' : '#4CAF50')
|
|
173
|
+
.attr('stroke', '#fff')
|
|
174
|
+
.attr('stroke-width', 1);
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
drawHorizontalBoxplot(g, plotW, plotH
|
|
179
|
-
|
|
177
|
+
drawHorizontalBoxplot(g, plotW, plotH) {
|
|
178
|
+
// 박스플롯 도메인은 min/max 통계 범위로 유지
|
|
180
179
|
const x = d3
|
|
181
180
|
.scaleLinear()
|
|
182
|
-
.domain([
|
|
183
|
-
.nice()
|
|
181
|
+
.domain([this.data[this.minKey], this.data[this.maxKey]])
|
|
184
182
|
.range([0, plotW]);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
183
|
+
// 현재값이 범위를 벗어나면 도메인 확장
|
|
184
|
+
if (this.data[this.valueKey] != null) {
|
|
185
|
+
const currentValue = this.data[this.valueKey];
|
|
186
|
+
if (currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]) {
|
|
187
|
+
const allValues = [this.data[this.minKey], this.data[this.maxKey], currentValue];
|
|
188
|
+
x.domain([Math.min(...allValues), Math.max(...allValues)]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const boxHeight = Math.min(plotH * 0.6, 80);
|
|
192
|
+
const centerY = plotH / 2;
|
|
193
|
+
// 박스 (Q1 ~ Q3)
|
|
194
|
+
const boxWidth = x(this.data[this.q3Key]) - x(this.data[this.q1Key]);
|
|
194
195
|
g.append('rect')
|
|
195
|
-
.attr('x', x(
|
|
196
|
-
.attr('y',
|
|
197
|
-
.attr('width',
|
|
196
|
+
.attr('x', x(this.data[this.q1Key]))
|
|
197
|
+
.attr('y', centerY - boxHeight / 2)
|
|
198
|
+
.attr('width', boxWidth)
|
|
198
199
|
.attr('height', boxHeight)
|
|
199
|
-
.attr('fill',
|
|
200
|
-
.attr('opacity', 0.
|
|
201
|
-
.attr('stroke', '#
|
|
200
|
+
.attr('fill', '#B3D4FC')
|
|
201
|
+
.attr('opacity', 0.8)
|
|
202
|
+
.attr('stroke', '#7BB3F0')
|
|
202
203
|
.attr('stroke-width', 1);
|
|
203
|
-
// 중앙선 (
|
|
204
|
+
// 중앙선 (Median)
|
|
204
205
|
g.append('line')
|
|
205
206
|
.attr('x1', x(this.data[this.medianKey]))
|
|
206
207
|
.attr('x2', x(this.data[this.medianKey]))
|
|
207
|
-
.attr('y1',
|
|
208
|
-
.attr('y2',
|
|
209
|
-
.attr('stroke', '#
|
|
210
|
-
.attr('stroke-width',
|
|
211
|
-
// 수염 (
|
|
212
|
-
|
|
208
|
+
.attr('y1', centerY - boxHeight / 2)
|
|
209
|
+
.attr('y2', centerY + boxHeight / 2)
|
|
210
|
+
.attr('stroke', '#7BB3F0')
|
|
211
|
+
.attr('stroke-width', 1.5);
|
|
212
|
+
// 왼쪽 수염 (Min ~ Q1)
|
|
213
|
+
g.append('line')
|
|
214
|
+
.attr('x1', x(this.data[this.minKey]))
|
|
215
|
+
.attr('x2', x(this.data[this.q1Key]))
|
|
216
|
+
.attr('y1', centerY)
|
|
217
|
+
.attr('y2', centerY)
|
|
218
|
+
.attr('stroke', '#7BB3F0')
|
|
219
|
+
.attr('stroke-width', 1);
|
|
220
|
+
// 오른쪽 수염 (Q3 ~ Max)
|
|
213
221
|
g.append('line')
|
|
214
|
-
.attr('x1', x(
|
|
215
|
-
.attr('x2', x(
|
|
222
|
+
.attr('x1', x(this.data[this.q3Key]))
|
|
223
|
+
.attr('x2', x(this.data[this.maxKey]))
|
|
216
224
|
.attr('y1', centerY)
|
|
217
225
|
.attr('y2', centerY)
|
|
218
|
-
.attr('stroke', '#
|
|
226
|
+
.attr('stroke', '#7BB3F0')
|
|
219
227
|
.attr('stroke-width', 1);
|
|
220
|
-
//
|
|
221
|
-
const capHeight = boxHeight
|
|
228
|
+
// Min 캡
|
|
229
|
+
const capHeight = boxHeight * 0.6;
|
|
222
230
|
g.append('line')
|
|
223
|
-
.attr('x1', x(
|
|
224
|
-
.attr('x2', x(
|
|
231
|
+
.attr('x1', x(this.data[this.minKey]))
|
|
232
|
+
.attr('x2', x(this.data[this.minKey]))
|
|
225
233
|
.attr('y1', centerY - capHeight / 2)
|
|
226
234
|
.attr('y2', centerY + capHeight / 2)
|
|
227
|
-
.attr('stroke', '#
|
|
235
|
+
.attr('stroke', '#7BB3F0')
|
|
228
236
|
.attr('stroke-width', 1);
|
|
237
|
+
// Max 캡
|
|
229
238
|
g.append('line')
|
|
230
|
-
.attr('x1', x(
|
|
231
|
-
.attr('x2', x(
|
|
239
|
+
.attr('x1', x(this.data[this.maxKey]))
|
|
240
|
+
.attr('x2', x(this.data[this.maxKey]))
|
|
232
241
|
.attr('y1', centerY - capHeight / 2)
|
|
233
242
|
.attr('y2', centerY + capHeight / 2)
|
|
234
|
-
.attr('stroke', '#
|
|
243
|
+
.attr('stroke', '#7BB3F0')
|
|
235
244
|
.attr('stroke-width', 1);
|
|
236
|
-
//
|
|
237
|
-
if (this.data[this.minKey] < lowerFence) {
|
|
238
|
-
g.append('circle')
|
|
239
|
-
.attr('cx', x(this.data[this.minKey]))
|
|
240
|
-
.attr('cy', centerY)
|
|
241
|
-
.attr('r', 4.5)
|
|
242
|
-
.attr('fill', '#ff4444');
|
|
243
|
-
}
|
|
244
|
-
if (this.data[this.maxKey] > upperFence) {
|
|
245
|
-
g.append('circle')
|
|
246
|
-
.attr('cx', x(this.data[this.maxKey]))
|
|
247
|
-
.attr('cy', centerY)
|
|
248
|
-
.attr('r', 4.5)
|
|
249
|
-
.attr('fill', '#ff4444');
|
|
250
|
-
}
|
|
251
|
-
// 현재값 (가로)
|
|
245
|
+
// 현재값 (있는 경우)
|
|
252
246
|
if (this.data[this.valueKey] != null) {
|
|
247
|
+
const currentValue = this.data[this.valueKey];
|
|
248
|
+
const isOutlier = currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey];
|
|
253
249
|
g.append('circle')
|
|
254
|
-
.attr('cx', x(
|
|
250
|
+
.attr('cx', x(currentValue))
|
|
255
251
|
.attr('cy', centerY)
|
|
256
252
|
.attr('r', 3)
|
|
257
|
-
.attr('fill', '#ff4444')
|
|
253
|
+
.attr('fill', isOutlier ? '#ff4444' : '#4CAF50')
|
|
254
|
+
.attr('stroke', '#fff')
|
|
255
|
+
.attr('stroke-width', 1);
|
|
258
256
|
}
|
|
259
257
|
}
|
|
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B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAA0B;AACxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;uDAAyB;AAV1C,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CA6SjC","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('kpi-single-boxplot-chart')\nexport class KpiSingleBoxplotChart extends LitElement {\n @property({ type: Object }) data: any = {}\n @property({ type: String }) minKey: string = 'min'\n @property({ type: String }) maxKey: string = 'max'\n @property({ type: String }) meanKey: string = 'mean'\n @property({ type: String }) medianKey: string = 'median'\n @property({ type: String }) q1Key: string = 'q1'\n @property({ type: String }) q3Key: string = 'q3'\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) color: string = '#2196f3'\n @property({ type: Boolean }) vertical: boolean = true // true: 세로형, false: 가로형\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`\n <svg\n id=\"single-boxplot\"\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\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.drawSingleBoxplot()\n }\n\n private drawSingleBoxplot() {\n const svg = d3.select(this.renderRoot.querySelector('#single-boxplot'))\n svg.selectAll('*').remove()\n\n // 데이터 검증\n if (!this.data || Object.keys(this.data).length === 0) {\n return\n }\n\n const w = this.chartWidth || 200\n const h = this.chartHeight || 200\n const margin = 20\n const plotW = w - margin * 2\n const plotH = h - margin * 2\n\n // 필수 필드 검증\n const requiredFields = [this.minKey, this.maxKey, this.q1Key, this.q3Key, this.medianKey, this.meanKey]\n const missingFields = requiredFields.filter(field => this.data[field] == null)\n if (missingFields.length > 0) {\n console.warn('Missing required fields:', missingFields)\n return\n }\n\n const values = [\n this.data[this.minKey],\n this.data[this.maxKey],\n this.data[this.q1Key],\n this.data[this.q3Key],\n this.data[this.medianKey],\n this.data[this.meanKey]\n ]\n\n if (this.data[this.valueKey] != null) {\n values.push(this.data[this.valueKey])\n }\n\n const g = svg\n .attr('width', w)\n .attr('height', h)\n .append('g')\n .attr('transform', `translate(${margin}, ${margin})`)\n\n if (this.vertical) {\n // 세로형 boxplot (기본)\n this.drawVerticalBoxplot(g, plotW, plotH, values)\n } else {\n // 가로형 boxplot\n this.drawHorizontalBoxplot(g, plotW, plotH, values)\n }\n }\n\n private drawVerticalBoxplot(g: any, plotW: number, plotH: number, values: number[]) {\n const y = d3\n .scaleLinear()\n .domain([d3.min(values) ?? 0, d3.max(values) ?? 1])\n .nice()\n .range([plotH, 0])\n\n const boxWidth = Math.min(plotW * 0.6, 60) // 박스 너비 제한\n const boxX = (plotW - boxWidth) / 2 // 중앙 정렬\n\n // Outlier 계산\n const iqr = this.data[this.q3Key] - this.data[this.q1Key]\n const lowerFence = this.data[this.q1Key] - 1.5 * iqr\n const upperFence = this.data[this.q3Key] + 1.5 * iqr\n\n const actualMin = Math.max(this.data[this.minKey], lowerFence)\n const actualMax = Math.min(this.data[this.maxKey], upperFence)\n\n // 박스\n g.append('rect')\n .attr('x', boxX)\n .attr('y', y(Math.max(this.data[this.q1Key], this.data[this.q3Key])))\n .attr('width', boxWidth)\n .attr('height', Math.abs(y(this.data[this.q1Key]) - y(this.data[this.q3Key])))\n .attr('fill', this.color)\n .attr('opacity', 0.6)\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // 중앙선(중앙값)\n g.append('line')\n .attr('x1', boxX)\n .attr('x2', boxX + boxWidth)\n .attr('y1', y(this.data[this.medianKey]))\n .attr('y2', y(this.data[this.medianKey]))\n .attr('stroke', '#333')\n .attr('stroke-width', 2)\n\n // 수염\n const centerX = boxX + boxWidth / 2\n g.append('line')\n .attr('x1', centerX)\n .attr('x2', centerX)\n .attr('y1', y(actualMin))\n .attr('y2', y(actualMax))\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // min/max 선\n const capWidth = boxWidth / 3\n g.append('line')\n .attr('x1', centerX - capWidth / 2)\n .attr('x2', centerX + capWidth / 2)\n .attr('y1', y(actualMin))\n .attr('y2', y(actualMin))\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n g.append('line')\n .attr('x1', centerX - capWidth / 2)\n .attr('x2', centerX + capWidth / 2)\n .attr('y1', y(actualMax))\n .attr('y2', y(actualMax))\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // Outliers\n if (this.data[this.minKey] < lowerFence) {\n g.append('circle')\n .attr('cx', centerX)\n .attr('cy', y(this.data[this.minKey]))\n .attr('r', 4.5)\n .attr('fill', '#ff4444')\n }\n\n if (this.data[this.maxKey] > upperFence) {\n g.append('circle')\n .attr('cx', centerX)\n .attr('cy', y(this.data[this.maxKey]))\n .attr('r', 4.5)\n .attr('fill', '#ff4444')\n }\n\n\n // 현재값 (있는 경우)\n if (this.data[this.valueKey] != null) {\n g.append('circle')\n .attr('cx', centerX)\n .attr('cy', y(this.data[this.valueKey]))\n .attr('r', 3)\n .attr('fill', '#ff4444')\n }\n }\n\n private drawHorizontalBoxplot(g: any, plotW: number, plotH: number, values: number[]) {\n const x = d3\n .scaleLinear()\n .domain([d3.min(values) ?? 0, d3.max(values) ?? 1])\n .nice()\n .range([0, plotW])\n\n const boxHeight = Math.min(plotH * 0.6, 60)\n const boxY = (plotH - boxHeight) / 2\n\n // Outlier 계산\n const iqr = this.data[this.q3Key] - this.data[this.q1Key]\n const lowerFence = this.data[this.q1Key] - 1.5 * iqr\n const upperFence = this.data[this.q3Key] + 1.5 * iqr\n\n const actualMin = Math.max(this.data[this.minKey], lowerFence)\n const actualMax = Math.min(this.data[this.maxKey], upperFence)\n\n // 박스 (가로)\n g.append('rect')\n .attr('x', x(Math.min(this.data[this.q1Key], this.data[this.q3Key])))\n .attr('y', boxY)\n .attr('width', Math.abs(x(this.data[this.q3Key]) - x(this.data[this.q1Key])))\n .attr('height', boxHeight)\n .attr('fill', this.color)\n .attr('opacity', 0.6)\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // 중앙선 (가로)\n g.append('line')\n .attr('x1', x(this.data[this.medianKey]))\n .attr('x2', x(this.data[this.medianKey]))\n .attr('y1', boxY)\n .attr('y2', boxY + boxHeight)\n .attr('stroke', '#333')\n .attr('stroke-width', 2)\n\n // 수염 (가로)\n const centerY = boxY + boxHeight / 2\n g.append('line')\n .attr('x1', x(actualMin))\n .attr('x2', x(actualMax))\n .attr('y1', centerY)\n .attr('y2', centerY)\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // min/max 선 (가로)\n const capHeight = boxHeight / 3\n g.append('line')\n .attr('x1', x(actualMin))\n .attr('x2', x(actualMin))\n .attr('y1', centerY - capHeight / 2)\n .attr('y2', centerY + capHeight / 2)\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n g.append('line')\n .attr('x1', x(actualMax))\n .attr('x2', x(actualMax))\n .attr('y1', centerY - capHeight / 2)\n .attr('y2', centerY + capHeight / 2)\n .attr('stroke', '#333')\n .attr('stroke-width', 1)\n\n // Outliers (가로)\n if (this.data[this.minKey] < lowerFence) {\n g.append('circle')\n .attr('cx', x(this.data[this.minKey]))\n .attr('cy', centerY)\n .attr('r', 4.5)\n .attr('fill', '#ff4444')\n }\n\n if (this.data[this.maxKey] > upperFence) {\n g.append('circle')\n .attr('cx', x(this.data[this.maxKey]))\n .attr('cy', centerY)\n .attr('r', 4.5)\n .attr('fill', '#ff4444')\n }\n\n\n // 현재값 (가로)\n if (this.data[this.valueKey] != null) {\n g.append('circle')\n .attr('cx', x(this.data[this.valueKey]))\n .attr('cy', centerY)\n .attr('r', 3)\n .attr('fill', '#ff4444')\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"kpi-single-boxplot-chart.js","sourceRoot":"","sources":["../../client/components/kpi-single-boxplot-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,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QACuB,SAAI,GAAQ,EAAE,CAAA;QACd,WAAM,GAAW,KAAK,CAAA;QACtB,WAAM,GAAW,KAAK,CAAA;QACtB,YAAO,GAAW,MAAM,CAAA;QACxB,cAAS,GAAW,QAAQ,CAAA;QAC5B,UAAK,GAAW,IAAI,CAAA;QACpB,UAAK,GAAW,IAAI,CAAA;QACpB,aAAQ,GAAW,OAAO,CAAA;QAC1B,UAAK,GAAW,SAAS,CAAA;QACxB,aAAQ,GAAY,IAAI,CAAA,CAAC,wBAAwB;QAetE,eAAU,GAAG,CAAC,CAAA;QACd,gBAAW,GAAG,CAAC,CAAA;IA+QzB,CAAC;IA5QC,MAAM;QACJ,OAAO,IAAI,CAAA;;;gBAGC,I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/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('kpi-single-boxplot-chart')\nexport class KpiSingleBoxplotChart extends LitElement {\n @property({ type: Object }) data: any = {}\n @property({ type: String }) minKey: string = 'min'\n @property({ type: String }) maxKey: string = 'max'\n @property({ type: String }) meanKey: string = 'mean'\n @property({ type: String }) medianKey: string = 'median'\n @property({ type: String }) q1Key: string = 'q1'\n @property({ type: String }) q3Key: string = 'q3'\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) color: string = '#2196f3'\n @property({ type: Boolean }) vertical: boolean = true // true: 세로형, false: 가로형\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`\n <svg\n id=\"single-boxplot\"\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\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.drawSingleBoxplot()\n }\n\n private drawSingleBoxplot() {\n const svg = d3.select(this.renderRoot.querySelector('#single-boxplot'))\n svg.selectAll('*').remove()\n\n // 데이터 검증\n if (!this.data || Object.keys(this.data).length === 0) {\n return\n }\n\n const w = this.chartWidth || 200\n const h = this.chartHeight || 200\n const margin = 20\n const plotW = w - margin * 2\n const plotH = h - margin * 2\n\n // 필수 필드 검증\n const requiredFields = [this.minKey, this.maxKey, this.q1Key, this.q3Key, this.medianKey, this.meanKey]\n const missingFields = requiredFields.filter(field => this.data[field] == null)\n if (missingFields.length > 0) {\n console.warn('Missing required fields:', missingFields)\n return\n }\n\n const values = [\n this.data[this.minKey],\n this.data[this.maxKey],\n this.data[this.q1Key],\n this.data[this.q3Key],\n this.data[this.medianKey],\n this.data[this.meanKey]\n ]\n\n if (this.data[this.valueKey] != null) {\n values.push(this.data[this.valueKey])\n }\n\n const g = svg\n .attr('width', w)\n .attr('height', h)\n .append('g')\n .attr('transform', `translate(${margin}, ${margin})`)\n\n if (this.vertical) {\n // 세로형 boxplot (기본)\n this.drawVerticalBoxplot(g, plotW, plotH)\n } else {\n // 가로형 boxplot\n this.drawHorizontalBoxplot(g, plotW, plotH)\n }\n }\n\n private drawVerticalBoxplot(g: any, plotW: number, plotH: number) {\n // 박스플롯 도메인은 min/max 통계 범위로 유지\n const y = d3\n .scaleLinear()\n .domain([this.data[this.minKey], this.data[this.maxKey]])\n .range([plotH, 0])\n\n // 현재값이 범위를 벗어나면 도메인 확장\n if (this.data[this.valueKey] != null) {\n const currentValue = this.data[this.valueKey]\n if (currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]) {\n const allValues = [this.data[this.minKey], this.data[this.maxKey], currentValue]\n y.domain([Math.min(...allValues), Math.max(...allValues)])\n }\n }\n\n const boxWidth = Math.min(plotW * 0.6, 80)\n const centerX = plotW / 2\n\n // 박스 (Q1 ~ Q3)\n const boxHeight = y(this.data[this.q1Key]) - y(this.data[this.q3Key])\n g.append('rect')\n .attr('x', centerX - boxWidth / 2)\n .attr('y', y(this.data[this.q3Key]))\n .attr('width', boxWidth)\n .attr('height', boxHeight)\n .attr('fill', '#B3D4FC')\n .attr('opacity', 0.8)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 중앙선 (Median)\n g.append('line')\n .attr('x1', centerX - boxWidth / 2)\n .attr('x2', centerX + boxWidth / 2)\n .attr('y1', y(this.data[this.medianKey]))\n .attr('y2', y(this.data[this.medianKey]))\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1.5)\n\n // 위쪽 수염 (Q3 ~ Max)\n g.append('line')\n .attr('x1', centerX)\n .attr('x2', centerX)\n .attr('y1', y(this.data[this.q3Key]))\n .attr('y2', y(this.data[this.maxKey]))\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 아래쪽 수염 (Min ~ Q1)\n g.append('line')\n .attr('x1', centerX)\n .attr('x2', centerX)\n .attr('y1', y(this.data[this.minKey]))\n .attr('y2', y(this.data[this.q1Key]))\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // Max 캡\n const capWidth = boxWidth * 0.6\n g.append('line')\n .attr('x1', centerX - capWidth / 2)\n .attr('x2', centerX + capWidth / 2)\n .attr('y1', y(this.data[this.maxKey]))\n .attr('y2', y(this.data[this.maxKey]))\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // Min 캡\n g.append('line')\n .attr('x1', centerX - capWidth / 2)\n .attr('x2', centerX + capWidth / 2)\n .attr('y1', y(this.data[this.minKey]))\n .attr('y2', y(this.data[this.minKey]))\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 현재값 (있는 경우)\n if (this.data[this.valueKey] != null) {\n const currentValue = this.data[this.valueKey]\n const isOutlier = currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]\n\n g.append('circle')\n .attr('cx', centerX)\n .attr('cy', y(currentValue))\n .attr('r', 3)\n .attr('fill', isOutlier ? '#ff4444' : '#4CAF50')\n .attr('stroke', '#fff')\n .attr('stroke-width', 1)\n }\n }\n\n private drawHorizontalBoxplot(g: any, plotW: number, plotH: number) {\n // 박스플롯 도메인은 min/max 통계 범위로 유지\n const x = d3\n .scaleLinear()\n .domain([this.data[this.minKey], this.data[this.maxKey]])\n .range([0, plotW])\n\n // 현재값이 범위를 벗어나면 도메인 확장\n if (this.data[this.valueKey] != null) {\n const currentValue = this.data[this.valueKey]\n if (currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]) {\n const allValues = [this.data[this.minKey], this.data[this.maxKey], currentValue]\n x.domain([Math.min(...allValues), Math.max(...allValues)])\n }\n }\n\n const boxHeight = Math.min(plotH * 0.6, 80)\n const centerY = plotH / 2\n\n // 박스 (Q1 ~ Q3)\n const boxWidth = x(this.data[this.q3Key]) - x(this.data[this.q1Key])\n g.append('rect')\n .attr('x', x(this.data[this.q1Key]))\n .attr('y', centerY - boxHeight / 2)\n .attr('width', boxWidth)\n .attr('height', boxHeight)\n .attr('fill', '#B3D4FC')\n .attr('opacity', 0.8)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 중앙선 (Median)\n g.append('line')\n .attr('x1', x(this.data[this.medianKey]))\n .attr('x2', x(this.data[this.medianKey]))\n .attr('y1', centerY - boxHeight / 2)\n .attr('y2', centerY + boxHeight / 2)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1.5)\n\n // 왼쪽 수염 (Min ~ Q1)\n g.append('line')\n .attr('x1', x(this.data[this.minKey]))\n .attr('x2', x(this.data[this.q1Key]))\n .attr('y1', centerY)\n .attr('y2', centerY)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 오른쪽 수염 (Q3 ~ Max)\n g.append('line')\n .attr('x1', x(this.data[this.q3Key]))\n .attr('x2', x(this.data[this.maxKey]))\n .attr('y1', centerY)\n .attr('y2', centerY)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // Min 캡\n const capHeight = boxHeight * 0.6\n g.append('line')\n .attr('x1', x(this.data[this.minKey]))\n .attr('x2', x(this.data[this.minKey]))\n .attr('y1', centerY - capHeight / 2)\n .attr('y2', centerY + capHeight / 2)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // Max 캡\n g.append('line')\n .attr('x1', x(this.data[this.maxKey]))\n .attr('x2', x(this.data[this.maxKey]))\n .attr('y1', centerY - capHeight / 2)\n .attr('y2', centerY + capHeight / 2)\n .attr('stroke', '#7BB3F0')\n .attr('stroke-width', 1)\n\n // 현재값 (있는 경우)\n if (this.data[this.valueKey] != null) {\n const currentValue = this.data[this.valueKey]\n const isOutlier = currentValue < this.data[this.minKey] || currentValue > this.data[this.maxKey]\n\n g.append('circle')\n .attr('cx', x(currentValue))\n .attr('cy', centerY)\n .attr('r', 3)\n .attr('fill', isOutlier ? '#ff4444' : '#4CAF50')\n .attr('stroke', '#fff')\n .attr('stroke-width', 1)\n }\n }\n}"]}
|
|
@@ -12,13 +12,16 @@ export declare class SvProjectCompletedListPage extends SvProjectCompletedListPa
|
|
|
12
12
|
private projectList;
|
|
13
13
|
private projectCount;
|
|
14
14
|
private currentPage;
|
|
15
|
+
private kpiBoxPlotStats;
|
|
15
16
|
private readonly pageLimit;
|
|
16
17
|
get totalPages(): number;
|
|
17
18
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
19
|
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
19
20
|
getProjectList(): Promise<void>;
|
|
21
|
+
getKpiBoxPlotStats(): Promise<void>;
|
|
20
22
|
private _onInputChange;
|
|
21
23
|
private _onKeypress;
|
|
22
24
|
private _changePage;
|
|
25
|
+
private getBoxPlotDataForProject;
|
|
23
26
|
}
|
|
24
27
|
export {};
|