Skip to content

[BUG] Trend lines cannot be displayed in the subchart. #574

@air-dx

Description

@air-dx

Expected Behavior

Image
I looked at answer #391, but I didn't understand it. Could you please provide a complete example of drawing a trendline on a subplot?

Current Behaviour

Image

Reproducible Example

char2 = chart.create_subchart(position='bottom', width=1, height=0.2, sync=True)
    char2.grid(vert_enabled=False, horz_enabled=False)

    rsi_line = char2.create_line('rsi',color="#FF0000",width=1)
    rsi_line.set(df_viz[['date', 'rsi']])
    rsi_line.price_line(label_visible=False,line_visible=False)

    rsi_obv_line = char2.create_line('rsi_obv',color="#E5FF00",width=1,style='dashed')
    rsi_obv_line.set(df_viz[['date', 'rsi_obv']])
    rsi_obv_line.price_line(label_visible=False,line_visible=False)

    rsi_osv_line = char2.create_line('rsi_osv',color="#E5FF00",width=1,style='dashed')
    rsi_osv_line.set(df_viz[['date', 'rsi_osv']])
    rsi_osv_line.price_line(label_visible=False,line_visible=False)

    rsi_sar_line = char2.create_line('rsi_sar',color="#00FF00",width=2,style='dotted')
    rsi_sar_line.set(df_viz[['date', 'rsi_sar']])
    rsi_sar_line.price_line(label_visible=False,line_visible=False)

    rsi_td_line = char2.create_line('rsi_td')
    #  Draw lines connecting rsi key points
    for i in range(1, len(rsi_point_list)):
        char2.trend_line(start_time=rsi_point_list[i-1]['time'], start_value=rsi_point_list[i-1]['rsi_value'],
                             end_time=rsi_point_list[i]['time'], end_value=rsi_point_list[i]['rsi_value'],
                             line_color="#FFA500", width=1, style="dashed")

Environment

- OS:win10
- Library:lightweight_charts 2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions