@opsnow-mcp/opsnow-mcp-common-ui-server 1.0.41 → 1.0.43
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/build/components/examples/opsnow-common-chart-examples-data.js +1016 -408
- package/build/components/examples/opsnow-common-grid-examples-data.js +83 -112
- package/build/components/examples/opsnow-common-select-examples-data.js +16 -0
- package/build/components/examples/opsnow-common-tab-examples-data.js +37 -0
- package/build/components/opsnow-common-chart.js +312 -42
- package/build/components/opsnow-common-grid.js +53 -50
- package/build/components/opsnow-common-select.js +5 -3
- package/build/components/opsnow-common-tab.js +21 -0
- package/build/components/opsnow-common-validate-props.js +0 -0
- package/build/index.js +41 -0
- package/package.json +1 -1
|
@@ -573,20 +573,6 @@ export const BarChartExamples = [
|
|
|
573
573
|
const [chartProps, setChartProps] = useState({
|
|
574
574
|
xAxis: {
|
|
575
575
|
type: 'date',
|
|
576
|
-
dateFormats: [
|
|
577
|
-
{
|
|
578
|
-
type: 'day',
|
|
579
|
-
dateFormat: '{l.month.day.format}'
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
type: 'week',
|
|
583
|
-
dateFormat: '{l.month.day.format}'
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
type: 'month',
|
|
587
|
-
dateFormat: '{l.month.day.format}'
|
|
588
|
-
}
|
|
589
|
-
],
|
|
590
576
|
baseInterval: {
|
|
591
577
|
timeUnit: 'day',
|
|
592
578
|
count: 1
|
|
@@ -693,20 +679,6 @@ export const BarChartExamples = [
|
|
|
693
679
|
const [chartProps, setChartProps] = useState({
|
|
694
680
|
xAxis: {
|
|
695
681
|
type: 'date',
|
|
696
|
-
dateFormats: [
|
|
697
|
-
{
|
|
698
|
-
type: 'day',
|
|
699
|
-
dateFormat: 'MM/dd'
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
type: 'week',
|
|
703
|
-
dateFormat: 'MM/dd'
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
type: 'month',
|
|
707
|
-
dateFormat: 'MM/dd'
|
|
708
|
-
}
|
|
709
|
-
],
|
|
710
682
|
baseInterval: {
|
|
711
683
|
timeUnit: 'day',
|
|
712
684
|
count: 1
|
|
@@ -774,6 +746,74 @@ export const BarChartExamples = [
|
|
|
774
746
|
onChartClick={selectItem}
|
|
775
747
|
/>`
|
|
776
748
|
},
|
|
749
|
+
{
|
|
750
|
+
title: '바 차트 - 클릭한 막대 색상 강조 (columns.click: clickColor / unClickColor / defaultPosition)',
|
|
751
|
+
description: '바 차트 - 클릭한 막대만 강조 색으로, 나머지는 회색으로 칠하는 예제입니다. series.columns.click 에 clickColor·unClickColor 를 주고, defaultPosition: "end" 로 처음에 마지막 막대를 선택 상태로 둡니다. 카테고리가 1개인 차트에서 사용합니다.',
|
|
752
|
+
code_props_usage: `
|
|
753
|
+
const chartId = 'bar-chart-${generateUniqueGeneralId()}'
|
|
754
|
+
const chartRef = useRef(null)
|
|
755
|
+
const [chartProps, setChartProps] = useState({
|
|
756
|
+
xAxis: {
|
|
757
|
+
type: 'date',
|
|
758
|
+
baseInterval: {
|
|
759
|
+
timeUnit: 'day',
|
|
760
|
+
count: 1
|
|
761
|
+
},
|
|
762
|
+
gridHidden: true
|
|
763
|
+
},
|
|
764
|
+
yAxis: {
|
|
765
|
+
type: 'value'
|
|
766
|
+
},
|
|
767
|
+
series: {
|
|
768
|
+
valueXField: 'date',
|
|
769
|
+
fill: '#B0B6BD',
|
|
770
|
+
cursorOverStyle: 'pointer',
|
|
771
|
+
dataProcessor: {
|
|
772
|
+
dateFields: ['date'],
|
|
773
|
+
dateFormat: 'yyyy-MM-dd'
|
|
774
|
+
},
|
|
775
|
+
columns: {
|
|
776
|
+
width: 'p50',
|
|
777
|
+
click: {
|
|
778
|
+
unClickColor: '#B0B6BD', // 선택되지 않은 막대 색상
|
|
779
|
+
clickColor: '#086CE8', // 클릭(선택)된 막대 색상
|
|
780
|
+
defaultPosition: 'end' // 처음에 마지막 막대를 선택 상태로 (생략 시 첫 번째 막대)
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
tooltip: {
|
|
784
|
+
type: 'CI',
|
|
785
|
+
body: {
|
|
786
|
+
name: '{name}',
|
|
787
|
+
value: '\${valueY.formatNumber("0.00")}',
|
|
788
|
+
useMarker: true
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
legend: {
|
|
793
|
+
useExtension: false
|
|
794
|
+
}
|
|
795
|
+
})
|
|
796
|
+
const [chartData, setChartData] = useState([
|
|
797
|
+
{ 'date': '2023-02-25', 'chartValue': 800 },
|
|
798
|
+
{ 'date': '2023-02-26', 'chartValue': 900 },
|
|
799
|
+
{ 'date': '2023-02-27', 'chartValue': 1000 },
|
|
800
|
+
{ 'date': '2023-02-28', 'chartValue': 1100 }
|
|
801
|
+
])
|
|
802
|
+
const [chartCategory, setChartCategory] = useState(['chartValue'])
|
|
803
|
+
|
|
804
|
+
const selectItem = (obj) => {
|
|
805
|
+
console.log(obj)
|
|
806
|
+
}
|
|
807
|
+
`,
|
|
808
|
+
code: `<OpsnowCommonBarChart
|
|
809
|
+
chartId={chartId}
|
|
810
|
+
ref={chartRef}
|
|
811
|
+
chartProps={chartProps}
|
|
812
|
+
chartData={chartData}
|
|
813
|
+
chartCategory={chartCategory}
|
|
814
|
+
onChartClick={selectItem}
|
|
815
|
+
/>`
|
|
816
|
+
},
|
|
777
817
|
{
|
|
778
818
|
title: '바 차트 - Group Tooltip',
|
|
779
819
|
description: '바 차트 - 그룹 툴팁 데이터 예제입니다.',
|
|
@@ -783,20 +823,6 @@ export const BarChartExamples = [
|
|
|
783
823
|
const [chartProps, setChartProps] = useState({
|
|
784
824
|
xAxis: {
|
|
785
825
|
type: 'date',
|
|
786
|
-
dateFormats: [
|
|
787
|
-
{
|
|
788
|
-
type: 'day',
|
|
789
|
-
dateFormat: 'MM/dd'
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
type: 'week',
|
|
793
|
-
dateFormat: 'MM/dd'
|
|
794
|
-
},
|
|
795
|
-
{
|
|
796
|
-
type: 'month',
|
|
797
|
-
dateFormat: 'MM/dd'
|
|
798
|
-
}
|
|
799
|
-
],
|
|
800
826
|
baseInterval: {
|
|
801
827
|
timeUnit: 'day',
|
|
802
828
|
count: 1
|
|
@@ -876,20 +902,6 @@ export const BarChartExamples = [
|
|
|
876
902
|
const [chartProps, setChartProps] = useState({
|
|
877
903
|
xAxis: {
|
|
878
904
|
type: 'date',
|
|
879
|
-
dateFormats: [
|
|
880
|
-
{
|
|
881
|
-
type: 'day',
|
|
882
|
-
dateFormat: 'MM/dd'
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
type: 'week',
|
|
886
|
-
dateFormat: 'MM/dd'
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
type: 'month',
|
|
890
|
-
dateFormat: 'MM/dd'
|
|
891
|
-
}
|
|
892
|
-
],
|
|
893
905
|
baseInterval: {
|
|
894
906
|
timeUnit: 'day',
|
|
895
907
|
count: 1
|
|
@@ -1113,16 +1125,6 @@ export const BarChartExamples = [
|
|
|
1113
1125
|
const [chartProps, setChartProps] = useState({
|
|
1114
1126
|
xAxis: {
|
|
1115
1127
|
type: 'date',
|
|
1116
|
-
dateFormats: [
|
|
1117
|
-
{
|
|
1118
|
-
type: 'day',
|
|
1119
|
-
dateFormat: 'MM/dd'
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
type: 'month',
|
|
1123
|
-
dateFormat: 'yyyy/MM'
|
|
1124
|
-
}
|
|
1125
|
-
],
|
|
1126
1128
|
baseInterval: {
|
|
1127
1129
|
timeUnit: 'day',
|
|
1128
1130
|
count: 1
|
|
@@ -1241,12 +1243,6 @@ export const BarChartExamples = [
|
|
|
1241
1243
|
xAxis: {
|
|
1242
1244
|
type: 'date',
|
|
1243
1245
|
valueField: 'daySt',
|
|
1244
|
-
dateFormats: [
|
|
1245
|
-
{
|
|
1246
|
-
type: 'day',
|
|
1247
|
-
dateFormat: 'MM/dd'
|
|
1248
|
-
},
|
|
1249
|
-
],
|
|
1250
1246
|
baseInterval: {
|
|
1251
1247
|
timeUnit: 'day',
|
|
1252
1248
|
count: 1
|
|
@@ -1425,20 +1421,6 @@ export const LineChartExamples = [
|
|
|
1425
1421
|
const [chartProps, setChartProps] = useState({
|
|
1426
1422
|
xAxis: {
|
|
1427
1423
|
type: 'date',
|
|
1428
|
-
dateFormats: [
|
|
1429
|
-
{
|
|
1430
|
-
type: 'day',
|
|
1431
|
-
dateFormat: 'MM/dd'
|
|
1432
|
-
},
|
|
1433
|
-
{
|
|
1434
|
-
type: 'week',
|
|
1435
|
-
dateFormat: 'MM/dd'
|
|
1436
|
-
},
|
|
1437
|
-
{
|
|
1438
|
-
type: 'month',
|
|
1439
|
-
dateFormat: 'MM/dd'
|
|
1440
|
-
}
|
|
1441
|
-
],
|
|
1442
1424
|
baseInterval: {
|
|
1443
1425
|
timeUnit: 'day',
|
|
1444
1426
|
count: 1
|
|
@@ -1565,20 +1547,6 @@ export const LineChartExamples = [
|
|
|
1565
1547
|
const [chartProps, setChartProps] = useState({
|
|
1566
1548
|
xAxis: {
|
|
1567
1549
|
type: 'date',
|
|
1568
|
-
dateFormats: [
|
|
1569
|
-
{
|
|
1570
|
-
type: 'day',
|
|
1571
|
-
dateFormat: '{l.month.day.format}'
|
|
1572
|
-
},
|
|
1573
|
-
{
|
|
1574
|
-
type: 'week',
|
|
1575
|
-
dateFormat: '{l.month.day.format}'
|
|
1576
|
-
},
|
|
1577
|
-
{
|
|
1578
|
-
type: 'month',
|
|
1579
|
-
dateFormat: '{l.month.day.format}'
|
|
1580
|
-
}
|
|
1581
|
-
],
|
|
1582
1550
|
baseInterval: {
|
|
1583
1551
|
timeUnit: 'day',
|
|
1584
1552
|
count: 1
|
|
@@ -1686,20 +1654,6 @@ export const LineChartExamples = [
|
|
|
1686
1654
|
const [chartProps, setChartProps] = useState({
|
|
1687
1655
|
xAxis: {
|
|
1688
1656
|
type: 'date',
|
|
1689
|
-
dateFormats: [
|
|
1690
|
-
{
|
|
1691
|
-
type: 'day',
|
|
1692
|
-
dateFormat: 'MM/dd'
|
|
1693
|
-
},
|
|
1694
|
-
{
|
|
1695
|
-
type: 'week',
|
|
1696
|
-
dateFormat: 'MM/dd'
|
|
1697
|
-
},
|
|
1698
|
-
{
|
|
1699
|
-
type: 'month',
|
|
1700
|
-
dateFormat: 'MM/dd'
|
|
1701
|
-
}
|
|
1702
|
-
],
|
|
1703
1657
|
baseInterval: {
|
|
1704
1658
|
timeUnit: 'day',
|
|
1705
1659
|
count: 1
|
|
@@ -1787,20 +1741,6 @@ export const LineChartExamples = [
|
|
|
1787
1741
|
const [chartProps, setChartProps] = useState({
|
|
1788
1742
|
xAxis: {
|
|
1789
1743
|
type: 'date',
|
|
1790
|
-
dateFormats: [
|
|
1791
|
-
{
|
|
1792
|
-
type: 'day',
|
|
1793
|
-
dateFormat: 'MM/dd'
|
|
1794
|
-
},
|
|
1795
|
-
{
|
|
1796
|
-
type: 'week',
|
|
1797
|
-
dateFormat: 'MM/dd'
|
|
1798
|
-
},
|
|
1799
|
-
{
|
|
1800
|
-
type: 'month',
|
|
1801
|
-
dateFormat: 'MM/dd'
|
|
1802
|
-
}
|
|
1803
|
-
],
|
|
1804
1744
|
baseInterval: {
|
|
1805
1745
|
timeUnit: 'day',
|
|
1806
1746
|
count: 1
|
|
@@ -2079,16 +2019,6 @@ export const LineChartExamples = [
|
|
|
2079
2019
|
const [chartProps, setChartProps] = useState({
|
|
2080
2020
|
xAxis: {
|
|
2081
2021
|
type: 'date',
|
|
2082
|
-
dateFormats: [
|
|
2083
|
-
{
|
|
2084
|
-
type: 'day',
|
|
2085
|
-
dateFormat: 'MM/dd'
|
|
2086
|
-
},
|
|
2087
|
-
{
|
|
2088
|
-
type: 'month',
|
|
2089
|
-
dateFormat: 'yyyy/MM'
|
|
2090
|
-
}
|
|
2091
|
-
],
|
|
2092
2022
|
baseInterval: {
|
|
2093
2023
|
timeUnit: 'day',
|
|
2094
2024
|
count: 1
|
|
@@ -2159,7 +2089,7 @@ export const LineChartExamples = [
|
|
|
2159
2089
|
const calcSum = (obj) => {
|
|
2160
2090
|
let sum = 0
|
|
2161
2091
|
for (const p in obj) {
|
|
2162
|
-
if (
|
|
2092
|
+
if (chartCategory.includes(p)) {
|
|
2163
2093
|
sum += Math.floor(obj[p] * 100) / 100
|
|
2164
2094
|
}
|
|
2165
2095
|
}
|
|
@@ -2177,7 +2107,7 @@ export const LineChartExamples = [
|
|
|
2177
2107
|
const total = calcSum(obj)
|
|
2178
2108
|
const result = {sum: '100.00'}
|
|
2179
2109
|
for (const p in obj) {
|
|
2180
|
-
if (
|
|
2110
|
+
if (chartCategory.includes(p)) {
|
|
2181
2111
|
const v = Math.floor(obj[p] * 100) / 100
|
|
2182
2112
|
const ratio = v / total * 100
|
|
2183
2113
|
result[p] = ratio
|
|
@@ -2214,12 +2144,6 @@ export const LineChartExamples = [
|
|
|
2214
2144
|
xAxis: {
|
|
2215
2145
|
type: 'date',
|
|
2216
2146
|
valueField: 'daySt',
|
|
2217
|
-
dateFormats: [
|
|
2218
|
-
{
|
|
2219
|
-
type: 'day',
|
|
2220
|
-
dateFormat: 'MM/dd'
|
|
2221
|
-
},
|
|
2222
|
-
],
|
|
2223
2147
|
baseInterval: {
|
|
2224
2148
|
timeUnit: 'day',
|
|
2225
2149
|
count: 1
|
|
@@ -2317,10 +2241,6 @@ export const LineChartExamples = [
|
|
|
2317
2241
|
},
|
|
2318
2242
|
xAxis: {
|
|
2319
2243
|
type: 'date',
|
|
2320
|
-
dateFormats: [
|
|
2321
|
-
{ type: 'day', dateFormat: 'MM-dd' },
|
|
2322
|
-
{ type: 'month', dateFormat: 'yy-MM' }
|
|
2323
|
-
],
|
|
2324
2244
|
baseInterval: { timeUnit: 'month', count: 1 },
|
|
2325
2245
|
gridHidden: true
|
|
2326
2246
|
},
|
|
@@ -2442,20 +2362,6 @@ export const StackChartExamples = [
|
|
|
2442
2362
|
const [chartProps, setChartProps] = useState({
|
|
2443
2363
|
xAxis: {
|
|
2444
2364
|
type: 'date',
|
|
2445
|
-
dateFormats: [
|
|
2446
|
-
{
|
|
2447
|
-
type: 'day',
|
|
2448
|
-
dateFormat: '{l.month.day.format}'
|
|
2449
|
-
},
|
|
2450
|
-
{
|
|
2451
|
-
type: 'week',
|
|
2452
|
-
dateFormat: '{l.month.day.format}'
|
|
2453
|
-
},
|
|
2454
|
-
{
|
|
2455
|
-
type: 'month',
|
|
2456
|
-
dateFormat: '{l.month.day.format}'
|
|
2457
|
-
}
|
|
2458
|
-
],
|
|
2459
2365
|
baseInterval: {
|
|
2460
2366
|
timeUnit: 'day',
|
|
2461
2367
|
count: 1
|
|
@@ -2557,20 +2463,6 @@ export const StackChartExamples = [
|
|
|
2557
2463
|
const [chartProps, setChartProps] = useState({
|
|
2558
2464
|
xAxis: {
|
|
2559
2465
|
type: 'date',
|
|
2560
|
-
dateFormats: [
|
|
2561
|
-
{
|
|
2562
|
-
type: 'day',
|
|
2563
|
-
dateFormat: 'MM/dd'
|
|
2564
|
-
},
|
|
2565
|
-
{
|
|
2566
|
-
type: 'week',
|
|
2567
|
-
dateFormat: 'MM/dd'
|
|
2568
|
-
},
|
|
2569
|
-
{
|
|
2570
|
-
type: 'month',
|
|
2571
|
-
dateFormat: 'MM/dd'
|
|
2572
|
-
}
|
|
2573
|
-
],
|
|
2574
2466
|
baseInterval: {
|
|
2575
2467
|
timeUnit: 'day',
|
|
2576
2468
|
count: 1
|
|
@@ -2645,20 +2537,6 @@ export const StackChartExamples = [
|
|
|
2645
2537
|
const [chartProps, setChartProps] = useState({
|
|
2646
2538
|
xAxis: {
|
|
2647
2539
|
type: 'date',
|
|
2648
|
-
dateFormats: [
|
|
2649
|
-
{
|
|
2650
|
-
type: 'day',
|
|
2651
|
-
dateFormat: 'MM/dd'
|
|
2652
|
-
},
|
|
2653
|
-
{
|
|
2654
|
-
type: 'week',
|
|
2655
|
-
dateFormat: 'MM/dd'
|
|
2656
|
-
},
|
|
2657
|
-
{
|
|
2658
|
-
type: 'month',
|
|
2659
|
-
dateFormat: 'MM/dd'
|
|
2660
|
-
}
|
|
2661
|
-
],
|
|
2662
2540
|
baseInterval: {
|
|
2663
2541
|
timeUnit: 'day',
|
|
2664
2542
|
count: 1
|
|
@@ -2740,12 +2618,6 @@ export const StackChartExamples = [
|
|
|
2740
2618
|
xAxis: {
|
|
2741
2619
|
type: 'date',
|
|
2742
2620
|
valueField: 'daySt',
|
|
2743
|
-
dateFormats: [
|
|
2744
|
-
{
|
|
2745
|
-
type: 'day',
|
|
2746
|
-
dateFormat: 'MM/dd'
|
|
2747
|
-
},
|
|
2748
|
-
],
|
|
2749
2621
|
baseInterval: {
|
|
2750
2622
|
timeUnit: 'day',
|
|
2751
2623
|
count: 1
|
|
@@ -2824,12 +2696,6 @@ export const StackChartExamples = [
|
|
|
2824
2696
|
xAxis: {
|
|
2825
2697
|
type: 'date',
|
|
2826
2698
|
valueField: 'daySt',
|
|
2827
|
-
dateFormats: [
|
|
2828
|
-
{
|
|
2829
|
-
type: 'day',
|
|
2830
|
-
dateFormat: 'MM/dd'
|
|
2831
|
-
},
|
|
2832
|
-
],
|
|
2833
2699
|
baseInterval: {
|
|
2834
2700
|
timeUnit: 'day',
|
|
2835
2701
|
count: 1
|
|
@@ -2920,20 +2786,6 @@ export const StackChartExamples = [
|
|
|
2920
2786
|
const [chartProps, setChartProps] = useState({
|
|
2921
2787
|
xAxis: {
|
|
2922
2788
|
type: 'date',
|
|
2923
|
-
dateFormats: [
|
|
2924
|
-
{
|
|
2925
|
-
type: 'day',
|
|
2926
|
-
dateFormat: 'MM/dd'
|
|
2927
|
-
},
|
|
2928
|
-
{
|
|
2929
|
-
type: 'week',
|
|
2930
|
-
dateFormat: 'MM/dd'
|
|
2931
|
-
},
|
|
2932
|
-
{
|
|
2933
|
-
type: 'month',
|
|
2934
|
-
dateFormat: 'MM/dd'
|
|
2935
|
-
}
|
|
2936
|
-
],
|
|
2937
2789
|
baseInterval: {
|
|
2938
2790
|
timeUnit: 'day',
|
|
2939
2791
|
count: 1
|
|
@@ -3151,19 +3003,19 @@ export const StackChartExamples = [
|
|
|
3151
3003
|
])
|
|
3152
3004
|
|
|
3153
3005
|
const udfSum = (obj) => {
|
|
3154
|
-
const data =
|
|
3006
|
+
const data = chartData.filter(d => d.productType === obj.productType)[0]
|
|
3155
3007
|
const sum = Object.keys(data)
|
|
3156
|
-
.filter(k =>
|
|
3008
|
+
.filter(k => chartCategory.includes(k))
|
|
3157
3009
|
.map(k => data[k])
|
|
3158
3010
|
.reduce((a, b) => a + b)
|
|
3159
3011
|
return {sum: sum}
|
|
3160
3012
|
}
|
|
3161
3013
|
|
|
3162
3014
|
const udfData = (obj) => {
|
|
3163
|
-
const filtered =
|
|
3015
|
+
const filtered = chartData.filter(d => d.productType === obj.productType)[0]
|
|
3164
3016
|
const result = {}
|
|
3165
3017
|
Object.keys(filtered).forEach(k => {
|
|
3166
|
-
if (
|
|
3018
|
+
if (chartCategory.includes(k)) {
|
|
3167
3019
|
result[k] = parseInt(filtered[k])
|
|
3168
3020
|
}
|
|
3169
3021
|
})
|
|
@@ -3272,19 +3124,19 @@ export const StackChartExamples = [
|
|
|
3272
3124
|
])
|
|
3273
3125
|
|
|
3274
3126
|
const udfSum = (obj) => {
|
|
3275
|
-
const data =
|
|
3127
|
+
const data = chartData.filter(d => d.productType === obj.productType)[0]
|
|
3276
3128
|
const sum = Object.keys(data)
|
|
3277
|
-
.filter(k =>
|
|
3129
|
+
.filter(k => chartCategory.includes(k))
|
|
3278
3130
|
.map(k => data[k])
|
|
3279
3131
|
.reduce((a, b) => a + b)
|
|
3280
3132
|
return {sum: sum}
|
|
3281
3133
|
}
|
|
3282
3134
|
|
|
3283
3135
|
const udfData = (obj) => {
|
|
3284
|
-
const filtered =
|
|
3136
|
+
const filtered = chartData.filter(d => d.productType === obj.productType)[0]
|
|
3285
3137
|
const result = {}
|
|
3286
3138
|
Object.keys(filtered).forEach(k => {
|
|
3287
|
-
if (
|
|
3139
|
+
if (chartCategory.includes(k)) {
|
|
3288
3140
|
result[k] = parseInt(filtered[k])
|
|
3289
3141
|
}
|
|
3290
3142
|
})
|
|
@@ -3414,12 +3266,6 @@ export const StackChartExamples = [
|
|
|
3414
3266
|
const [chartProps, setChartProps] = useState({
|
|
3415
3267
|
xAxis: {
|
|
3416
3268
|
type: 'date',
|
|
3417
|
-
dateFormats: [
|
|
3418
|
-
{
|
|
3419
|
-
type: 'month',
|
|
3420
|
-
dateFormat: 'yyyy/MM'
|
|
3421
|
-
}
|
|
3422
|
-
],
|
|
3423
3269
|
baseInterval: {
|
|
3424
3270
|
timeUnit: 'month',
|
|
3425
3271
|
count: 1
|
|
@@ -3570,12 +3416,6 @@ export const StackChartExamples = [
|
|
|
3570
3416
|
xAxis: {
|
|
3571
3417
|
type: 'date',
|
|
3572
3418
|
valueField: 'daySt',
|
|
3573
|
-
dateFormats: [
|
|
3574
|
-
{
|
|
3575
|
-
type: 'day',
|
|
3576
|
-
dateFormat: 'MM/dd'
|
|
3577
|
-
},
|
|
3578
|
-
],
|
|
3579
3419
|
baseInterval: {
|
|
3580
3420
|
timeUnit: 'day',
|
|
3581
3421
|
count: 1
|
|
@@ -3671,10 +3511,6 @@ export const StackChartExamples = [
|
|
|
3671
3511
|
},
|
|
3672
3512
|
xAxis: {
|
|
3673
3513
|
type: 'date',
|
|
3674
|
-
dateFormats: [
|
|
3675
|
-
{ type: 'day', dateFormat: 'MM-dd' },
|
|
3676
|
-
{ type: 'month', dateFormat: 'yy년 M월' }
|
|
3677
|
-
],
|
|
3678
3514
|
baseInterval: { timeUnit: 'month', count: 1 },
|
|
3679
3515
|
gridHidden: true
|
|
3680
3516
|
},
|
|
@@ -3810,6 +3646,100 @@ export const StackChartExamples = [
|
|
|
3810
3646
|
chartCustomCategory={chartCustomCategory}
|
|
3811
3647
|
/>`
|
|
3812
3648
|
},
|
|
3649
|
+
{
|
|
3650
|
+
title: '스택 차트 - 기간 비교 툴팁 (tooltip type CI-Compare, 증감 화살표 색상 up / down / even)',
|
|
3651
|
+
description: "스택 차트 - 조회 기간과 비교 기간 2행을 가로 스택 바로 그리고, 카테고리별 툴팁에 증감 화살표(증가 ↑ 빨강 / 감소 ↓ 초록 / 동일 -)와 증감률을 표시하는 예제입니다. tooltip.type 을 'CI-Compare' 로 두고, header.value 에 chartUserDefinedFunc 가 돌려준 'up' | 'down' | 'even' 단어를 넣으면 공통 컴포넌트가 색상 있는 화살표로 바꿔 그립니다. '↑' 같은 글리프나 색상 마크업은 툴팁에서 색이 적용되지 않습니다.",
|
|
3652
|
+
code_props_usage: `
|
|
3653
|
+
const chartId = 'stack-chart-${generateUniqueGeneralId()}'
|
|
3654
|
+
const chartRef = useRef(null)
|
|
3655
|
+
// ⚠️ CI-Compare 는 chartData 가 정확히 2행이어야 합니다: [0] = 비교 기간, [1] = 조회 기간
|
|
3656
|
+
const [chartData, setChartData] = useState([
|
|
3657
|
+
{ 'period': '2023-05', 'Amazon EC2': 8000, 'Amazon RDS': 5000, 'Amazon S3': 2000 },
|
|
3658
|
+
{ 'period': '2023-06', 'Amazon EC2': 10000, 'Amazon RDS': 4000, 'Amazon S3': 2000 }
|
|
3659
|
+
])
|
|
3660
|
+
const [chartCategory, setChartCategory] = useState([
|
|
3661
|
+
'Amazon EC2',
|
|
3662
|
+
'Amazon RDS',
|
|
3663
|
+
'Amazon S3'
|
|
3664
|
+
])
|
|
3665
|
+
const [chartProps, setChartProps] = useState({
|
|
3666
|
+
xAxis: {
|
|
3667
|
+
type: 'value',
|
|
3668
|
+
gridHidden: true
|
|
3669
|
+
},
|
|
3670
|
+
yAxis: {
|
|
3671
|
+
type: 'category',
|
|
3672
|
+
valueField: 'period',
|
|
3673
|
+
gridHidden: true,
|
|
3674
|
+
tooltip: {}
|
|
3675
|
+
},
|
|
3676
|
+
series: {
|
|
3677
|
+
valueYField: 'period',
|
|
3678
|
+
columns: {
|
|
3679
|
+
height: 'p50',
|
|
3680
|
+
hover: {
|
|
3681
|
+
enabled: true,
|
|
3682
|
+
grouped: false
|
|
3683
|
+
}
|
|
3684
|
+
},
|
|
3685
|
+
tooltip: {
|
|
3686
|
+
type: 'CI-Compare',
|
|
3687
|
+
withinArea: true,
|
|
3688
|
+
header: {
|
|
3689
|
+
name: '{name}',
|
|
3690
|
+
// arrow 자리에 'up' | 'down' | 'even' 단어가 오면 공통 컴포넌트가 색상 있는 증감 화살표로 바꿔 그림
|
|
3691
|
+
value: '{customValueTooltip["arrow"]} {customValueTooltip["diffRatio"]}% (\${customValueTooltip["diff"]})'
|
|
3692
|
+
},
|
|
3693
|
+
body: {
|
|
3694
|
+
// 2줄로 표시됨: 조회 기간 행 / 비교 기간 행(빗금 마커)
|
|
3695
|
+
name: '{valueY}',
|
|
3696
|
+
value: '\${customValueTooltip["value"]}',
|
|
3697
|
+
useMarker: true
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
},
|
|
3701
|
+
legend: {
|
|
3702
|
+
useExtension: false
|
|
3703
|
+
}
|
|
3704
|
+
})
|
|
3705
|
+
|
|
3706
|
+
// 카테고리별로 { arrow, diffRatio, diff, value } 를 돌려주는 사용자 정의 함수
|
|
3707
|
+
// obj = 마우스를 올린(또는 body 에 그려지는) 행 데이터
|
|
3708
|
+
const customValueTooltip = (obj) => {
|
|
3709
|
+
const compareRow = chartData[0] // 비교 기간
|
|
3710
|
+
const originRow = chartData[1] // 조회 기간
|
|
3711
|
+
const hoveredRow = chartData.find(d => d.period === obj.period) || {}
|
|
3712
|
+
const format = (v) => Number(v || 0).toLocaleString('en-US', { maximumFractionDigits: 2 })
|
|
3713
|
+
const result = {}
|
|
3714
|
+
chartCategory.forEach(c => {
|
|
3715
|
+
const cmp = compareRow[c] || 0
|
|
3716
|
+
const org = originRow[c] || 0
|
|
3717
|
+
const ratio = cmp === 0 ? (org === 0 ? 0 : 100) : ((org - cmp) / cmp) * 100
|
|
3718
|
+
result[c] = {
|
|
3719
|
+
arrow: org > cmp ? 'up' : org < cmp ? 'down' : 'even', // 반드시 up / down / even 단어
|
|
3720
|
+
diffRatio: Math.abs(ratio).toFixed(1),
|
|
3721
|
+
diff: format(Math.abs(org - cmp)),
|
|
3722
|
+
value: format(hoveredRow[c])
|
|
3723
|
+
}
|
|
3724
|
+
})
|
|
3725
|
+
return result
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
const udf = () => {
|
|
3729
|
+
return {
|
|
3730
|
+
customValueTooltip: customValueTooltip
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
`,
|
|
3734
|
+
code: `<OpsnowCommonStackChart
|
|
3735
|
+
chartId={chartId}
|
|
3736
|
+
ref={chartRef}
|
|
3737
|
+
chartProps={chartProps}
|
|
3738
|
+
chartData={chartData}
|
|
3739
|
+
chartCategory={chartCategory}
|
|
3740
|
+
chartUserDefinedFunc={udf()}
|
|
3741
|
+
/>`
|
|
3742
|
+
},
|
|
3813
3743
|
{
|
|
3814
3744
|
title: '스택 차트 - 다운로드',
|
|
3815
3745
|
description: 'ref를 사용하여 스택 차트를 다양한 형식으로 다운로드하는 예제입니다. 차트 ref는 ref prop으로 넘깁니다(chartRef라는 prop은 없음). downloadFile(fileName, fileType, fileOption?)을 호출합니다.',
|
|
@@ -3875,20 +3805,6 @@ export const XyMultiChartExamples = [
|
|
|
3875
3805
|
const [chartProps, setChartProps] = useState({
|
|
3876
3806
|
xAxis: {
|
|
3877
3807
|
type: 'date',
|
|
3878
|
-
dateFormats: [
|
|
3879
|
-
{
|
|
3880
|
-
type: 'day',
|
|
3881
|
-
dateFormat: '{l.month.day.format}'
|
|
3882
|
-
},
|
|
3883
|
-
{
|
|
3884
|
-
type: 'week',
|
|
3885
|
-
dateFormat: '{l.month.day.format}'
|
|
3886
|
-
},
|
|
3887
|
-
{
|
|
3888
|
-
type: 'month',
|
|
3889
|
-
dateFormat: '{l.month.day.format}'
|
|
3890
|
-
}
|
|
3891
|
-
],
|
|
3892
3808
|
baseInterval: {
|
|
3893
3809
|
timeUnit: 'day',
|
|
3894
3810
|
count: 1
|
|
@@ -4090,20 +4006,6 @@ export const XyMultiChartExamples = [
|
|
|
4090
4006
|
xAxis: {
|
|
4091
4007
|
type: 'date',
|
|
4092
4008
|
valueField: 'date',
|
|
4093
|
-
dateFormats: [
|
|
4094
|
-
{
|
|
4095
|
-
type: 'day',
|
|
4096
|
-
dateFormat: 'MM/dd'
|
|
4097
|
-
},
|
|
4098
|
-
{
|
|
4099
|
-
type: 'week',
|
|
4100
|
-
dateFormat: 'MM/dd'
|
|
4101
|
-
},
|
|
4102
|
-
{
|
|
4103
|
-
type: 'month',
|
|
4104
|
-
dateFormat: 'MM/dd'
|
|
4105
|
-
}
|
|
4106
|
-
],
|
|
4107
4009
|
baseInterval: {
|
|
4108
4010
|
timeUnit: 'day',
|
|
4109
4011
|
count: 1
|
|
@@ -4229,20 +4131,6 @@ export const XyMultiChartExamples = [
|
|
|
4229
4131
|
const [chartProps, setChartProps] = useState({
|
|
4230
4132
|
xAxis: {
|
|
4231
4133
|
type: 'date',
|
|
4232
|
-
dateFormats: [
|
|
4233
|
-
{
|
|
4234
|
-
type: 'day',
|
|
4235
|
-
dateFormat: 'MM/dd'
|
|
4236
|
-
},
|
|
4237
|
-
{
|
|
4238
|
-
type: 'week',
|
|
4239
|
-
dateFormat: 'MM/dd'
|
|
4240
|
-
},
|
|
4241
|
-
{
|
|
4242
|
-
type: 'month',
|
|
4243
|
-
dateFormat: 'MM/dd'
|
|
4244
|
-
}
|
|
4245
|
-
],
|
|
4246
4134
|
baseInterval: {
|
|
4247
4135
|
timeUnit: 'day',
|
|
4248
4136
|
count: 1
|
|
@@ -4510,20 +4398,6 @@ export const XyMultiChartExamples = [
|
|
|
4510
4398
|
const [chartProps, setChartProps] = useState({
|
|
4511
4399
|
xAxis: {
|
|
4512
4400
|
type: 'date',
|
|
4513
|
-
dateFormats: [
|
|
4514
|
-
{
|
|
4515
|
-
type: 'day',
|
|
4516
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4517
|
-
},
|
|
4518
|
-
{
|
|
4519
|
-
type: 'week',
|
|
4520
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4521
|
-
},
|
|
4522
|
-
{
|
|
4523
|
-
type: 'month',
|
|
4524
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4525
|
-
}
|
|
4526
|
-
],
|
|
4527
4401
|
baseInterval: {
|
|
4528
4402
|
timeUnit: 'day',
|
|
4529
4403
|
count: 1
|
|
@@ -4698,20 +4572,6 @@ export const XyMultiChartExamples = [
|
|
|
4698
4572
|
const [chartProps, setChartProps] = useState({
|
|
4699
4573
|
xAxis: {
|
|
4700
4574
|
type: 'date',
|
|
4701
|
-
dateFormats: [
|
|
4702
|
-
{
|
|
4703
|
-
type: 'day',
|
|
4704
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4705
|
-
},
|
|
4706
|
-
{
|
|
4707
|
-
type: 'week',
|
|
4708
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4709
|
-
},
|
|
4710
|
-
{
|
|
4711
|
-
type: 'month',
|
|
4712
|
-
dateFormat: 'yyyy/MM/dd'
|
|
4713
|
-
}
|
|
4714
|
-
],
|
|
4715
4575
|
baseInterval: {
|
|
4716
4576
|
timeUnit: 'day',
|
|
4717
4577
|
count: 1
|
|
@@ -4891,12 +4751,6 @@ export const XyMultiChartExamples = [
|
|
|
4891
4751
|
const [chartProps, setChartProps] = useState({
|
|
4892
4752
|
xAxis: {
|
|
4893
4753
|
type: 'date',
|
|
4894
|
-
dateFormats: [
|
|
4895
|
-
{
|
|
4896
|
-
type: 'day',
|
|
4897
|
-
dateFormat: 'MMM d'
|
|
4898
|
-
},
|
|
4899
|
-
],
|
|
4900
4754
|
baseInterval: {
|
|
4901
4755
|
timeUnit: 'day',
|
|
4902
4756
|
count: 1
|
|
@@ -5152,20 +5006,14 @@ export const XyMultiChartExamples = [
|
|
|
5152
5006
|
/>`
|
|
5153
5007
|
},
|
|
5154
5008
|
{
|
|
5155
|
-
title: 'XY 멀티 차트 - Compare Item + Pointerover Event',
|
|
5156
|
-
description:
|
|
5009
|
+
title: 'XY 멀티 차트 - 기간 비교 툴팁 (tooltip type CG-Compare, 증감률·증감 화살표 색상) + Compare Item + Pointerover Event',
|
|
5010
|
+
description: "XY 멀티 차트 - 조회 기간 vs 비교 기간을 나란히 그리고, 툴팁에 증감률과 증감 화살표(증가 ↑ 빨강 / 감소 ↓ 초록)를 자동 표시하는 예제입니다. tooltip.type 을 'CG-Compare' 로 두고 비교 그룹 chartCategory 에 compare: { origin, matchingType: 'index', valueXField } 를 지정합니다. body·footer value 에는 금액만 넘깁니다 (증감률은 공통 컴포넌트가 계산).",
|
|
5157
5011
|
code_props_usage: `
|
|
5158
5012
|
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
5159
5013
|
const chartRef = useRef(null)
|
|
5160
5014
|
const [chartProps, setChartProps] = useState({
|
|
5161
5015
|
xAxis: {
|
|
5162
5016
|
type: 'date',
|
|
5163
|
-
dateFormats: [
|
|
5164
|
-
{
|
|
5165
|
-
type: 'day',
|
|
5166
|
-
dateFormat: 'MM/dd'
|
|
5167
|
-
}
|
|
5168
|
-
],
|
|
5169
5017
|
baseInterval: {
|
|
5170
5018
|
timeUnit: 'day',
|
|
5171
5019
|
count: 1
|
|
@@ -5276,24 +5124,18 @@ export const XyMultiChartExamples = [
|
|
|
5276
5124
|
chartProps={chartProps}
|
|
5277
5125
|
chartData={chartData}
|
|
5278
5126
|
chartCategory={chartCategory}
|
|
5279
|
-
onSeriesPointerOver={
|
|
5127
|
+
onSeriesPointerOver={seriesPointerOver}
|
|
5280
5128
|
/>`
|
|
5281
5129
|
},
|
|
5282
5130
|
{
|
|
5283
|
-
title: 'XY 멀티 차트 - Compare Item + Line Series',
|
|
5284
|
-
description:
|
|
5131
|
+
title: 'XY 멀티 차트 - 기간 비교 툴팁 (tooltip type CG-Compare, 증감률·증감 화살표 색상) + Compare Item + Line Series',
|
|
5132
|
+
description: "XY 멀티 차트 - 라인 시리즈로 조회 기간 vs 비교 기간을 그리고, 툴팁에 증감률과 증감 화살표(증가 ↑ 빨강 / 감소 ↓ 초록)를 자동 표시하는 예제입니다. tooltip.type 'CG-Compare' + 비교 그룹 chartCategory 의 compare 설정을 함께 사용합니다.",
|
|
5285
5133
|
code_props_usage: `
|
|
5286
5134
|
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
5287
5135
|
const chartRef = useRef(null)
|
|
5288
5136
|
const [chartProps, setChartProps] = useState({
|
|
5289
5137
|
xAxis: {
|
|
5290
5138
|
type: 'date',
|
|
5291
|
-
dateFormats: [
|
|
5292
|
-
{
|
|
5293
|
-
type: 'day',
|
|
5294
|
-
dateFormat: 'MM/dd'
|
|
5295
|
-
}
|
|
5296
|
-
],
|
|
5297
5139
|
baseInterval: {
|
|
5298
5140
|
timeUnit: 'day',
|
|
5299
5141
|
count: 1
|
|
@@ -5418,12 +5260,6 @@ export const XyMultiChartExamples = [
|
|
|
5418
5260
|
xAxis: {
|
|
5419
5261
|
type: 'date',
|
|
5420
5262
|
// valueField: 'day',
|
|
5421
|
-
dateFormats: [
|
|
5422
|
-
{
|
|
5423
|
-
type: 'month',
|
|
5424
|
-
dateFormat: 'yy/MM'
|
|
5425
|
-
}
|
|
5426
|
-
],
|
|
5427
5263
|
baseInterval: {
|
|
5428
5264
|
timeUnit: 'month',
|
|
5429
5265
|
count: 1
|
|
@@ -5655,16 +5491,6 @@ export const XyMultiChartExamples = [
|
|
|
5655
5491
|
const [chartProps, setChartProps] = useState({
|
|
5656
5492
|
xAxis: {
|
|
5657
5493
|
type: 'date',
|
|
5658
|
-
dateFormats: [
|
|
5659
|
-
{
|
|
5660
|
-
type: 'month',
|
|
5661
|
-
dateFormat: 'yyyy/MM'
|
|
5662
|
-
},
|
|
5663
|
-
{
|
|
5664
|
-
type: 'year',
|
|
5665
|
-
dateFormat: 'yyyy/MM'
|
|
5666
|
-
},
|
|
5667
|
-
],
|
|
5668
5494
|
baseInterval: {
|
|
5669
5495
|
timeUnit: 'month',
|
|
5670
5496
|
count: 1
|
|
@@ -5798,16 +5624,6 @@ export const XyMultiChartExamples = [
|
|
|
5798
5624
|
const [chartProps, setChartProps] = useState({
|
|
5799
5625
|
xAxis: {
|
|
5800
5626
|
type: 'date',
|
|
5801
|
-
dateFormats: [
|
|
5802
|
-
{
|
|
5803
|
-
type: 'month',
|
|
5804
|
-
dateFormat: 'yyyy/MM'
|
|
5805
|
-
},
|
|
5806
|
-
{
|
|
5807
|
-
type: 'year',
|
|
5808
|
-
dateFormat: 'yyyy/MM'
|
|
5809
|
-
},
|
|
5810
|
-
],
|
|
5811
5627
|
baseInterval: {
|
|
5812
5628
|
timeUnit: 'month',
|
|
5813
5629
|
count: 1
|
|
@@ -5976,20 +5792,6 @@ export const XyMultiChartExamples = [
|
|
|
5976
5792
|
},
|
|
5977
5793
|
xAxis: {
|
|
5978
5794
|
type: 'date',
|
|
5979
|
-
dateFormats: [
|
|
5980
|
-
{
|
|
5981
|
-
type: 'day',
|
|
5982
|
-
dateFormat: 'MMM d, yyyy'
|
|
5983
|
-
},
|
|
5984
|
-
{
|
|
5985
|
-
type: 'month',
|
|
5986
|
-
dateFormat: 'MMM yyyy',
|
|
5987
|
-
},
|
|
5988
|
-
{
|
|
5989
|
-
type: 'year',
|
|
5990
|
-
dateFormat: 'yyyy',
|
|
5991
|
-
},
|
|
5992
|
-
],
|
|
5993
5795
|
baseInterval: {
|
|
5994
5796
|
timeUnit: 'day',
|
|
5995
5797
|
count: 1,
|
|
@@ -6108,16 +5910,6 @@ export const XyMultiChartExamples = [
|
|
|
6108
5910
|
xAxis: {
|
|
6109
5911
|
type: 'date',
|
|
6110
5912
|
valueField: 'date',
|
|
6111
|
-
dateFormats: [
|
|
6112
|
-
{
|
|
6113
|
-
type: 'month',
|
|
6114
|
-
dateFormat: 'MM/yyyy'
|
|
6115
|
-
},
|
|
6116
|
-
{
|
|
6117
|
-
type: 'year',
|
|
6118
|
-
dateFormat: 'MM/yyyy'
|
|
6119
|
-
}
|
|
6120
|
-
],
|
|
6121
5913
|
baseInterval: {
|
|
6122
5914
|
timeUnit: 'month',
|
|
6123
5915
|
count: 1
|
|
@@ -6303,16 +6095,6 @@ export const XyMultiChartExamples = [
|
|
|
6303
6095
|
xAxis: {
|
|
6304
6096
|
type: 'date',
|
|
6305
6097
|
valueField: 'date',
|
|
6306
|
-
dateFormats: [
|
|
6307
|
-
{
|
|
6308
|
-
type: 'month',
|
|
6309
|
-
dateFormat: 'MM/yyyy'
|
|
6310
|
-
},
|
|
6311
|
-
{
|
|
6312
|
-
type: 'year',
|
|
6313
|
-
dateFormat: 'MM/yyyy'
|
|
6314
|
-
}
|
|
6315
|
-
],
|
|
6316
6098
|
baseInterval: {
|
|
6317
6099
|
timeUnit: 'month',
|
|
6318
6100
|
count: 1
|
|
@@ -6521,10 +6303,6 @@ export const XyMultiChartExamples = [
|
|
|
6521
6303
|
},
|
|
6522
6304
|
xAxis: {
|
|
6523
6305
|
type: 'date',
|
|
6524
|
-
dateFormats: [
|
|
6525
|
-
{ type: 'day', dateFormat: 'MM-dd' },
|
|
6526
|
-
{ type: 'month', dateFormat: 'yy-MM' }
|
|
6527
|
-
],
|
|
6528
6306
|
baseInterval: { timeUnit: 'month', count: 1 },
|
|
6529
6307
|
gridHidden: true
|
|
6530
6308
|
},
|
|
@@ -6630,10 +6408,6 @@ export const XyMultiChartExamples = [
|
|
|
6630
6408
|
},
|
|
6631
6409
|
xAxis: {
|
|
6632
6410
|
type: 'date',
|
|
6633
|
-
dateFormats: [
|
|
6634
|
-
{ type: 'day', dateFormat: 'MM-dd' },
|
|
6635
|
-
{ type: 'month', dateFormat: 'MMM\\nyyyy' }
|
|
6636
|
-
],
|
|
6637
6411
|
baseInterval: { timeUnit: 'month', count: 1 },
|
|
6638
6412
|
gridHidden: true
|
|
6639
6413
|
},
|
|
@@ -6749,10 +6523,6 @@ export const XyMultiChartExamples = [
|
|
|
6749
6523
|
},
|
|
6750
6524
|
xAxis: {
|
|
6751
6525
|
type: 'date',
|
|
6752
|
-
dateFormats: [
|
|
6753
|
-
{ type: 'day', dateFormat: 'MM-dd' },
|
|
6754
|
-
{ type: 'month', dateFormat: 'yy년 M월' }
|
|
6755
|
-
],
|
|
6756
6526
|
baseInterval: { timeUnit: 'month', count: 1 },
|
|
6757
6527
|
gridHidden: true,
|
|
6758
6528
|
cellStartLocation: 0.1,
|
|
@@ -6843,7 +6613,6 @@ export const XyMultiChartExamples = [
|
|
|
6843
6613
|
const [chartProps, setChartProps] = useState({
|
|
6844
6614
|
xAxis: {
|
|
6845
6615
|
type: 'date',
|
|
6846
|
-
dateFormats: [{ type: 'day', dateFormat: 'yyyy/MM/dd' }],
|
|
6847
6616
|
baseInterval: { timeUnit: 'day', count: 1 },
|
|
6848
6617
|
gridHidden: true,
|
|
6849
6618
|
renderer: { minGridDistance: 30 },
|
|
@@ -6946,6 +6715,845 @@ export const XyMultiChartExamples = [
|
|
|
6946
6715
|
chartCustomCategory={chartCustomCategory}
|
|
6947
6716
|
/>`
|
|
6948
6717
|
},
|
|
6718
|
+
{
|
|
6719
|
+
title: 'XY 멀티 차트 - Zoom / Scroll: Scrollbar X (X축 스크롤바로 구간 이동·확대)',
|
|
6720
|
+
description: 'XY 멀티 차트 - X축 스크롤바(chart.scrollbarX)로 보이는 날짜 구간을 좁히거나 이동하는 예제입니다. zoomOutButtonHidden: false 로 줌 아웃 버튼을 노출합니다.',
|
|
6721
|
+
code_props_usage: `
|
|
6722
|
+
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
6723
|
+
const chartRef = useRef(null)
|
|
6724
|
+
const [chartProps, setChartProps] = useState({
|
|
6725
|
+
chart: {
|
|
6726
|
+
zoomOutButtonHidden: false,
|
|
6727
|
+
scrollbarX: {},
|
|
6728
|
+
},
|
|
6729
|
+
xAxis: {
|
|
6730
|
+
type: 'date',
|
|
6731
|
+
valueField: 'date',
|
|
6732
|
+
baseInterval: {
|
|
6733
|
+
timeUnit: 'day',
|
|
6734
|
+
count: 1,
|
|
6735
|
+
},
|
|
6736
|
+
gridHidden: true,
|
|
6737
|
+
startLocation: 1,
|
|
6738
|
+
endLocation: 0,
|
|
6739
|
+
renderer: {
|
|
6740
|
+
minGridDistance: 30,
|
|
6741
|
+
},
|
|
6742
|
+
},
|
|
6743
|
+
yAxis: {
|
|
6744
|
+
type: 'value',
|
|
6745
|
+
strictMinMax: true,
|
|
6746
|
+
},
|
|
6747
|
+
series: {
|
|
6748
|
+
valueXField: 'date',
|
|
6749
|
+
dataProcessor: {
|
|
6750
|
+
dateFields: ['date'],
|
|
6751
|
+
dateFormat: 'yyyy-MM-dd',
|
|
6752
|
+
},
|
|
6753
|
+
seriesTypes: [
|
|
6754
|
+
{
|
|
6755
|
+
type: 'stack-line',
|
|
6756
|
+
categoryGroupName: 'ondemand_cost',
|
|
6757
|
+
lineType: 'smoothedX',
|
|
6758
|
+
bullet: {
|
|
6759
|
+
type: 'circle',
|
|
6760
|
+
lineOnly: true,
|
|
6761
|
+
},
|
|
6762
|
+
},
|
|
6763
|
+
{
|
|
6764
|
+
type: 'stack',
|
|
6765
|
+
categoryGroupName: 'savings_cost',
|
|
6766
|
+
},
|
|
6767
|
+
],
|
|
6768
|
+
tooltip: {
|
|
6769
|
+
type: 'CG',
|
|
6770
|
+
stopActionEnabled: true,
|
|
6771
|
+
header: {
|
|
6772
|
+
name: '{valueX.formatDate("MM/dd")}',
|
|
6773
|
+
},
|
|
6774
|
+
body: {
|
|
6775
|
+
maxRowCount: 10,
|
|
6776
|
+
name: '{name}',
|
|
6777
|
+
value: [
|
|
6778
|
+
{
|
|
6779
|
+
categoryGroupName: 'ondemand_cost',
|
|
6780
|
+
value:
|
|
6781
|
+
'\${valueY.formatNumber("0,0")}({valueYPercent.formatNumber("0.0")}%)',
|
|
6782
|
+
},
|
|
6783
|
+
{
|
|
6784
|
+
categoryGroupName: 'savings_cost',
|
|
6785
|
+
value: '\${valueY.formatNumber("0,0")}',
|
|
6786
|
+
},
|
|
6787
|
+
],
|
|
6788
|
+
useMarker: true,
|
|
6789
|
+
},
|
|
6790
|
+
footer: {
|
|
6791
|
+
name: 'Total',
|
|
6792
|
+
value: [
|
|
6793
|
+
{
|
|
6794
|
+
categoryGroupName: 'ondemand_cost',
|
|
6795
|
+
value: '\${valueYSum.formatNumber("0,0")}(100.0%)',
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
categoryGroupName: 'savings_cost',
|
|
6799
|
+
value: '\${valueYSum.formatNumber("0,0")}',
|
|
6800
|
+
},
|
|
6801
|
+
],
|
|
6802
|
+
},
|
|
6803
|
+
},
|
|
6804
|
+
},
|
|
6805
|
+
cursor: {
|
|
6806
|
+
visibleY: false,
|
|
6807
|
+
},
|
|
6808
|
+
legend: {},
|
|
6809
|
+
})
|
|
6810
|
+
const [chartData, setChartData] = useState([
|
|
6811
|
+
{
|
|
6812
|
+
date: '2022-12-01',
|
|
6813
|
+
rds_ondemand_cost: 2000,
|
|
6814
|
+
elasti_cache_ondemand_cost: 2000,
|
|
6815
|
+
red_shift_ondemand_cost: 2000,
|
|
6816
|
+
sage_maker_ondemand_cost: 2000,
|
|
6817
|
+
sp_compute_ondemand_cost: 2000,
|
|
6818
|
+
rds_savings_cost: 200,
|
|
6819
|
+
elasti_cache_savings_cost: 200,
|
|
6820
|
+
red_shift_savings_cost: 200,
|
|
6821
|
+
sage_maker_savings_cost: 200,
|
|
6822
|
+
sp_compute_savings_cost: 10,
|
|
6823
|
+
},
|
|
6824
|
+
{
|
|
6825
|
+
date: '2022-12-02',
|
|
6826
|
+
rds_ondemand_cost: 2200,
|
|
6827
|
+
elasti_cache_ondemand_cost: 2200,
|
|
6828
|
+
red_shift_ondemand_cost: 2200,
|
|
6829
|
+
sage_maker_ondemand_cost: 2200,
|
|
6830
|
+
sp_compute_ondemand_cost: 2000,
|
|
6831
|
+
rds_savings_cost: 400,
|
|
6832
|
+
elasti_cache_savings_cost: 400,
|
|
6833
|
+
red_shift_savings_cost: 400,
|
|
6834
|
+
sage_maker_savings_cost: 400,
|
|
6835
|
+
sp_compute_savings_cost: 400,
|
|
6836
|
+
},
|
|
6837
|
+
{
|
|
6838
|
+
date: '2022-12-03',
|
|
6839
|
+
rds_ondemand_cost: 2400,
|
|
6840
|
+
elasti_cache_ondemand_cost: 2400,
|
|
6841
|
+
red_shift_ondemand_cost: 2400,
|
|
6842
|
+
sage_maker_ondemand_cost: 2400,
|
|
6843
|
+
sp_compute_ondemand_cost: 2400,
|
|
6844
|
+
rds_savings_cost: 400,
|
|
6845
|
+
elasti_cache_savings_cost: 400,
|
|
6846
|
+
red_shift_savings_cost: 400,
|
|
6847
|
+
sage_maker_savings_cost: 400,
|
|
6848
|
+
sp_compute_savings_cost: 400,
|
|
6849
|
+
},
|
|
6850
|
+
{
|
|
6851
|
+
date: '2022-12-04',
|
|
6852
|
+
rds_ondemand_cost: 1600,
|
|
6853
|
+
elasti_cache_ondemand_cost: 1600,
|
|
6854
|
+
red_shift_ondemand_cost: 1600,
|
|
6855
|
+
sage_maker_ondemand_cost: 1600,
|
|
6856
|
+
sp_compute_ondemand_cost: 1600,
|
|
6857
|
+
rds_savings_cost: 800,
|
|
6858
|
+
elasti_cache_savings_cost: 800,
|
|
6859
|
+
red_shift_savings_cost: 800,
|
|
6860
|
+
sage_maker_savings_cost: 800,
|
|
6861
|
+
sp_compute_savings_cost: 800,
|
|
6862
|
+
},
|
|
6863
|
+
{
|
|
6864
|
+
date: '2022-12-05',
|
|
6865
|
+
rds_ondemand_cost: 1800,
|
|
6866
|
+
elasti_cache_ondemand_cost: 1800,
|
|
6867
|
+
red_shift_ondemand_cost: 1800,
|
|
6868
|
+
sage_maker_ondemand_cost: 1800,
|
|
6869
|
+
sp_compute_ondemand_cost: 1800,
|
|
6870
|
+
rds_savings_cost: 800,
|
|
6871
|
+
elasti_cache_savings_cost: 800,
|
|
6872
|
+
red_shift_savings_cost: 800,
|
|
6873
|
+
sage_maker_savings_cost: 800,
|
|
6874
|
+
sp_compute_savings_cost: 800,
|
|
6875
|
+
},
|
|
6876
|
+
{
|
|
6877
|
+
date: '2022-12-06',
|
|
6878
|
+
rds_ondemand_cost: 2000,
|
|
6879
|
+
elasti_cache_ondemand_cost: 2000,
|
|
6880
|
+
red_shift_ondemand_cost: 2000,
|
|
6881
|
+
sage_maker_ondemand_cost: 2000,
|
|
6882
|
+
sp_compute_ondemand_cost: 2000,
|
|
6883
|
+
rds_savings_cost: 600,
|
|
6884
|
+
elasti_cache_savings_cost: 600,
|
|
6885
|
+
red_shift_savings_cost: 600,
|
|
6886
|
+
sage_maker_savings_cost: 600,
|
|
6887
|
+
sp_compute_savings_cost: 600,
|
|
6888
|
+
}
|
|
6889
|
+
// ... 이후 날짜도 같은 형태 (줌/스크롤은 데이터가 많을 때 의미가 있으므로 실제로는 15일치 이상을 넣습니다)
|
|
6890
|
+
])
|
|
6891
|
+
const [chartCategory, setChartCategory] = useState([
|
|
6892
|
+
{
|
|
6893
|
+
name: 'ondemand_cost',
|
|
6894
|
+
categories: [
|
|
6895
|
+
'rds_ondemand_cost',
|
|
6896
|
+
'elasti_cache_ondemand_cost',
|
|
6897
|
+
'red_shift_ondemand_cost',
|
|
6898
|
+
'sage_maker_ondemand_cost',
|
|
6899
|
+
'sp_compute_ondemand_cost',
|
|
6900
|
+
// 'open_search_ondemand_cost',
|
|
6901
|
+
// 'compute_group_ondemand_cost'
|
|
6902
|
+
],
|
|
6903
|
+
},
|
|
6904
|
+
{
|
|
6905
|
+
name: 'savings_cost',
|
|
6906
|
+
categories: [
|
|
6907
|
+
'rds_savings_cost',
|
|
6908
|
+
'elasti_cache_savings_cost',
|
|
6909
|
+
'red_shift_savings_cost',
|
|
6910
|
+
'sage_maker_savings_cost',
|
|
6911
|
+
'sp_compute_savings_cost',
|
|
6912
|
+
// 'open_search_savings_cost',
|
|
6913
|
+
// 'compute_group_savings_cost'
|
|
6914
|
+
],
|
|
6915
|
+
},
|
|
6916
|
+
])
|
|
6917
|
+
`,
|
|
6918
|
+
code: `<OpsnowCommonXyMultiChart
|
|
6919
|
+
chartId={chartId}
|
|
6920
|
+
ref={chartRef}
|
|
6921
|
+
chartProps={chartProps}
|
|
6922
|
+
chartData={chartData}
|
|
6923
|
+
chartCategory={chartCategory}
|
|
6924
|
+
/>`
|
|
6925
|
+
},
|
|
6926
|
+
{
|
|
6927
|
+
title: 'XY 멀티 차트 - Zoom / Scroll: Scrollbar Y (Y축 스크롤바로 값 범위 확대)',
|
|
6928
|
+
description: 'XY 멀티 차트 - Y축 스크롤바(chart.scrollbarY)로 보이는 값 범위를 좁히거나 이동하는 예제입니다.',
|
|
6929
|
+
code_props_usage: `
|
|
6930
|
+
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
6931
|
+
const chartRef = useRef(null)
|
|
6932
|
+
const [chartProps, setChartProps] = useState({
|
|
6933
|
+
chart: {
|
|
6934
|
+
zoomOutButtonHidden: false,
|
|
6935
|
+
scrollbarY: {},
|
|
6936
|
+
},
|
|
6937
|
+
xAxis: {
|
|
6938
|
+
type: 'date',
|
|
6939
|
+
valueField: 'date',
|
|
6940
|
+
baseInterval: {
|
|
6941
|
+
timeUnit: 'day',
|
|
6942
|
+
count: 1,
|
|
6943
|
+
},
|
|
6944
|
+
gridHidden: true,
|
|
6945
|
+
startLocation: 1,
|
|
6946
|
+
endLocation: 0,
|
|
6947
|
+
renderer: {
|
|
6948
|
+
minGridDistance: 30,
|
|
6949
|
+
},
|
|
6950
|
+
},
|
|
6951
|
+
yAxis: {
|
|
6952
|
+
type: 'value',
|
|
6953
|
+
strictMinMax: true,
|
|
6954
|
+
},
|
|
6955
|
+
series: {
|
|
6956
|
+
valueXField: 'date',
|
|
6957
|
+
dataProcessor: {
|
|
6958
|
+
dateFields: ['date'],
|
|
6959
|
+
dateFormat: 'yyyy-MM-dd',
|
|
6960
|
+
},
|
|
6961
|
+
seriesTypes: [
|
|
6962
|
+
{
|
|
6963
|
+
type: 'stack-line',
|
|
6964
|
+
categoryGroupName: 'ondemand_cost',
|
|
6965
|
+
lineType: 'smoothedX',
|
|
6966
|
+
bullet: {
|
|
6967
|
+
type: 'circle',
|
|
6968
|
+
lineOnly: true,
|
|
6969
|
+
},
|
|
6970
|
+
},
|
|
6971
|
+
{
|
|
6972
|
+
type: 'stack',
|
|
6973
|
+
categoryGroupName: 'savings_cost',
|
|
6974
|
+
},
|
|
6975
|
+
],
|
|
6976
|
+
tooltip: {
|
|
6977
|
+
type: 'CG',
|
|
6978
|
+
stopActionEnabled: true,
|
|
6979
|
+
header: {
|
|
6980
|
+
name: '{valueX.formatDate("MM/dd")}',
|
|
6981
|
+
},
|
|
6982
|
+
body: {
|
|
6983
|
+
maxRowCount: 10,
|
|
6984
|
+
name: '{name}',
|
|
6985
|
+
value: [
|
|
6986
|
+
{
|
|
6987
|
+
categoryGroupName: 'ondemand_cost',
|
|
6988
|
+
value:
|
|
6989
|
+
'\${valueY.formatNumber("0,0")}({valueYPercent.formatNumber("0.0")}%)',
|
|
6990
|
+
},
|
|
6991
|
+
{
|
|
6992
|
+
categoryGroupName: 'savings_cost',
|
|
6993
|
+
value: '\${valueY.formatNumber("0,0")}',
|
|
6994
|
+
},
|
|
6995
|
+
],
|
|
6996
|
+
useMarker: true,
|
|
6997
|
+
},
|
|
6998
|
+
footer: {
|
|
6999
|
+
name: 'Total',
|
|
7000
|
+
value: [
|
|
7001
|
+
{
|
|
7002
|
+
categoryGroupName: 'ondemand_cost',
|
|
7003
|
+
value: '\${valueYSum.formatNumber("0,0")}(100.0%)',
|
|
7004
|
+
},
|
|
7005
|
+
{
|
|
7006
|
+
categoryGroupName: 'savings_cost',
|
|
7007
|
+
value: '\${valueYSum.formatNumber("0,0")}',
|
|
7008
|
+
},
|
|
7009
|
+
],
|
|
7010
|
+
},
|
|
7011
|
+
},
|
|
7012
|
+
},
|
|
7013
|
+
cursor: {
|
|
7014
|
+
visibleY: false,
|
|
7015
|
+
},
|
|
7016
|
+
legend: {},
|
|
7017
|
+
})
|
|
7018
|
+
const [chartData, setChartData] = useState([
|
|
7019
|
+
{
|
|
7020
|
+
date: '2022-12-01',
|
|
7021
|
+
rds_ondemand_cost: 2000,
|
|
7022
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7023
|
+
red_shift_ondemand_cost: 2000,
|
|
7024
|
+
sage_maker_ondemand_cost: 2000,
|
|
7025
|
+
sp_compute_ondemand_cost: 2000,
|
|
7026
|
+
rds_savings_cost: 200,
|
|
7027
|
+
elasti_cache_savings_cost: 200,
|
|
7028
|
+
red_shift_savings_cost: 200,
|
|
7029
|
+
sage_maker_savings_cost: 200,
|
|
7030
|
+
sp_compute_savings_cost: 10,
|
|
7031
|
+
},
|
|
7032
|
+
{
|
|
7033
|
+
date: '2022-12-02',
|
|
7034
|
+
rds_ondemand_cost: 2200,
|
|
7035
|
+
elasti_cache_ondemand_cost: 2200,
|
|
7036
|
+
red_shift_ondemand_cost: 2200,
|
|
7037
|
+
sage_maker_ondemand_cost: 2200,
|
|
7038
|
+
sp_compute_ondemand_cost: 2000,
|
|
7039
|
+
rds_savings_cost: 400,
|
|
7040
|
+
elasti_cache_savings_cost: 400,
|
|
7041
|
+
red_shift_savings_cost: 400,
|
|
7042
|
+
sage_maker_savings_cost: 400,
|
|
7043
|
+
sp_compute_savings_cost: 400,
|
|
7044
|
+
},
|
|
7045
|
+
{
|
|
7046
|
+
date: '2022-12-03',
|
|
7047
|
+
rds_ondemand_cost: 2400,
|
|
7048
|
+
elasti_cache_ondemand_cost: 2400,
|
|
7049
|
+
red_shift_ondemand_cost: 2400,
|
|
7050
|
+
sage_maker_ondemand_cost: 2400,
|
|
7051
|
+
sp_compute_ondemand_cost: 2400,
|
|
7052
|
+
rds_savings_cost: 400,
|
|
7053
|
+
elasti_cache_savings_cost: 400,
|
|
7054
|
+
red_shift_savings_cost: 400,
|
|
7055
|
+
sage_maker_savings_cost: 400,
|
|
7056
|
+
sp_compute_savings_cost: 400,
|
|
7057
|
+
},
|
|
7058
|
+
{
|
|
7059
|
+
date: '2022-12-04',
|
|
7060
|
+
rds_ondemand_cost: 1600,
|
|
7061
|
+
elasti_cache_ondemand_cost: 1600,
|
|
7062
|
+
red_shift_ondemand_cost: 1600,
|
|
7063
|
+
sage_maker_ondemand_cost: 1600,
|
|
7064
|
+
sp_compute_ondemand_cost: 1600,
|
|
7065
|
+
rds_savings_cost: 800,
|
|
7066
|
+
elasti_cache_savings_cost: 800,
|
|
7067
|
+
red_shift_savings_cost: 800,
|
|
7068
|
+
sage_maker_savings_cost: 800,
|
|
7069
|
+
sp_compute_savings_cost: 800,
|
|
7070
|
+
},
|
|
7071
|
+
{
|
|
7072
|
+
date: '2022-12-05',
|
|
7073
|
+
rds_ondemand_cost: 1800,
|
|
7074
|
+
elasti_cache_ondemand_cost: 1800,
|
|
7075
|
+
red_shift_ondemand_cost: 1800,
|
|
7076
|
+
sage_maker_ondemand_cost: 1800,
|
|
7077
|
+
sp_compute_ondemand_cost: 1800,
|
|
7078
|
+
rds_savings_cost: 800,
|
|
7079
|
+
elasti_cache_savings_cost: 800,
|
|
7080
|
+
red_shift_savings_cost: 800,
|
|
7081
|
+
sage_maker_savings_cost: 800,
|
|
7082
|
+
sp_compute_savings_cost: 800,
|
|
7083
|
+
},
|
|
7084
|
+
{
|
|
7085
|
+
date: '2022-12-06',
|
|
7086
|
+
rds_ondemand_cost: 2000,
|
|
7087
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7088
|
+
red_shift_ondemand_cost: 2000,
|
|
7089
|
+
sage_maker_ondemand_cost: 2000,
|
|
7090
|
+
sp_compute_ondemand_cost: 2000,
|
|
7091
|
+
rds_savings_cost: 600,
|
|
7092
|
+
elasti_cache_savings_cost: 600,
|
|
7093
|
+
red_shift_savings_cost: 600,
|
|
7094
|
+
sage_maker_savings_cost: 600,
|
|
7095
|
+
sp_compute_savings_cost: 600,
|
|
7096
|
+
}
|
|
7097
|
+
// ... 이후 날짜도 같은 형태 (줌/스크롤은 데이터가 많을 때 의미가 있으므로 실제로는 15일치 이상을 넣습니다)
|
|
7098
|
+
])
|
|
7099
|
+
const [chartCategory, setChartCategory] = useState([
|
|
7100
|
+
{
|
|
7101
|
+
name: 'ondemand_cost',
|
|
7102
|
+
categories: [
|
|
7103
|
+
'rds_ondemand_cost',
|
|
7104
|
+
'elasti_cache_ondemand_cost',
|
|
7105
|
+
'red_shift_ondemand_cost',
|
|
7106
|
+
'sage_maker_ondemand_cost',
|
|
7107
|
+
'sp_compute_ondemand_cost',
|
|
7108
|
+
// 'open_search_ondemand_cost',
|
|
7109
|
+
// 'compute_group_ondemand_cost'
|
|
7110
|
+
],
|
|
7111
|
+
},
|
|
7112
|
+
{
|
|
7113
|
+
name: 'savings_cost',
|
|
7114
|
+
categories: [
|
|
7115
|
+
'rds_savings_cost',
|
|
7116
|
+
'elasti_cache_savings_cost',
|
|
7117
|
+
'red_shift_savings_cost',
|
|
7118
|
+
'sage_maker_savings_cost',
|
|
7119
|
+
'sp_compute_savings_cost',
|
|
7120
|
+
// 'open_search_savings_cost',
|
|
7121
|
+
// 'compute_group_savings_cost'
|
|
7122
|
+
],
|
|
7123
|
+
},
|
|
7124
|
+
])
|
|
7125
|
+
`,
|
|
7126
|
+
code: `<OpsnowCommonXyMultiChart
|
|
7127
|
+
chartId={chartId}
|
|
7128
|
+
ref={chartRef}
|
|
7129
|
+
chartProps={chartProps}
|
|
7130
|
+
chartData={chartData}
|
|
7131
|
+
chartCategory={chartCategory}
|
|
7132
|
+
/>`
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
title: 'XY 멀티 차트 - Zoom / Scroll: Scrollbar X + Y + 드래그 확대 (cursor.behavior zoomXY)',
|
|
7136
|
+
description: 'XY 멀티 차트 - X·Y축 스크롤바를 함께 쓰고, cursor.behavior: "zoomXY" 로 마우스로 드래그한 영역을 확대하는 예제입니다.',
|
|
7137
|
+
code_props_usage: `
|
|
7138
|
+
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
7139
|
+
const chartRef = useRef(null)
|
|
7140
|
+
const [chartProps, setChartProps] = useState({
|
|
7141
|
+
chart: {
|
|
7142
|
+
zoomOutButtonHidden: false,
|
|
7143
|
+
scrollbarX: {},
|
|
7144
|
+
scrollbarY: {},
|
|
7145
|
+
},
|
|
7146
|
+
xAxis: {
|
|
7147
|
+
type: 'date',
|
|
7148
|
+
valueField: 'date',
|
|
7149
|
+
baseInterval: {
|
|
7150
|
+
timeUnit: 'day',
|
|
7151
|
+
count: 1,
|
|
7152
|
+
},
|
|
7153
|
+
gridHidden: true,
|
|
7154
|
+
startLocation: 1,
|
|
7155
|
+
endLocation: 0,
|
|
7156
|
+
renderer: {
|
|
7157
|
+
minGridDistance: 30,
|
|
7158
|
+
},
|
|
7159
|
+
},
|
|
7160
|
+
yAxis: {
|
|
7161
|
+
type: 'value',
|
|
7162
|
+
strictMinMax: true,
|
|
7163
|
+
},
|
|
7164
|
+
series: {
|
|
7165
|
+
valueXField: 'date',
|
|
7166
|
+
dataProcessor: {
|
|
7167
|
+
dateFields: ['date'],
|
|
7168
|
+
dateFormat: 'yyyy-MM-dd',
|
|
7169
|
+
},
|
|
7170
|
+
seriesTypes: [
|
|
7171
|
+
{
|
|
7172
|
+
type: 'stack-line',
|
|
7173
|
+
categoryGroupName: 'ondemand_cost',
|
|
7174
|
+
lineType: 'smoothedX',
|
|
7175
|
+
bullet: {
|
|
7176
|
+
type: 'circle',
|
|
7177
|
+
lineOnly: true,
|
|
7178
|
+
},
|
|
7179
|
+
},
|
|
7180
|
+
{
|
|
7181
|
+
type: 'stack',
|
|
7182
|
+
categoryGroupName: 'savings_cost',
|
|
7183
|
+
},
|
|
7184
|
+
],
|
|
7185
|
+
tooltip: {
|
|
7186
|
+
type: 'CG',
|
|
7187
|
+
stopActionEnabled: true,
|
|
7188
|
+
header: {
|
|
7189
|
+
name: '{valueX.formatDate("MM/dd")}',
|
|
7190
|
+
},
|
|
7191
|
+
body: {
|
|
7192
|
+
maxRowCount: 10,
|
|
7193
|
+
name: '{name}',
|
|
7194
|
+
value: [
|
|
7195
|
+
{
|
|
7196
|
+
categoryGroupName: 'ondemand_cost',
|
|
7197
|
+
value:
|
|
7198
|
+
'\${valueY.formatNumber("0,0")}({valueYPercent.formatNumber("0.0")}%)',
|
|
7199
|
+
},
|
|
7200
|
+
{
|
|
7201
|
+
categoryGroupName: 'savings_cost',
|
|
7202
|
+
value: '\${valueY.formatNumber("0,0")}',
|
|
7203
|
+
},
|
|
7204
|
+
],
|
|
7205
|
+
useMarker: true,
|
|
7206
|
+
},
|
|
7207
|
+
footer: {
|
|
7208
|
+
name: 'Total',
|
|
7209
|
+
value: [
|
|
7210
|
+
{
|
|
7211
|
+
categoryGroupName: 'ondemand_cost',
|
|
7212
|
+
value: '\${valueYSum.formatNumber("0,0")}(100.0%)',
|
|
7213
|
+
},
|
|
7214
|
+
{
|
|
7215
|
+
categoryGroupName: 'savings_cost',
|
|
7216
|
+
value: '\${valueYSum.formatNumber("0,0")}',
|
|
7217
|
+
},
|
|
7218
|
+
],
|
|
7219
|
+
},
|
|
7220
|
+
},
|
|
7221
|
+
},
|
|
7222
|
+
cursor: {
|
|
7223
|
+
visibleY: false,
|
|
7224
|
+
behavior: 'zoomXY',
|
|
7225
|
+
},
|
|
7226
|
+
legend: {},
|
|
7227
|
+
})
|
|
7228
|
+
const [chartData, setChartData] = useState([
|
|
7229
|
+
{
|
|
7230
|
+
date: '2022-12-01',
|
|
7231
|
+
rds_ondemand_cost: 2000,
|
|
7232
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7233
|
+
red_shift_ondemand_cost: 2000,
|
|
7234
|
+
sage_maker_ondemand_cost: 2000,
|
|
7235
|
+
sp_compute_ondemand_cost: 2000,
|
|
7236
|
+
rds_savings_cost: 200,
|
|
7237
|
+
elasti_cache_savings_cost: 200,
|
|
7238
|
+
red_shift_savings_cost: 200,
|
|
7239
|
+
sage_maker_savings_cost: 200,
|
|
7240
|
+
sp_compute_savings_cost: 10,
|
|
7241
|
+
},
|
|
7242
|
+
{
|
|
7243
|
+
date: '2022-12-02',
|
|
7244
|
+
rds_ondemand_cost: 2200,
|
|
7245
|
+
elasti_cache_ondemand_cost: 2200,
|
|
7246
|
+
red_shift_ondemand_cost: 2200,
|
|
7247
|
+
sage_maker_ondemand_cost: 2200,
|
|
7248
|
+
sp_compute_ondemand_cost: 2000,
|
|
7249
|
+
rds_savings_cost: 400,
|
|
7250
|
+
elasti_cache_savings_cost: 400,
|
|
7251
|
+
red_shift_savings_cost: 400,
|
|
7252
|
+
sage_maker_savings_cost: 400,
|
|
7253
|
+
sp_compute_savings_cost: 400,
|
|
7254
|
+
},
|
|
7255
|
+
{
|
|
7256
|
+
date: '2022-12-03',
|
|
7257
|
+
rds_ondemand_cost: 2400,
|
|
7258
|
+
elasti_cache_ondemand_cost: 2400,
|
|
7259
|
+
red_shift_ondemand_cost: 2400,
|
|
7260
|
+
sage_maker_ondemand_cost: 2400,
|
|
7261
|
+
sp_compute_ondemand_cost: 2400,
|
|
7262
|
+
rds_savings_cost: 400,
|
|
7263
|
+
elasti_cache_savings_cost: 400,
|
|
7264
|
+
red_shift_savings_cost: 400,
|
|
7265
|
+
sage_maker_savings_cost: 400,
|
|
7266
|
+
sp_compute_savings_cost: 400,
|
|
7267
|
+
},
|
|
7268
|
+
{
|
|
7269
|
+
date: '2022-12-04',
|
|
7270
|
+
rds_ondemand_cost: 1600,
|
|
7271
|
+
elasti_cache_ondemand_cost: 1600,
|
|
7272
|
+
red_shift_ondemand_cost: 1600,
|
|
7273
|
+
sage_maker_ondemand_cost: 1600,
|
|
7274
|
+
sp_compute_ondemand_cost: 1600,
|
|
7275
|
+
rds_savings_cost: 800,
|
|
7276
|
+
elasti_cache_savings_cost: 800,
|
|
7277
|
+
red_shift_savings_cost: 800,
|
|
7278
|
+
sage_maker_savings_cost: 800,
|
|
7279
|
+
sp_compute_savings_cost: 800,
|
|
7280
|
+
},
|
|
7281
|
+
{
|
|
7282
|
+
date: '2022-12-05',
|
|
7283
|
+
rds_ondemand_cost: 1800,
|
|
7284
|
+
elasti_cache_ondemand_cost: 1800,
|
|
7285
|
+
red_shift_ondemand_cost: 1800,
|
|
7286
|
+
sage_maker_ondemand_cost: 1800,
|
|
7287
|
+
sp_compute_ondemand_cost: 1800,
|
|
7288
|
+
rds_savings_cost: 800,
|
|
7289
|
+
elasti_cache_savings_cost: 800,
|
|
7290
|
+
red_shift_savings_cost: 800,
|
|
7291
|
+
sage_maker_savings_cost: 800,
|
|
7292
|
+
sp_compute_savings_cost: 800,
|
|
7293
|
+
},
|
|
7294
|
+
{
|
|
7295
|
+
date: '2022-12-06',
|
|
7296
|
+
rds_ondemand_cost: 2000,
|
|
7297
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7298
|
+
red_shift_ondemand_cost: 2000,
|
|
7299
|
+
sage_maker_ondemand_cost: 2000,
|
|
7300
|
+
sp_compute_ondemand_cost: 2000,
|
|
7301
|
+
rds_savings_cost: 600,
|
|
7302
|
+
elasti_cache_savings_cost: 600,
|
|
7303
|
+
red_shift_savings_cost: 600,
|
|
7304
|
+
sage_maker_savings_cost: 600,
|
|
7305
|
+
sp_compute_savings_cost: 600,
|
|
7306
|
+
}
|
|
7307
|
+
// ... 이후 날짜도 같은 형태 (줌/스크롤은 데이터가 많을 때 의미가 있으므로 실제로는 15일치 이상을 넣습니다)
|
|
7308
|
+
])
|
|
7309
|
+
const [chartCategory, setChartCategory] = useState([
|
|
7310
|
+
{
|
|
7311
|
+
name: 'ondemand_cost',
|
|
7312
|
+
categories: [
|
|
7313
|
+
'rds_ondemand_cost',
|
|
7314
|
+
'elasti_cache_ondemand_cost',
|
|
7315
|
+
'red_shift_ondemand_cost',
|
|
7316
|
+
'sage_maker_ondemand_cost',
|
|
7317
|
+
'sp_compute_ondemand_cost',
|
|
7318
|
+
// 'open_search_ondemand_cost',
|
|
7319
|
+
// 'compute_group_ondemand_cost'
|
|
7320
|
+
],
|
|
7321
|
+
},
|
|
7322
|
+
{
|
|
7323
|
+
name: 'savings_cost',
|
|
7324
|
+
categories: [
|
|
7325
|
+
'rds_savings_cost',
|
|
7326
|
+
'elasti_cache_savings_cost',
|
|
7327
|
+
'red_shift_savings_cost',
|
|
7328
|
+
'sage_maker_savings_cost',
|
|
7329
|
+
'sp_compute_savings_cost',
|
|
7330
|
+
// 'open_search_savings_cost',
|
|
7331
|
+
// 'compute_group_savings_cost'
|
|
7332
|
+
],
|
|
7333
|
+
},
|
|
7334
|
+
])
|
|
7335
|
+
`,
|
|
7336
|
+
code: `<OpsnowCommonXyMultiChart
|
|
7337
|
+
chartId={chartId}
|
|
7338
|
+
ref={chartRef}
|
|
7339
|
+
chartProps={chartProps}
|
|
7340
|
+
chartData={chartData}
|
|
7341
|
+
chartCategory={chartCategory}
|
|
7342
|
+
/>`
|
|
7343
|
+
},
|
|
7344
|
+
{
|
|
7345
|
+
title: 'XY 멀티 차트 - Zoom / Scroll: Scrollbar X 시리즈 미리보기 (scrollbarX.showSeries + height)',
|
|
7346
|
+
description: 'XY 멀티 차트 - X축 스크롤바 안에 시리즈 미리보기를 그리는 예제입니다 (scrollbarX: { height: 60, showSeries: true }).',
|
|
7347
|
+
code_props_usage: `
|
|
7348
|
+
const chartId = 'xy-multi-chart-${generateUniqueGeneralId()}'
|
|
7349
|
+
const chartRef = useRef(null)
|
|
7350
|
+
const [chartProps, setChartProps] = useState({
|
|
7351
|
+
chart: {
|
|
7352
|
+
zoomOutButtonHidden: false,
|
|
7353
|
+
scrollbarX: {
|
|
7354
|
+
height: 60,
|
|
7355
|
+
showSeries: true,
|
|
7356
|
+
},
|
|
7357
|
+
scrollbarY: {},
|
|
7358
|
+
},
|
|
7359
|
+
xAxis: {
|
|
7360
|
+
type: 'date',
|
|
7361
|
+
valueField: 'date',
|
|
7362
|
+
baseInterval: {
|
|
7363
|
+
timeUnit: 'day',
|
|
7364
|
+
count: 1,
|
|
7365
|
+
},
|
|
7366
|
+
gridHidden: true,
|
|
7367
|
+
startLocation: 1,
|
|
7368
|
+
endLocation: 0,
|
|
7369
|
+
renderer: {
|
|
7370
|
+
minGridDistance: 30,
|
|
7371
|
+
},
|
|
7372
|
+
},
|
|
7373
|
+
yAxis: {
|
|
7374
|
+
type: 'value',
|
|
7375
|
+
strictMinMax: true,
|
|
7376
|
+
},
|
|
7377
|
+
series: {
|
|
7378
|
+
valueXField: 'date',
|
|
7379
|
+
dataProcessor: {
|
|
7380
|
+
dateFields: ['date'],
|
|
7381
|
+
dateFormat: 'yyyy-MM-dd',
|
|
7382
|
+
},
|
|
7383
|
+
seriesTypes: [
|
|
7384
|
+
{
|
|
7385
|
+
type: 'stack-line',
|
|
7386
|
+
categoryGroupName: 'ondemand_cost',
|
|
7387
|
+
lineType: 'smoothedX',
|
|
7388
|
+
bullet: {
|
|
7389
|
+
type: 'circle',
|
|
7390
|
+
lineOnly: true,
|
|
7391
|
+
},
|
|
7392
|
+
},
|
|
7393
|
+
{
|
|
7394
|
+
type: 'stack',
|
|
7395
|
+
categoryGroupName: 'savings_cost',
|
|
7396
|
+
},
|
|
7397
|
+
],
|
|
7398
|
+
tooltip: {
|
|
7399
|
+
type: 'CG',
|
|
7400
|
+
stopActionEnabled: true,
|
|
7401
|
+
header: {
|
|
7402
|
+
name: '{valueX.formatDate("MM/dd")}',
|
|
7403
|
+
},
|
|
7404
|
+
body: {
|
|
7405
|
+
maxRowCount: 10,
|
|
7406
|
+
name: '{name}',
|
|
7407
|
+
value: [
|
|
7408
|
+
{
|
|
7409
|
+
categoryGroupName: 'ondemand_cost',
|
|
7410
|
+
value:
|
|
7411
|
+
'\${valueY.formatNumber("0,0")}({valueYPercent.formatNumber("0.0")}%)',
|
|
7412
|
+
},
|
|
7413
|
+
{
|
|
7414
|
+
categoryGroupName: 'savings_cost',
|
|
7415
|
+
value: '\${valueY.formatNumber("0,0")}',
|
|
7416
|
+
},
|
|
7417
|
+
],
|
|
7418
|
+
useMarker: true,
|
|
7419
|
+
},
|
|
7420
|
+
footer: {
|
|
7421
|
+
name: 'Total',
|
|
7422
|
+
value: [
|
|
7423
|
+
{
|
|
7424
|
+
categoryGroupName: 'ondemand_cost',
|
|
7425
|
+
value: '\${valueYSum.formatNumber("0,0")}(100.0%)',
|
|
7426
|
+
},
|
|
7427
|
+
{
|
|
7428
|
+
categoryGroupName: 'savings_cost',
|
|
7429
|
+
value: '\${valueYSum.formatNumber("0,0")}',
|
|
7430
|
+
},
|
|
7431
|
+
],
|
|
7432
|
+
},
|
|
7433
|
+
},
|
|
7434
|
+
},
|
|
7435
|
+
cursor: {
|
|
7436
|
+
visibleY: false,
|
|
7437
|
+
behavior: 'zoomXY',
|
|
7438
|
+
},
|
|
7439
|
+
legend: {},
|
|
7440
|
+
})
|
|
7441
|
+
const [chartData, setChartData] = useState([
|
|
7442
|
+
{
|
|
7443
|
+
date: '2022-12-01',
|
|
7444
|
+
rds_ondemand_cost: 2000,
|
|
7445
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7446
|
+
red_shift_ondemand_cost: 2000,
|
|
7447
|
+
sage_maker_ondemand_cost: 2000,
|
|
7448
|
+
sp_compute_ondemand_cost: 2000,
|
|
7449
|
+
rds_savings_cost: 200,
|
|
7450
|
+
elasti_cache_savings_cost: 200,
|
|
7451
|
+
red_shift_savings_cost: 200,
|
|
7452
|
+
sage_maker_savings_cost: 200,
|
|
7453
|
+
sp_compute_savings_cost: 10,
|
|
7454
|
+
},
|
|
7455
|
+
{
|
|
7456
|
+
date: '2022-12-02',
|
|
7457
|
+
rds_ondemand_cost: 2200,
|
|
7458
|
+
elasti_cache_ondemand_cost: 2200,
|
|
7459
|
+
red_shift_ondemand_cost: 2200,
|
|
7460
|
+
sage_maker_ondemand_cost: 2200,
|
|
7461
|
+
sp_compute_ondemand_cost: 2000,
|
|
7462
|
+
rds_savings_cost: 400,
|
|
7463
|
+
elasti_cache_savings_cost: 400,
|
|
7464
|
+
red_shift_savings_cost: 400,
|
|
7465
|
+
sage_maker_savings_cost: 400,
|
|
7466
|
+
sp_compute_savings_cost: 400,
|
|
7467
|
+
},
|
|
7468
|
+
{
|
|
7469
|
+
date: '2022-12-03',
|
|
7470
|
+
rds_ondemand_cost: 2400,
|
|
7471
|
+
elasti_cache_ondemand_cost: 2400,
|
|
7472
|
+
red_shift_ondemand_cost: 2400,
|
|
7473
|
+
sage_maker_ondemand_cost: 2400,
|
|
7474
|
+
sp_compute_ondemand_cost: 2400,
|
|
7475
|
+
rds_savings_cost: 400,
|
|
7476
|
+
elasti_cache_savings_cost: 400,
|
|
7477
|
+
red_shift_savings_cost: 400,
|
|
7478
|
+
sage_maker_savings_cost: 400,
|
|
7479
|
+
sp_compute_savings_cost: 400,
|
|
7480
|
+
},
|
|
7481
|
+
{
|
|
7482
|
+
date: '2022-12-04',
|
|
7483
|
+
rds_ondemand_cost: 1600,
|
|
7484
|
+
elasti_cache_ondemand_cost: 1600,
|
|
7485
|
+
red_shift_ondemand_cost: 1600,
|
|
7486
|
+
sage_maker_ondemand_cost: 1600,
|
|
7487
|
+
sp_compute_ondemand_cost: 1600,
|
|
7488
|
+
rds_savings_cost: 800,
|
|
7489
|
+
elasti_cache_savings_cost: 800,
|
|
7490
|
+
red_shift_savings_cost: 800,
|
|
7491
|
+
sage_maker_savings_cost: 800,
|
|
7492
|
+
sp_compute_savings_cost: 800,
|
|
7493
|
+
},
|
|
7494
|
+
{
|
|
7495
|
+
date: '2022-12-05',
|
|
7496
|
+
rds_ondemand_cost: 1800,
|
|
7497
|
+
elasti_cache_ondemand_cost: 1800,
|
|
7498
|
+
red_shift_ondemand_cost: 1800,
|
|
7499
|
+
sage_maker_ondemand_cost: 1800,
|
|
7500
|
+
sp_compute_ondemand_cost: 1800,
|
|
7501
|
+
rds_savings_cost: 800,
|
|
7502
|
+
elasti_cache_savings_cost: 800,
|
|
7503
|
+
red_shift_savings_cost: 800,
|
|
7504
|
+
sage_maker_savings_cost: 800,
|
|
7505
|
+
sp_compute_savings_cost: 800,
|
|
7506
|
+
},
|
|
7507
|
+
{
|
|
7508
|
+
date: '2022-12-06',
|
|
7509
|
+
rds_ondemand_cost: 2000,
|
|
7510
|
+
elasti_cache_ondemand_cost: 2000,
|
|
7511
|
+
red_shift_ondemand_cost: 2000,
|
|
7512
|
+
sage_maker_ondemand_cost: 2000,
|
|
7513
|
+
sp_compute_ondemand_cost: 2000,
|
|
7514
|
+
rds_savings_cost: 600,
|
|
7515
|
+
elasti_cache_savings_cost: 600,
|
|
7516
|
+
red_shift_savings_cost: 600,
|
|
7517
|
+
sage_maker_savings_cost: 600,
|
|
7518
|
+
sp_compute_savings_cost: 600,
|
|
7519
|
+
}
|
|
7520
|
+
// ... 이후 날짜도 같은 형태 (줌/스크롤은 데이터가 많을 때 의미가 있으므로 실제로는 15일치 이상을 넣습니다)
|
|
7521
|
+
])
|
|
7522
|
+
const [chartCategory, setChartCategory] = useState([
|
|
7523
|
+
{
|
|
7524
|
+
name: 'ondemand_cost',
|
|
7525
|
+
categories: [
|
|
7526
|
+
'rds_ondemand_cost',
|
|
7527
|
+
'elasti_cache_ondemand_cost',
|
|
7528
|
+
'red_shift_ondemand_cost',
|
|
7529
|
+
'sage_maker_ondemand_cost',
|
|
7530
|
+
'sp_compute_ondemand_cost',
|
|
7531
|
+
// 'open_search_ondemand_cost',
|
|
7532
|
+
// 'compute_group_ondemand_cost'
|
|
7533
|
+
],
|
|
7534
|
+
},
|
|
7535
|
+
{
|
|
7536
|
+
name: 'savings_cost',
|
|
7537
|
+
categories: [
|
|
7538
|
+
'rds_savings_cost',
|
|
7539
|
+
'elasti_cache_savings_cost',
|
|
7540
|
+
'red_shift_savings_cost',
|
|
7541
|
+
'sage_maker_savings_cost',
|
|
7542
|
+
'sp_compute_savings_cost',
|
|
7543
|
+
// 'open_search_savings_cost',
|
|
7544
|
+
// 'compute_group_savings_cost'
|
|
7545
|
+
],
|
|
7546
|
+
},
|
|
7547
|
+
])
|
|
7548
|
+
`,
|
|
7549
|
+
code: `<OpsnowCommonXyMultiChart
|
|
7550
|
+
chartId={chartId}
|
|
7551
|
+
ref={chartRef}
|
|
7552
|
+
chartProps={chartProps}
|
|
7553
|
+
chartData={chartData}
|
|
7554
|
+
chartCategory={chartCategory}
|
|
7555
|
+
/>`
|
|
7556
|
+
}
|
|
6949
7557
|
];
|
|
6950
7558
|
// Heatmap Chart 컴포넌트 예제 데이터
|
|
6951
7559
|
export const HeatmapChartExamples = [
|