Skip to content

Commit

Permalink
修复基准名称字体显示
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou-JiaJun committed Aug 26, 2022
1 parent fc28c5c commit bed1d22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions rqalpha/mod/rqalpha_mod_sys_analyser/plot/consts.py
Expand Up @@ -37,8 +37,10 @@
system_log.warn("PLOT: Missing Chinese fonts. Fallback to English.")
LABEL_FONT_SIZE = 8
_ = lambda txt: txt
SUPPORT_CHINESE = False
else:
LABEL_FONT_SIZE = 10
SUPPORT_CHINESE = True

RED = "#aa4643"
BLUE = "#4572a7"
Expand Down
7 changes: 2 additions & 5 deletions rqalpha/mod/rqalpha_mod_sys_analyser/plot/plot.py
Expand Up @@ -30,12 +30,10 @@
from .utils import weekly_returns, trading_dates_index
from .consts import INDICATOR_WIDTH, INDICATOR_VALUE_HEIGHT, INDICATOR_LABEL_HEIGHT
from .consts import IMG_WIDTH, INDICATOR_AREA_HEIGHT, PLOT_AREA_HEIGHT, USER_PLOT_AREA_HEIGHT
from .consts import LABEL_FONT_SIZE, BLACK
from .consts import LABEL_FONT_SIZE, BLACK, SUPPORT_CHINESE
from .consts import INDICATORS, WEEKLY_INDICATORS, EXCESS_INDICATORS, MAX_DD, MAX_DDD, OPEN_POINT, CLOSE_POINT
from .consts import LINE_BENCHMARK, LINE_STRATEGY, LINE_WEEKLY_BENCHMARK, LINE_WEEKLY, LINE_EXCESS

from rqalpha.utils.i18n import Localization


class SubPlot:
height: int
Expand Down Expand Up @@ -175,8 +173,7 @@ def plot_result(result_dict, show=True, save=None, weekly_indicators: bool = Fal
indicators = INDICATORS + [EXCESS_INDICATORS]

# 在图例中输出基准信息
lc = Localization.get_sys_lc()
_b_str = summary["benchmark_symbol"] if lc and "cn" in lc.lower() else summary["benchmark"]
_b_str = summary["benchmark_symbol"] if SUPPORT_CHINESE else summary["benchmark"]
_INFO = LineInfo(
LINE_BENCHMARK.label + "({})".format(_b_str), LINE_BENCHMARK.color,
LINE_BENCHMARK.alpha, LINE_BENCHMARK.linewidth
Expand Down

0 comments on commit bed1d22

Please sign in to comment.