datastake-daf 0.6.382 → 0.6.384
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/dist/components/index.js +222 -345
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +0 -24
- package/package.json +2 -2
- package/src/@daf/core/components/Charts/AreaChart/AreaChart.stories.jsx +1 -444
- package/src/@daf/core/components/Charts/AreaChart/index.jsx +12 -27
- package/src/@daf/core/components/Charts/BarChart/BarChart.stories.jsx +0 -88
- package/src/@daf/core/components/Charts/BarChart/index.jsx +12 -27
- package/src/@daf/core/components/Charts/ColumnChart/ColumnChart.stories.jsx +28 -23
- package/src/@daf/core/components/Charts/ColumnChart/index.jsx +20 -42
- package/src/@daf/core/components/Charts/DonutPie/DonutPie.stories.jsx +0 -55
- package/src/@daf/core/components/Charts/DonutPie/index.js +11 -21
- package/src/@daf/core/components/Charts/DualAxes/DualAxes.stories.js +0 -33
- package/src/@daf/core/components/Charts/DualAxes/index.js +0 -21
- package/src/@daf/core/components/Charts/LineChart/LineChart.stories.jsx +0 -81
- package/src/@daf/core/components/Charts/LineChart/index.jsx +12 -21
- package/src/@daf/core/components/Charts/PieChart/PieChart.stories.js +0 -52
- package/src/@daf/core/components/Charts/PieChart/chart.jsx +90 -20
- package/src/@daf/core/components/Charts/RadarChart/RadarChart.stories.jsx +0 -52
- package/src/@daf/core/components/Charts/RadarChart/index.jsx +0 -21
- package/src/@daf/core/components/Charts/RadialBarChart/RadialBarChart.stories.jsx +0 -56
- package/src/@daf/core/components/Charts/RadialBarChart/index.jsx +0 -22
- package/src/@daf/core/components/Charts/StackChart/StackChart.stories.jsx +0 -22
- package/src/@daf/core/components/Charts/StackChart/index.jsx +14 -22
- package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +4 -2
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +23 -5
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +12 -1
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +2 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -0
- package/src/helpers/StringHelper.js +0 -29
- package/src/utils.js +1 -1
- package/src/@daf/core/components/Charts/components/CustomLegend/index.js +0 -80
- package/src/@daf/core/components/Charts/helper.js +0 -25
|
@@ -514,447 +514,4 @@ export const FormattedAxes = {
|
|
|
514
514
|
<AreaChart {...args} />
|
|
515
515
|
</Widget>
|
|
516
516
|
),
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
export const Pdf = {
|
|
520
|
-
name: "Pdf",
|
|
521
|
-
args: {
|
|
522
|
-
data: [
|
|
523
|
-
{
|
|
524
|
-
"date": "Jun\n24",
|
|
525
|
-
"Score": 0,
|
|
526
|
-
"key": 0,
|
|
527
|
-
"step": "100%"
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
"date": "Jun\n24",
|
|
531
|
-
"Score": 0,
|
|
532
|
-
"key": 0,
|
|
533
|
-
"step": "75-99%"
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
"date": "Jun\n24",
|
|
537
|
-
"Score": 0,
|
|
538
|
-
"key": 0,
|
|
539
|
-
"step": "50-75%"
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
"date": "Jun\n24",
|
|
543
|
-
"Score": 0,
|
|
544
|
-
"key": 0,
|
|
545
|
-
"step": "25-50%"
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
"date": "Jun\n24",
|
|
549
|
-
"Score": 0,
|
|
550
|
-
"key": 0,
|
|
551
|
-
"step": "0-25%"
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
"date": "Jul\n24",
|
|
555
|
-
"Score": 0,
|
|
556
|
-
"key": 1,
|
|
557
|
-
"step": "100%"
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
"date": "Jul\n24",
|
|
561
|
-
"Score": 0,
|
|
562
|
-
"key": 1,
|
|
563
|
-
"step": "75-99%"
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
"date": "Jul\n24",
|
|
567
|
-
"Score": 0,
|
|
568
|
-
"key": 1,
|
|
569
|
-
"step": "50-75%"
|
|
570
|
-
},
|
|
571
|
-
{
|
|
572
|
-
"date": "Jul\n24",
|
|
573
|
-
"Score": 0,
|
|
574
|
-
"key": 1,
|
|
575
|
-
"step": "25-50%"
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
"date": "Jul\n24",
|
|
579
|
-
"Score": 0,
|
|
580
|
-
"key": 1,
|
|
581
|
-
"step": "0-25%"
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
"date": "Aug\n24",
|
|
585
|
-
"Score": 0,
|
|
586
|
-
"key": 2,
|
|
587
|
-
"step": "100%"
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
"date": "Aug\n24",
|
|
591
|
-
"Score": 0,
|
|
592
|
-
"key": 2,
|
|
593
|
-
"step": "75-99%"
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
"date": "Aug\n24",
|
|
597
|
-
"Score": 0,
|
|
598
|
-
"key": 2,
|
|
599
|
-
"step": "50-75%"
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
"date": "Aug\n24",
|
|
603
|
-
"Score": 0,
|
|
604
|
-
"key": 2,
|
|
605
|
-
"step": "25-50%"
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
"date": "Aug\n24",
|
|
609
|
-
"Score": 0,
|
|
610
|
-
"key": 2,
|
|
611
|
-
"step": "0-25%"
|
|
612
|
-
},
|
|
613
|
-
{
|
|
614
|
-
"date": "Sep\n24",
|
|
615
|
-
"Score": 0,
|
|
616
|
-
"key": 3,
|
|
617
|
-
"step": "100%"
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
"date": "Sep\n24",
|
|
621
|
-
"Score": 0,
|
|
622
|
-
"key": 3,
|
|
623
|
-
"step": "75-99%"
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
"date": "Sep\n24",
|
|
627
|
-
"Score": 0,
|
|
628
|
-
"key": 3,
|
|
629
|
-
"step": "50-75%"
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
"date": "Sep\n24",
|
|
633
|
-
"Score": 0,
|
|
634
|
-
"key": 3,
|
|
635
|
-
"step": "25-50%"
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
"date": "Sep\n24",
|
|
639
|
-
"Score": 0,
|
|
640
|
-
"key": 3,
|
|
641
|
-
"step": "0-25%"
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
"date": "Oct\n24",
|
|
645
|
-
"Score": 0,
|
|
646
|
-
"key": 4,
|
|
647
|
-
"step": "100%"
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
"date": "Oct\n24",
|
|
651
|
-
"Score": 0,
|
|
652
|
-
"key": 4,
|
|
653
|
-
"step": "75-99%"
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
"date": "Oct\n24",
|
|
657
|
-
"Score": 0,
|
|
658
|
-
"key": 4,
|
|
659
|
-
"step": "50-75%"
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
"date": "Oct\n24",
|
|
663
|
-
"Score": 0,
|
|
664
|
-
"key": 4,
|
|
665
|
-
"step": "25-50%"
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
"date": "Oct\n24",
|
|
669
|
-
"Score": 0,
|
|
670
|
-
"key": 4,
|
|
671
|
-
"step": "0-25%"
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
"date": "Nov\n24",
|
|
675
|
-
"Score": 0,
|
|
676
|
-
"key": 5,
|
|
677
|
-
"step": "100%"
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
"date": "Nov\n24",
|
|
681
|
-
"Score": 0,
|
|
682
|
-
"key": 5,
|
|
683
|
-
"step": "75-99%"
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
"date": "Nov\n24",
|
|
687
|
-
"Score": 0,
|
|
688
|
-
"key": 5,
|
|
689
|
-
"step": "50-75%"
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
"date": "Nov\n24",
|
|
693
|
-
"Score": 0,
|
|
694
|
-
"key": 5,
|
|
695
|
-
"step": "25-50%"
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
"date": "Nov\n24",
|
|
699
|
-
"Score": 1,
|
|
700
|
-
"key": 5,
|
|
701
|
-
"step": "0-25%"
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
"date": "Dec\n24",
|
|
705
|
-
"Score": 1,
|
|
706
|
-
"key": 6,
|
|
707
|
-
"step": "100%"
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
"date": "Dec\n24",
|
|
711
|
-
"Score": 9,
|
|
712
|
-
"key": 6,
|
|
713
|
-
"step": "75-99%"
|
|
714
|
-
},
|
|
715
|
-
{
|
|
716
|
-
"date": "Dec\n24",
|
|
717
|
-
"Score": 11,
|
|
718
|
-
"key": 6,
|
|
719
|
-
"step": "50-75%"
|
|
720
|
-
},
|
|
721
|
-
{
|
|
722
|
-
"date": "Dec\n24",
|
|
723
|
-
"Score": 14,
|
|
724
|
-
"key": 6,
|
|
725
|
-
"step": "25-50%"
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
"date": "Dec\n24",
|
|
729
|
-
"Score": 14,
|
|
730
|
-
"key": 6,
|
|
731
|
-
"step": "0-25%"
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
"date": "Jan\n25",
|
|
735
|
-
"Score": 14,
|
|
736
|
-
"key": 7,
|
|
737
|
-
"step": "100%"
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
"date": "Jan\n25",
|
|
741
|
-
"Score": 18,
|
|
742
|
-
"key": 7,
|
|
743
|
-
"step": "75-99%"
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
"date": "Jan\n25",
|
|
747
|
-
"Score": 24,
|
|
748
|
-
"key": 7,
|
|
749
|
-
"step": "50-75%"
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
"date": "Jan\n25",
|
|
753
|
-
"Score": 25,
|
|
754
|
-
"key": 7,
|
|
755
|
-
"step": "25-50%"
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
"date": "Jan\n25",
|
|
759
|
-
"Score": 25,
|
|
760
|
-
"key": 7,
|
|
761
|
-
"step": "0-25%"
|
|
762
|
-
},
|
|
763
|
-
{
|
|
764
|
-
"date": "Feb\n25",
|
|
765
|
-
"Score": 25,
|
|
766
|
-
"key": 8,
|
|
767
|
-
"step": "100%"
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
"date": "Feb\n25",
|
|
771
|
-
"Score": 27,
|
|
772
|
-
"key": 8,
|
|
773
|
-
"step": "75-99%"
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
"date": "Feb\n25",
|
|
777
|
-
"Score": 27,
|
|
778
|
-
"key": 8,
|
|
779
|
-
"step": "50-75%"
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
"date": "Feb\n25",
|
|
783
|
-
"Score": 28,
|
|
784
|
-
"key": 8,
|
|
785
|
-
"step": "25-50%"
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
"date": "Feb\n25",
|
|
789
|
-
"Score": 28,
|
|
790
|
-
"key": 8,
|
|
791
|
-
"step": "0-25%"
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
"date": "Mar\n25",
|
|
795
|
-
"Score": 28,
|
|
796
|
-
"key": 9,
|
|
797
|
-
"step": "100%"
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
"date": "Mar\n25",
|
|
801
|
-
"Score": 29,
|
|
802
|
-
"key": 9,
|
|
803
|
-
"step": "75-99%"
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
"date": "Mar\n25",
|
|
807
|
-
"Score": 29,
|
|
808
|
-
"key": 9,
|
|
809
|
-
"step": "50-75%"
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
"date": "Mar\n25",
|
|
813
|
-
"Score": 29,
|
|
814
|
-
"key": 9,
|
|
815
|
-
"step": "25-50%"
|
|
816
|
-
},
|
|
817
|
-
{
|
|
818
|
-
"date": "Mar\n25",
|
|
819
|
-
"Score": 29,
|
|
820
|
-
"key": 9,
|
|
821
|
-
"step": "0-25%"
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
"date": "Apr\n25",
|
|
825
|
-
"Score": 29,
|
|
826
|
-
"key": 10,
|
|
827
|
-
"step": "100%"
|
|
828
|
-
},
|
|
829
|
-
{
|
|
830
|
-
"date": "Apr\n25",
|
|
831
|
-
"Score": 29,
|
|
832
|
-
"key": 10,
|
|
833
|
-
"step": "75-99%"
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
"date": "Apr\n25",
|
|
837
|
-
"Score": 29,
|
|
838
|
-
"key": 10,
|
|
839
|
-
"step": "50-75%"
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
"date": "Apr\n25",
|
|
843
|
-
"Score": 29,
|
|
844
|
-
"key": 10,
|
|
845
|
-
"step": "25-50%"
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
"date": "Apr\n25",
|
|
849
|
-
"Score": 29,
|
|
850
|
-
"key": 10,
|
|
851
|
-
"step": "0-25%"
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
"date": "May\n25",
|
|
855
|
-
"Score": 29,
|
|
856
|
-
"key": 11,
|
|
857
|
-
"step": "100%"
|
|
858
|
-
},
|
|
859
|
-
{
|
|
860
|
-
"date": "May\n25",
|
|
861
|
-
"Score": 29,
|
|
862
|
-
"key": 11,
|
|
863
|
-
"step": "75-99%"
|
|
864
|
-
},
|
|
865
|
-
{
|
|
866
|
-
"date": "May\n25",
|
|
867
|
-
"Score": 29,
|
|
868
|
-
"key": 11,
|
|
869
|
-
"step": "50-75%"
|
|
870
|
-
},
|
|
871
|
-
{
|
|
872
|
-
"date": "May\n25",
|
|
873
|
-
"Score": 29,
|
|
874
|
-
"key": 11,
|
|
875
|
-
"step": "25-50%"
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
"date": "May\n25",
|
|
879
|
-
"Score": 29,
|
|
880
|
-
"key": 11,
|
|
881
|
-
"step": "0-25%"
|
|
882
|
-
},
|
|
883
|
-
{
|
|
884
|
-
"date": "Jun\n25",
|
|
885
|
-
"Score": 29,
|
|
886
|
-
"key": 12,
|
|
887
|
-
"step": "100%"
|
|
888
|
-
},
|
|
889
|
-
{
|
|
890
|
-
"date": "Jun\n25",
|
|
891
|
-
"Score": 29,
|
|
892
|
-
"key": 12,
|
|
893
|
-
"step": "75-99%"
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
"date": "Jun\n25",
|
|
897
|
-
"Score": 29,
|
|
898
|
-
"key": 12,
|
|
899
|
-
"step": "50-75%"
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
"date": "Jun\n25",
|
|
903
|
-
"Score": 29,
|
|
904
|
-
"key": 12,
|
|
905
|
-
"step": "25-50%"
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
"date": "Jun\n25",
|
|
909
|
-
"Score": 29,
|
|
910
|
-
"key": 12,
|
|
911
|
-
"step": "0-25%"
|
|
912
|
-
}
|
|
913
|
-
],
|
|
914
|
-
xFieldKey: "date",
|
|
915
|
-
yFieldKey: "Score",
|
|
916
|
-
seriesField: "step",
|
|
917
|
-
color: fill,
|
|
918
|
-
animated: true,
|
|
919
|
-
fillOpacity: 0.7,
|
|
920
|
-
height: 500,
|
|
921
|
-
isPdf: true,
|
|
922
|
-
renderTooltipContent: (title, data) => {
|
|
923
|
-
return {
|
|
924
|
-
title,
|
|
925
|
-
items: data.map((item) => ({
|
|
926
|
-
label: item.name,
|
|
927
|
-
value: item.value,
|
|
928
|
-
color: item.color,
|
|
929
|
-
})),
|
|
930
|
-
};
|
|
931
|
-
},
|
|
932
|
-
legendConfig: {
|
|
933
|
-
enabled: false,
|
|
934
|
-
position: 'bottom',
|
|
935
|
-
layout: 'horizontal',
|
|
936
|
-
items: [
|
|
937
|
-
{
|
|
938
|
-
id: 'baseline',
|
|
939
|
-
label: 'Baseline',
|
|
940
|
-
color: '#96b1ff',
|
|
941
|
-
},
|
|
942
|
-
{
|
|
943
|
-
id: 'improvement',
|
|
944
|
-
label: 'Improvement',
|
|
945
|
-
color: '#4b6ae7',
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
id: 'profit',
|
|
949
|
-
label: 'Net Profit',
|
|
950
|
-
color: '#52c41a',
|
|
951
|
-
}
|
|
952
|
-
]
|
|
953
|
-
},
|
|
954
|
-
},
|
|
955
|
-
render: (args) => (
|
|
956
|
-
<Widget title="Multiple Areas Chart" className="with-border-header" style={{height: "500px"}}>
|
|
957
|
-
<AreaChart {...args} />
|
|
958
|
-
</Widget>
|
|
959
|
-
),
|
|
960
|
-
};
|
|
517
|
+
};
|
|
@@ -3,8 +3,6 @@ import { Area } from "@antv/g2plot";
|
|
|
3
3
|
import { theme } from "antd";
|
|
4
4
|
import { renderTooltip } from "../../../../utils/tooltip";
|
|
5
5
|
import Container from "../style";
|
|
6
|
-
import CustomLegend from "../components/CustomLegend/index.js";
|
|
7
|
-
import { useLegendConfig } from "../helper.js";
|
|
8
6
|
|
|
9
7
|
const { useToken } = theme;
|
|
10
8
|
|
|
@@ -76,22 +74,14 @@ const AreaChart = ({
|
|
|
76
74
|
height,
|
|
77
75
|
t = (s) => s,
|
|
78
76
|
isPdf = false,
|
|
79
|
-
|
|
77
|
+
extraLegendConfig = {},
|
|
80
78
|
width,
|
|
81
79
|
...rest
|
|
82
80
|
}) => {
|
|
83
81
|
const containerRef = useRef(null);
|
|
84
82
|
const chartRef = useRef(null);
|
|
85
83
|
const { token } = useToken();
|
|
86
|
-
|
|
87
|
-
const {
|
|
88
|
-
legendEnabled,
|
|
89
|
-
legendItems,
|
|
90
|
-
legendPosition,
|
|
91
|
-
legendLayout,
|
|
92
|
-
legendInteractive,
|
|
93
|
-
legendStyle
|
|
94
|
-
} = useLegendConfig({legendConfig, isPdf});
|
|
84
|
+
const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
|
|
95
85
|
|
|
96
86
|
useEffect(() => {
|
|
97
87
|
if (!containerRef.current) {
|
|
@@ -132,7 +122,15 @@ const AreaChart = ({
|
|
|
132
122
|
areaStyle: {
|
|
133
123
|
fillOpacity,
|
|
134
124
|
},
|
|
135
|
-
legend:
|
|
125
|
+
legend: isPdf
|
|
126
|
+
? {
|
|
127
|
+
itemName: {
|
|
128
|
+
formatter: (text) => t(text),
|
|
129
|
+
},
|
|
130
|
+
position: 'bottom',
|
|
131
|
+
...extraLegendConfig,
|
|
132
|
+
}
|
|
133
|
+
: hasLegendConfig || false,
|
|
136
134
|
line: false,
|
|
137
135
|
...rest,
|
|
138
136
|
};
|
|
@@ -171,21 +169,8 @@ const AreaChart = ({
|
|
|
171
169
|
return (
|
|
172
170
|
<div className="flex flex-1 flex-column justify-content-center">
|
|
173
171
|
<div className="flex justify-content-center">
|
|
174
|
-
<Container
|
|
175
|
-
ref={containerRef}
|
|
176
|
-
height={height}
|
|
177
|
-
isPdf={false}
|
|
178
|
-
width={width}
|
|
179
|
-
></Container>
|
|
172
|
+
<Container ref={containerRef} height={height} isPdf={isPdf} width={width}></Container>
|
|
180
173
|
</div>
|
|
181
|
-
{legendEnabled && legendPosition === 'bottom' && (
|
|
182
|
-
<CustomLegend
|
|
183
|
-
items={legendItems}
|
|
184
|
-
layout={legendLayout}
|
|
185
|
-
interactive={legendInteractive}
|
|
186
|
-
style={legendStyle}
|
|
187
|
-
/>
|
|
188
|
-
)}
|
|
189
174
|
</div>
|
|
190
175
|
);
|
|
191
176
|
};
|
|
@@ -211,91 +211,3 @@ export const Percentage = {
|
|
|
211
211
|
);
|
|
212
212
|
},
|
|
213
213
|
};
|
|
214
|
-
|
|
215
|
-
export const Pdf = {
|
|
216
|
-
name: "Pdf Bar Chart",
|
|
217
|
-
args: {
|
|
218
|
-
data: [
|
|
219
|
-
{
|
|
220
|
-
label: "LABEL 1",
|
|
221
|
-
value: 20,
|
|
222
|
-
type: "type 1",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
label: "LABEL 2",
|
|
226
|
-
value: 50,
|
|
227
|
-
type: "type 1",
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
label: "LABEL 3",
|
|
231
|
-
value: 330,
|
|
232
|
-
type: "type 1",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
label: "LABEL 1",
|
|
236
|
-
value: 10,
|
|
237
|
-
type: "type 2",
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
label: "LABEL 2",
|
|
241
|
-
value: 30,
|
|
242
|
-
type: "type 2",
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
label: "LABEL 3",
|
|
246
|
-
value: 100,
|
|
247
|
-
type: "type 2",
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
label: "LABEL 3",
|
|
251
|
-
value: 100,
|
|
252
|
-
type: "type 3",
|
|
253
|
-
},
|
|
254
|
-
],
|
|
255
|
-
renderTooltipContent: (title, data) => {
|
|
256
|
-
return {
|
|
257
|
-
title,
|
|
258
|
-
items: data.map((item) => ({
|
|
259
|
-
label: item.name,
|
|
260
|
-
value: item.value,
|
|
261
|
-
color: item.color || "black",
|
|
262
|
-
})),
|
|
263
|
-
};
|
|
264
|
-
},
|
|
265
|
-
xFieldKey: "value",
|
|
266
|
-
yFieldKey: "label",
|
|
267
|
-
isStack: true,
|
|
268
|
-
seriesField: "type",
|
|
269
|
-
color: ["rgb(255, 99, 132)", "rgb(54, 162, 235)", "rgb(255, 205, 86)"],
|
|
270
|
-
isPdf: true,
|
|
271
|
-
legendConfig: {
|
|
272
|
-
enabled: false,
|
|
273
|
-
position: 'bottom',
|
|
274
|
-
layout: 'horizontal',
|
|
275
|
-
items: [
|
|
276
|
-
{
|
|
277
|
-
id: 'baseline',
|
|
278
|
-
label: 'Baseline',
|
|
279
|
-
color: '#96b1ff',
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
id: 'improvement',
|
|
283
|
-
label: 'Improvement',
|
|
284
|
-
color: '#4b6ae7',
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
id: 'profit',
|
|
288
|
-
label: 'Net Profit',
|
|
289
|
-
color: '#52c41a',
|
|
290
|
-
}
|
|
291
|
-
]
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
render: (args) => {
|
|
295
|
-
return (
|
|
296
|
-
<Widget title="Stacked Bar Chart" className={"with-border-header"}>
|
|
297
|
-
<BarChart {...args} />
|
|
298
|
-
</Widget>
|
|
299
|
-
);
|
|
300
|
-
},
|
|
301
|
-
};
|
|
@@ -3,8 +3,6 @@ import Container from "../style";
|
|
|
3
3
|
import { Bar } from "@antv/g2plot";
|
|
4
4
|
import { theme } from "antd";
|
|
5
5
|
import { renderTooltip } from "../../../../utils/tooltip";
|
|
6
|
-
import CustomLegend from "../components/CustomLegend/index.js";
|
|
7
|
-
import { useLegendConfig } from "../helper";
|
|
8
6
|
|
|
9
7
|
const { useToken } = theme;
|
|
10
8
|
|
|
@@ -88,22 +86,14 @@ export default function BarChart({
|
|
|
88
86
|
height,
|
|
89
87
|
t = (s) => s,
|
|
90
88
|
isPdf = false,
|
|
91
|
-
|
|
89
|
+
extraLegendConfig = {},
|
|
92
90
|
width,
|
|
93
91
|
...rest
|
|
94
92
|
}) {
|
|
95
93
|
const containerRef = React.useRef(null);
|
|
96
94
|
const chartRef = React.useRef(null);
|
|
97
95
|
const { token } = useToken();
|
|
98
|
-
|
|
99
|
-
const {
|
|
100
|
-
legendEnabled,
|
|
101
|
-
legendItems,
|
|
102
|
-
legendPosition,
|
|
103
|
-
legendLayout,
|
|
104
|
-
legendInteractive,
|
|
105
|
-
legendStyle
|
|
106
|
-
} = useLegendConfig({legendConfig, isPdf});
|
|
96
|
+
const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
|
|
107
97
|
|
|
108
98
|
React.useEffect(() => {
|
|
109
99
|
if (!containerRef.current) {
|
|
@@ -145,7 +135,15 @@ export default function BarChart({
|
|
|
145
135
|
isStack,
|
|
146
136
|
color: color || token.colorPrimary7,
|
|
147
137
|
seriesField,
|
|
148
|
-
legend:
|
|
138
|
+
legend: isPdf
|
|
139
|
+
? {
|
|
140
|
+
itemName: {
|
|
141
|
+
formatter: (text) => t(text),
|
|
142
|
+
},
|
|
143
|
+
position: 'bottom',
|
|
144
|
+
...extraLegendConfig,
|
|
145
|
+
}
|
|
146
|
+
: hasLegendConfig || false,
|
|
149
147
|
animation: animated,
|
|
150
148
|
};
|
|
151
149
|
|
|
@@ -184,21 +182,8 @@ export default function BarChart({
|
|
|
184
182
|
return (
|
|
185
183
|
<div className="flex flex-1 flex-column justify-content-center">
|
|
186
184
|
<div className="flex justify-content-center">
|
|
187
|
-
<Container
|
|
188
|
-
ref={containerRef}
|
|
189
|
-
height={height}
|
|
190
|
-
isPdf={false}
|
|
191
|
-
width={width}
|
|
192
|
-
></Container>
|
|
185
|
+
<Container ref={containerRef} height={height} isPdf={isPdf} width={width}></Container>
|
|
193
186
|
</div>
|
|
194
|
-
{legendEnabled && legendPosition === 'bottom' && (
|
|
195
|
-
<CustomLegend
|
|
196
|
-
items={legendItems}
|
|
197
|
-
layout={legendLayout}
|
|
198
|
-
interactive={legendInteractive}
|
|
199
|
-
style={legendStyle}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
187
|
</div>
|
|
203
188
|
);
|
|
204
189
|
}
|