Browse Source

Fix #336

pull/339/head
Florian Mounier 8 years ago
parent
commit
0191d452b6
  1. 4
      docs/documentation/custom_styles.rst
  2. 4
      pygal/svg.py

4
docs/documentation/custom_styles.rst

@ -146,12 +146,10 @@ NB: Now the css rules are prefixed by an unique id, to prevent collisions when i
with open(custom_css_file, 'w') as f:
f.write(custom_css)
config = pygal.Config(fill=True, interpolate='cubic')
config.css.append(custom_css_file)
config.css.append('file://' + custom_css_file)
chart = pygal.StackedLine(config)
chart.add('A', [1, 3, 5, 16, 13, 3, 7])
chart.add('B', [5, 2, 3, 2, 5, 7, 17])
chart.add('C', [6, 10, 9, 7, 3, 1, 0])
chart.add('D', [2, 3, 5, 9, 12, 9, 5])
chart.add('E', [7, 4, 2, 1, 2, 10, 0])

4
pygal/svg.py

@ -103,9 +103,11 @@ class Svg(object):
if css.startswith('inline:'):
css_text = css[len('inline:'):]
elif css.startswith('file://'):
css = css[len('file://'):]
if not os.path.exists(css):
css = os.path.join(
os.path.dirname(__file__), 'css', css[len('file://'):])
os.path.dirname(__file__), 'css', css)
with io.open(css, encoding='utf-8') as f:
css_text = template(

Loading…
Cancel
Save