Skip to content

Commit

Permalink
优化candlestick文字颜色展示
Browse files Browse the repository at this point in the history
  • Loading branch information
yiliuyan161 committed Oct 8, 2024
1 parent 8e2f216 commit 73694fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions chartspy/express/echarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
close_field: str = 'close',
volume_field: str = 'volume', mas: list = [5, 10, 30], log_y: bool = True, title: str = "",
width: str = "100%", height: str = "600px", left_padding: str = '0%',
right_padding: str = '3%',**kwargs) -> Echarts:
right_padding: str = '3%',text_color:str='#000',**kwargs) -> Echarts:
"""
绘制K线
:param data_frame:
Expand Down Expand Up @@ -594,8 +594,8 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open

options = {
'animation': False,
'title': {'text': title,'padding':[5,0]},
'legend': {'top': 0,'padding':[5,10], 'left': 'right', 'data': [title]},
'title': {'text': title,'padding':[5,0],'textStyle':{'color':text_color}},
'legend': {'top': 0,'padding':[5,10], 'left': 'right', 'data': [title],'textStyle':{'color':text_color}},
'tooltip': {
'trigger': 'axis', 'axisPointer': {'type': 'cross','snap':True},
'borderWidth': 0,
Expand Down Expand Up @@ -665,7 +665,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
}
return labels.join('');
}"""),
'textStyle': {'color': '#000'},
'textStyle': {'color': text_color},
'position': Js("""
function (pos, params, el, elRect, size){
return {top: 30, left: 5};
Expand Down Expand Up @@ -707,7 +707,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
'axisLine': {'show': False},
'axisLabel': {'show': False},
'axisTick': {'show': False},
'splitLine': {'show': True},
'splitLine': {'show': False},
'splitNumber': 20,
'min': 'dataMin',
'max': 'dataMax',
Expand All @@ -721,11 +721,10 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
'data': df[time_field].tolist(),
'scale': True,
'boundaryGap': False,
'axisLine': {'onZero': False, 'show': True},
'axisLine': {'show': True},
'axisLine': {'onZero': False, 'show': False},
'axisLabel': {'show': True},
'axisTick': {'show': True},
'splitLine': {'show': True},
'splitLine': {'show': False},
'axisLabel': {'show': True},
'splitNumber': 20,
'min': 'dataMin',
Expand All @@ -740,7 +739,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
'splitNumber': 20,
'position':'right',
'minorSplitLine': {
'show': True
'show': False
},
'minorTick': {
'show': True
Expand All @@ -753,7 +752,7 @@ def candlestick_echarts(data_frame: pd.DataFrame, time_field: str = 'time', open
""")},
'axisLine': {'show': False},
'axisTick': {'show': True},
'splitLine': {'show': True}
'splitLine': {'show': False}
},
{
'scale': True,
Expand Down Expand Up @@ -1440,7 +1439,8 @@ def mark_background_echarts(data_frame: pd.DataFrame, x1: str, x2: str, label: s
{'xAxis': row[x2]}] for row in rows]
base_mark_area_options = {
'itemStyle': {
'opacity': fill_opacity
'opacity': fill_opacity,
'color': fill_color
},
'tooltip': {
'color': "black",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_install_requires():

setup(
name="chartspy",
version="2.2.4",
version="2.2.5",
url="https://chartspy.icopy.site/",
description="echarts g2plot klinechart highcharts tabulator python wrapper",
keywords='echarts g2plot klinechart highcharts tabulator python ',
Expand Down

0 comments on commit 73694fd

Please sign in to comment.