Skip to content

Pygal : I try to change the style parameters of a chart but nothing change #568

@shanneton

Description

@shanneton

Hello,

I'm using Python 3.11.7 and pygal 3.0.5.
I have in my code a small function to plot a specific chart (see below). This function returns a svg version of the chart that is then inserted in a HTML document. Globally this function works very well but...
My problem : when I change the values of most of the style parameters, nothing change in the rendered chart. For instance the font size doesn't change, the margin doesn't change. There is only one parameter that, when modified, change the aspect of the chart : spacing.

Thank you very much for your precious help, since I didn't find nothing related to that on the web. I'm lost

The code

def FigWalkCycleTimes(Td,fig_title,szx,szy):

    # Get data
    s_sup_time_L = round(float(Td[0]["S_Supp_Time_L"]),2)
    s_sup_time_R = round(float(Td[0]["S_Supp_Time_R"]),2)
    d_sup_time_L = round(float(Td[0]["D_Supp_TimeL"])/2,2)
    d_sup_time_R = round(float(Td[0]["D_Supp_TimeR"])/2,2)
    swing_time_L = round(float(Td[0]["Swing_Time_L"]),2)
    swing_time_R = round(float(Td[0]["Swing_Time_L"]),2)

    bar_chart = pygal.HorizontalStackedBar(width=szx,height=szy,explicit_size=True,
        legend_at_bottom=True,spacing=10,margin_top=10,margin_bottom=10,value_font_size=5,
        label_font_size=10,legend_font_size = 12,legend_font_family='Courrier',
        human_readable=True,
        print_values=True,pretty_print=True)
    bar_chart.title = fig_title
    bar_chart.x_labels = 'Left', 'Right'
    bar_chart.add('First double support (s)', [d_sup_time_L, d_sup_time_R])
    bar_chart.add('Single support (s)', [s_sup_time_L, s_sup_time_R])
    bar_chart.add('Second double support (s)',[d_sup_time_L, d_sup_time_R])
    bar_chart.add('Swing duration (s)',[swing_time_L, swing_time_R])
    svg = bar_chart.render_data_uri()
    return(svg)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions