Kozea / Kozea/pygal

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

Open
#568 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
419
PR merge metrics
No merged PRs in 30d

Description

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)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the FigWalkCycleTimes function with Python 3.11.7 and pygal 3.0.5, then inspect the SVG returned by render_data_uri() to compare changes to value_font_size, label_font_size, legend_font_size, and margins. Done means determining why those style parameters do not affect the rendered chart and either correcting the behavior or documenting the supported parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.