@opsnow-mcp/opsnow-mcp-common-ui-server 1.0.44 → 1.0.45

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.
@@ -511,6 +511,173 @@ export const PieChartExamples = [
511
511
  chartCustomCategory={chartCustomCategory}
512
512
  />`
513
513
  },
514
+ {
515
+ title: '파이 차트 - Custom Category (조각별 커스텀 색상 지정)',
516
+ description: '파이 차트 - chartCustomCategory 로 조각(카테고리)마다 색상을 직접 지정하는 예제입니다.',
517
+ code_props_usage: `
518
+ const chartId = 'pie-chart-${generateUniqueGeneralId()}'
519
+ const chartRef = useRef(null)
520
+ const [chartProps, setChartProps] = useState({
521
+ chart: {
522
+ innerRadius: 'p62',
523
+ layout: 'horizontal',
524
+ },
525
+ label: {
526
+ text: '[bold]$176,461',
527
+ },
528
+ series: {
529
+ valueField: 'cost',
530
+ categoryField: 'name',
531
+ legendValueText:
532
+ '\${value.formatNumber("#,###")} ({valuePercentTotal.formatNumber("0.0")}%)',
533
+ tooltip: {
534
+ type: 'CI',
535
+ body: {
536
+ name: '{category}',
537
+ value:
538
+ '\${value.formatNumber("#,###")} ({valuePercentTotal.formatNumber("0.0")}%)',
539
+ useMarker: true,
540
+ },
541
+ },
542
+ },
543
+ legend: {
544
+ layout: 'vertical',
545
+ valueLabel: { textAlign: 'right', fontSize: 11 },
546
+ label: { fontSize: 11, maxWidth: 200, width: 150 },
547
+ },
548
+ })
549
+ const [chartData, setChartData] = useState([
550
+ { name: 'rapportlabs-damoa', cost: 159857 },
551
+ { name: 'rapportlabs-hub', cost: 14334 },
552
+ { name: 'rapportlabs-automation', cost: 2158 },
553
+ { name: 'rapportlabs-security-poc', cost: 112 },
554
+ { name: 'rapportlabs-dev', cost: 8500 },
555
+ { name: 'rapportlabs-staging', cost: 6200 },
556
+ { name: 'rapportlabs-prod', cost: 45000 },
557
+ { name: 'rapportlabs-analytics', cost: 12300 },
558
+ { name: 'rapportlabs-ml', cost: 28000 },
559
+ { name: 'rapportlabs-data', cost: 15600 },
560
+ { name: 'rapportlabs-api', cost: 9800 },
561
+ { name: 'rapportlabs-web', cost: 7400 },
562
+ { name: 'rapportlabs-mobile', cost: 5200 },
563
+ { name: 'rapportlabs-infra', cost: 18900 },
564
+ { name: 'rapportlabs-network', cost: 4300 },
565
+ { name: 'rapportlabs-storage', cost: 11200 },
566
+ { name: 'rapportlabs-backup', cost: 3100 },
567
+ { name: 'rapportlabs-monitoring', cost: 2800 },
568
+ { name: 'rapportlabs-logging', cost: 1900 },
569
+ { name: 'rapportlabs-testing', cost: 1500 },
570
+ ])
571
+ const [chartCustomCategory, setChartCustomCategory] = useState([
572
+ { name: 'rapportlabs-damoa', color: '#117DFB' },
573
+ { name: 'rapportlabs-hub', color: '#4DDCEA' },
574
+ { name: 'rapportlabs-automation', color: '#FFC700' },
575
+ { name: 'rapportlabs-security-poc', color: '#2BAB62' },
576
+ { name: 'rapportlabs-dev', color: '#F06292' },
577
+ { name: 'rapportlabs-staging', color: '#9A18FF' },
578
+ { name: 'rapportlabs-prod', color: '#F6791F' },
579
+ { name: 'rapportlabs-analytics', color: '#E00751' },
580
+ { name: 'rapportlabs-ml', color: '#4D5ACC' },
581
+ { name: 'rapportlabs-data', color: '#7E83A3' },
582
+ { name: 'rapportlabs-api', color: '#00BCD4' },
583
+ { name: 'rapportlabs-web', color: '#8BC34A' },
584
+ { name: 'rapportlabs-mobile', color: '#FF5722' },
585
+ { name: 'rapportlabs-infra', color: '#795548' },
586
+ { name: 'rapportlabs-network', color: '#607D8B' },
587
+ { name: 'rapportlabs-storage', color: '#9C27B0' },
588
+ { name: 'rapportlabs-backup', color: '#3F51B5' },
589
+ { name: 'rapportlabs-monitoring', color: '#009688' },
590
+ { name: 'rapportlabs-logging', color: '#CDDC39' },
591
+ { name: 'rapportlabs-testing', color: '#FF9800' },
592
+ ])
593
+ `,
594
+ code: `<OpsnowCommonPieChart
595
+ chartId={chartId}
596
+ ref={chartRef}
597
+ chartProps={chartProps}
598
+ chartData={chartData}
599
+ chartCustomCategory={chartCustomCategory}
600
+ />`
601
+ },
602
+ {
603
+ title: '파이 차트 - useSafeResolution (iOS 캔버스 메모리 제한 회피)',
604
+ description: '파이 차트 - useSafeResolution 을 켜 해상도 1(devicePixelRatio 무시)로 렌더링하는 예제입니다. iPhone/iPad 사파리에서 차트가 하얗게 비거나 깨질 때, 한 화면에 차트가 많을 때만 사용합니다 (화질이 약간 흐려짐, 기본값 false). 차트 8종 공통 prop 입니다.',
605
+ code_props_usage: `
606
+ const chartId = 'pie-chart-${generateUniqueGeneralId()}'
607
+ const chartRef = useRef(null)
608
+ const [chartProps, setChartProps] = useState({
609
+ chart: {
610
+ innerRadius: 'p62', // number | String(Percent)
611
+ layout: 'horizontal',
612
+ },
613
+ label: {
614
+ text: '[bold]Top Cost[/]',
615
+ },
616
+ series: {
617
+ valueField: 'cost',
618
+ categoryField: 'ratioName',
619
+ tooltip: {
620
+ type: 'CI',
621
+ position: {
622
+ criteria: 'left',
623
+ },
624
+ body: {
625
+ name: '{category}',
626
+ value: '{valuePercentTotal.formatNumber("0.00")}%',
627
+ useMarker: true,
628
+ },
629
+ },
630
+ },
631
+ legend: {
632
+ layout: 'vertical',
633
+ valueLabel: {
634
+ textAlign: 'right',
635
+ fontSize: 11,
636
+ },
637
+ label: {
638
+ fontSize: 11,
639
+ maxWidth: 200,
640
+ width: 120,
641
+ oversizedBehavior: 'wrap',
642
+ },
643
+ },
644
+ })
645
+ const [chartData, setChartData] = useState([
646
+ {
647
+ ratioName: 'cost_test_01',
648
+ cost: 2.13885099126,
649
+ ratio: 2.60445935955,
650
+ },
651
+ {
652
+ ratioName: 'cost_test_02',
653
+ cost: 25.05809050292,
654
+ ratio: 30.51302284046,
655
+ },
656
+ {
657
+ ratioName: 'cost_test_03',
658
+ cost: 9.92645480554,
659
+ ratio: 12.08735721785,
660
+ },
661
+ {
662
+ ratioName: 'cost_test_04',
663
+ cost: 0.198558984973,
664
+ ratio: 1.094167091343,
665
+ },
666
+ {
667
+ ratioName: 'cost_test_05',
668
+ cost: 0.1588960939,
669
+ ratio: 1.65471541267,
670
+ },
671
+ ])
672
+ `,
673
+ code: `<OpsnowCommonPieChart
674
+ chartId={chartId}
675
+ ref={chartRef}
676
+ chartProps={chartProps}
677
+ chartData={chartData}
678
+ useSafeResolution={true}
679
+ />`
680
+ },
514
681
  {
515
682
  title: '파이 차트 - 다운로드',
516
683
  description: 'ref를 사용하여 파이 차트를 다양한 형식으로 다운로드하는 예제입니다. 차트 ref는 ref prop으로 넘깁니다(chartRef라는 prop은 없음). downloadFile(fileName, fileType, fileOption?)을 호출합니다.',
@@ -2298,6 +2465,299 @@ export const LineChartExamples = [
2298
2465
  chartCategoryLocaleMapping={chartCategoryLocaleMapping}
2299
2466
  />`
2300
2467
  },
2468
+ {
2469
+ title: '라인 차트 - Line Only (불릿 없이 선만 표시, bullet.lineOnly)',
2470
+ description: '라인 차트 - series.bullet.lineOnly: true 로 데이터 포인트 불릿 없이 선만 그리는 예제입니다.',
2471
+ code_props_usage: `
2472
+ const chartId = 'line-chart-${generateUniqueGeneralId()}'
2473
+ const chartRef = useRef(null)
2474
+ const [chartProps, setChartProps] = useState({
2475
+ xAxis: {
2476
+ type: 'date',
2477
+ baseInterval: {
2478
+ timeUnit: 'day',
2479
+ count: 1,
2480
+ },
2481
+ gridHidden: true,
2482
+ },
2483
+ yAxis: {
2484
+ type: 'value',
2485
+ },
2486
+ series: {
2487
+ valueXField: 'date',
2488
+ dataProcessor: {
2489
+ dateFields: ['date'],
2490
+ dateFormat: 'yyyy-MM-dd',
2491
+ },
2492
+ bullet: {
2493
+ type: 'circle',
2494
+ lineOnly: true,
2495
+ },
2496
+ tooltip: {
2497
+ type: 'CI',
2498
+ body: {
2499
+ name: '{name}',
2500
+ value: '\${valueY.formatNumber("0.00")}',
2501
+ useMarker: true,
2502
+ },
2503
+ },
2504
+ },
2505
+ legend: {},
2506
+ })
2507
+ const [chartData, setChartData] = useState([
2508
+ {
2509
+ date: '2022-07-01',
2510
+ cost_test_03: 0.529944453125,
2511
+ cost_test_01: 0.025075000000000007,
2512
+ cost_test_02: 0.4547194531249999,
2513
+ },
2514
+ {
2515
+ date: '2022-07-02',
2516
+ cost_test_03: 0.7481568750000004,
2517
+ cost_test_01: 0.0354,
2518
+ cost_test_02: 0.6419568750000001,
2519
+ },
2520
+ {
2521
+ date: '2022-07-03',
2522
+ cost_test_03: 0.7481568750000004,
2523
+ cost_test_01: 0.0354,
2524
+ cost_test_02: 0.6419568750000001,
2525
+ },
2526
+ {
2527
+ date: '2022-07-04',
2528
+ cost_test_03: 0.7481568750000004,
2529
+ cost_test_01: 0.0354,
2530
+ cost_test_02: 0.7364661171875005,
2531
+ },
2532
+ {
2533
+ date: '2022-07-05',
2534
+ cost_test_03: 0.7481568750000004,
2535
+ cost_test_01: 0.0354,
2536
+ cost_test_02: 0.7753816875000006,
2537
+ },
2538
+ {
2539
+ date: '2022-07-06',
2540
+ cost_test_03: 0.7481568750000004,
2541
+ cost_test_01: 0.7481568750000004,
2542
+ cost_test_02: 0.7481568750000004,
2543
+ }
2544
+ // ... 이후 데이터도 같은 형태
2545
+ ])
2546
+ const [chartCategory, setChartCategory] = useState([
2547
+ 'cost_test_01',
2548
+ 'cost_test_02',
2549
+ 'cost_test_03',
2550
+ 'cost_test_04',
2551
+ 'cost_test_05',
2552
+ ])
2553
+ `,
2554
+ code: `<OpsnowCommonLineChart
2555
+ chartId={chartId}
2556
+ ref={chartRef}
2557
+ chartProps={chartProps}
2558
+ chartData={chartData}
2559
+ chartCategory={chartCategory}
2560
+ />`
2561
+ },
2562
+ {
2563
+ title: '라인 차트 - Connect False (값이 없는 구간은 선을 끊어서 표시)',
2564
+ description: '라인 차트 - series.connect: false 로 데이터가 비어 있는 구간을 잇지 않고 끊어서 그리는 예제입니다.',
2565
+ code_props_usage: `
2566
+ const chartId = 'line-chart-${generateUniqueGeneralId()}'
2567
+ const chartRef = useRef(null)
2568
+ const [chartProps, setChartProps] = useState({
2569
+ xAxis: {
2570
+ type: 'date',
2571
+ baseInterval: {
2572
+ timeUnit: 'day',
2573
+ count: 1,
2574
+ },
2575
+ gridHidden: true,
2576
+ },
2577
+ yAxis: {
2578
+ type: 'value',
2579
+ },
2580
+ series: {
2581
+ connect: false,
2582
+ valueXField: 'date',
2583
+ dataProcessor: {
2584
+ dateFields: ['date'],
2585
+ dateFormat: 'yyyy-MM-dd',
2586
+ },
2587
+ bullet: {
2588
+ type: 'circle',
2589
+ },
2590
+ tooltip: {
2591
+ type: 'CI',
2592
+ body: {
2593
+ name: '{name}',
2594
+ value: '\${valueY.formatNumber("0.00")}',
2595
+ useMarker: true,
2596
+ },
2597
+ },
2598
+ },
2599
+ legend: {},
2600
+ })
2601
+ const [chartData, setChartData] = useState([
2602
+ {
2603
+ date: '2022-07-01',
2604
+ cost_test_03: 0.74815687004,
2605
+ cost_test_01: 0, //0.0354,
2606
+ cost_test_02: 0.641956875001,
2607
+ },
2608
+ {
2609
+ date: '2022-07-02',
2610
+ cost_test_03: 0.7481568704,
2611
+ cost_test_01: 0.0354,
2612
+ cost_test_02: 0.641956875001,
2613
+ },
2614
+ {
2615
+ date: '2022-07-03',
2616
+ cost_test_03: 0.74815687004,
2617
+ cost_test_01: 0.0354,
2618
+ cost_test_02: 0.6419568750001,
2619
+ },
2620
+ {
2621
+ date: '2022-07-05',
2622
+ cost_test_03: 0.748156870004,
2623
+ cost_test_01: 0.0354,
2624
+ cost_test_02: 0.77538168750006,
2625
+ },
2626
+ {
2627
+ date: '2022-07-06',
2628
+ cost_test_03: 0.748156870004,
2629
+ cost_test_01: 0.748156875004,
2630
+ cost_test_02: 0.748156875004,
2631
+ },
2632
+ {
2633
+ date: '2022-07-07',
2634
+ cost_test_03: 2.122356713644,
2635
+ cost_test_01: 1.3193960003222,
2636
+ cost_test_02: 0.7753816870006,
2637
+ }
2638
+ // ... 이후 데이터도 같은 형태
2639
+ ])
2640
+ const [chartCategory, setChartCategory] = useState([
2641
+ 'cost_test_01',
2642
+ 'cost_test_02',
2643
+ 'cost_test_03',
2644
+ 'cost_test_04',
2645
+ 'cost_test_05',
2646
+ ])
2647
+ `,
2648
+ code: `<OpsnowCommonLineChart
2649
+ chartId={chartId}
2650
+ ref={chartRef}
2651
+ chartProps={chartProps}
2652
+ chartData={chartData}
2653
+ chartCategory={chartCategory}
2654
+ />`
2655
+ },
2656
+ {
2657
+ title: '라인 차트 - Base Interval Month (월 단위 X축)',
2658
+ description: '라인 차트 - xAxis.baseInterval.timeUnit 을 month 로 두어 월 단위 날짜 축을 그리는 예제입니다.',
2659
+ code_props_usage: `
2660
+ const chartId = 'line-chart-${generateUniqueGeneralId()}'
2661
+ const chartRef = useRef(null)
2662
+ const [chartProps, setChartProps] = useState({
2663
+ xAxis: {
2664
+ type: 'date',
2665
+ baseInterval: {
2666
+ timeUnit: 'month',
2667
+ count: 1,
2668
+ },
2669
+ gridHidden: true,
2670
+ renderer: {
2671
+ minGridDistance: 50,
2672
+ },
2673
+ },
2674
+ yAxis: {
2675
+ type: 'value',
2676
+ },
2677
+ series: {
2678
+ valueXField: 'date',
2679
+ dataProcessor: {
2680
+ dateFields: ['date'],
2681
+ dateFormat: 'yyyy-MM',
2682
+ },
2683
+ bullet: {
2684
+ type: 'circle',
2685
+ },
2686
+ tooltip: {
2687
+ type: 'CG',
2688
+ header: {
2689
+ name: '{valueX.formatDate("yy/MM")}',
2690
+ },
2691
+ body: {
2692
+ name: '{name}',
2693
+ value: '\${valueY.formatNumber("0.00")}',
2694
+ useMarker: true,
2695
+ },
2696
+ footer: {
2697
+ name: 'Total',
2698
+ value: '\${valueYSum.formatNumber("0.00")}',
2699
+ },
2700
+ },
2701
+ },
2702
+ legend: {
2703
+ useExtension: false,
2704
+ },
2705
+ })
2706
+ const [chartData, setChartData] = useState([
2707
+ {
2708
+ date: '2021-01',
2709
+ cost_test_03: 0.529944453125,
2710
+ cost_test_01: 0.025075000000000007,
2711
+ cost_test_02: 0.4547194531249999,
2712
+ },
2713
+ {
2714
+ date: '2021-02',
2715
+ cost_test_03: 0.7481568750000004,
2716
+ cost_test_01: 0.0354,
2717
+ cost_test_02: 0.6419568750000001,
2718
+ },
2719
+ {
2720
+ date: '2021-03',
2721
+ cost_test_03: 0.7481568750000004,
2722
+ cost_test_01: 0.0354,
2723
+ cost_test_02: 0.6419568750000001,
2724
+ },
2725
+ {
2726
+ date: '2021-04',
2727
+ cost_test_03: 0.7481568750000004,
2728
+ cost_test_01: 0.0354,
2729
+ cost_test_02: 0.7364661171875005,
2730
+ },
2731
+ {
2732
+ date: '2021-05',
2733
+ cost_test_03: 0.7481568750000004,
2734
+ cost_test_01: 0.0354,
2735
+ cost_test_02: 0.7753816875000006,
2736
+ },
2737
+ {
2738
+ date: '2021-06',
2739
+ cost_test_03: 0.7481568750000004,
2740
+ cost_test_01: 0.7481568750000004,
2741
+ cost_test_02: 0.7481568750000004,
2742
+ }
2743
+ // ... 이후 데이터도 같은 형태
2744
+ ])
2745
+ const [chartCategory, setChartCategory] = useState([
2746
+ 'cost_test_01',
2747
+ 'cost_test_02',
2748
+ 'cost_test_03',
2749
+ 'cost_test_04',
2750
+ 'cost_test_05',
2751
+ ])
2752
+ `,
2753
+ code: `<OpsnowCommonLineChart
2754
+ chartId={chartId}
2755
+ ref={chartRef}
2756
+ chartProps={chartProps}
2757
+ chartData={chartData}
2758
+ chartCategory={chartCategory}
2759
+ />`
2760
+ },
2301
2761
  {
2302
2762
  title: '라인 차트 - 다운로드',
2303
2763
  description: 'ref를 사용하여 라인 차트를 다양한 형식으로 다운로드하는 예제입니다. 차트 ref는 ref prop으로 넘깁니다(chartRef라는 prop은 없음). downloadFile(fileName, fileType, fileOption?)을 호출합니다.',