|
1 | 1 | from ..globals import CurrentConfig, RenderType, ThemeType |
2 | 2 | from ..options.series_options import ( |
3 | 3 | BasicOpts, |
| 4 | + ItemStyleOpts, |
4 | 5 | JSFunc, |
5 | 6 | LabelOpts, |
6 | 7 | LineStyleOpts, |
@@ -618,26 +619,130 @@ def __init__( |
618 | 619 | self.opts: dict = {"name": name, "max": max_, "min": min_, "color": color} |
619 | 620 |
|
620 | 621 |
|
| 622 | +class CalendarDayLabelOpts(BasicOpts): |
| 623 | + def __init__( |
| 624 | + self, |
| 625 | + is_show: bool = True, |
| 626 | + first_day: int = 0, |
| 627 | + margin: Optional[int] = None, |
| 628 | + position: str = "start", |
| 629 | + name_map: Union[str, Sequence] = "en", |
| 630 | + label_color: str = "#000", |
| 631 | + label_font_style: str = "normal", |
| 632 | + label_font_weight: str = "normal", |
| 633 | + label_font_family: str = "sans-serif", |
| 634 | + label_font_size: int = 12, |
| 635 | + align: Optional[str] = None, |
| 636 | + vertical_align: Optional[str] = None, |
| 637 | + ): |
| 638 | + self.opts: dict = { |
| 639 | + "show": is_show, |
| 640 | + "firstDay": first_day, |
| 641 | + "margin": margin, |
| 642 | + "position": position, |
| 643 | + "nameMap": name_map, |
| 644 | + "color": label_color, |
| 645 | + "fontStyle": label_font_style, |
| 646 | + "fontWeight": label_font_weight, |
| 647 | + "fontFamily": label_font_family, |
| 648 | + "fontSize": label_font_size, |
| 649 | + "align": align, |
| 650 | + "verticalAlign": vertical_align, |
| 651 | + } |
| 652 | + |
| 653 | + |
| 654 | +class CalendarMonthLabelOpts(BasicOpts): |
| 655 | + def __init__( |
| 656 | + self, |
| 657 | + is_show: bool = True, |
| 658 | + align: Optional[str] = None, |
| 659 | + margin: Optional[int] = None, |
| 660 | + position: str = "start", |
| 661 | + name_map: Union[str, Sequence] = "en", |
| 662 | + formatter: JSFunc = None, |
| 663 | + label_color: str = "#000", |
| 664 | + label_font_style: str = "normal", |
| 665 | + label_font_weight: str = "normal", |
| 666 | + label_font_family: str = "sans-serif", |
| 667 | + label_font_size: int = 12, |
| 668 | + vertical_align: Optional[str] = None, |
| 669 | + ): |
| 670 | + self.opts: dict = { |
| 671 | + "show": is_show, |
| 672 | + "align": align, |
| 673 | + "margin": margin, |
| 674 | + "position": position, |
| 675 | + "nameMap": name_map, |
| 676 | + "formatter": formatter, |
| 677 | + "color": label_color, |
| 678 | + "fontStyle": label_font_style, |
| 679 | + "fontWeight": label_font_weight, |
| 680 | + "fontFamily": label_font_family, |
| 681 | + "fontSize": label_font_size, |
| 682 | + "verticalAlign": vertical_align, |
| 683 | + } |
| 684 | + |
| 685 | + |
| 686 | +class CalendarYearLabelOpts(BasicOpts): |
| 687 | + def __init__( |
| 688 | + self, |
| 689 | + is_show: bool = True, |
| 690 | + margin: Optional[int] = None, |
| 691 | + position: Optional[str] = None, |
| 692 | + formatter: JSFunc = None, |
| 693 | + label_color: str = "#000", |
| 694 | + label_font_style: str = "normal", |
| 695 | + label_font_weight: str = "normal", |
| 696 | + label_font_family: str = "sans-serif", |
| 697 | + label_font_size: int = 12, |
| 698 | + align: Optional[str] = None, |
| 699 | + vertical_align: Optional[str] = None, |
| 700 | + ): |
| 701 | + self.opts: dict = { |
| 702 | + "show": is_show, |
| 703 | + "margin": margin, |
| 704 | + "position": position, |
| 705 | + "formatter": formatter, |
| 706 | + "color": label_color, |
| 707 | + "fontStyle": label_font_style, |
| 708 | + "fontWeight": label_font_weight, |
| 709 | + "fontFamily": label_font_family, |
| 710 | + "fontSize": label_font_size, |
| 711 | + "align": align, |
| 712 | + "verticalAlign": vertical_align, |
| 713 | + } |
| 714 | + |
| 715 | + |
621 | 716 | class CalendarOpts(BasicOpts): |
622 | 717 | def __init__( |
623 | 718 | self, |
624 | 719 | pos_left: Optional[str] = None, |
625 | 720 | pos_top: Optional[str] = None, |
626 | 721 | pos_right: Optional[str] = None, |
627 | 722 | pos_bottom: Optional[str] = None, |
628 | | - orient: Optional[str] = None, |
| 723 | + width: Optional[str] = "auto", |
| 724 | + height: Optional[str] = None, |
| 725 | + orient: Optional[str] = "horizontal", |
629 | 726 | range_: Union[str, Sequence, int] = None, |
630 | | - daylabel_opts: Union[LabelOpts, dict, None] = None, |
631 | | - monthlabel_opts: Union[LabelOpts, dict, None] = None, |
632 | | - yearlabel_opts: Union[LabelOpts, dict, None] = None, |
| 727 | + cell_size: Union[int, Sequence] = 20, |
| 728 | + splitline_opts: Union[SplitLineOpts, dict, None] = None, |
| 729 | + itemstyle_opts: Union[ItemStyleOpts, dict, None] = None, |
| 730 | + daylabel_opts: Union[CalendarDayLabelOpts, dict, None] = None, |
| 731 | + monthlabel_opts: Union[CalendarMonthLabelOpts, dict, None] = None, |
| 732 | + yearlabel_opts: Union[CalendarYearLabelOpts, dict, None] = None, |
633 | 733 | ): |
634 | 734 | self.opts: dict = { |
635 | 735 | "left": pos_left, |
636 | 736 | "top": pos_top, |
637 | 737 | "right": pos_right, |
638 | 738 | "bottom": pos_bottom, |
| 739 | + "width": width, |
| 740 | + "height": height, |
639 | 741 | "orient": orient, |
640 | 742 | "range": range_, |
| 743 | + "cellSize": cell_size, |
| 744 | + "splitLine": splitline_opts, |
| 745 | + "itemStyle": itemstyle_opts, |
641 | 746 | "dayLabel": daylabel_opts, |
642 | 747 | "monthLabel": monthlabel_opts, |
643 | 748 | "yearLabel": yearlabel_opts, |
|
0 commit comments