1

I'm working with Pygal, and want to be able to add a custom css file to my Pygal graph. I've looked at the official documentation, and the find it confusing.

Official doc on CSS http://www.pygal.org/en/stable/documentation/configuration/rendering.html

How can I know what the id's, class's and HTML elements of the graph I'm using are? If I can't, then I don't see how I can create a custom css file.

Here is an example I'm using from the documentation http://www.pygal.org/en/stable/documentation/first_steps.html

I want to be able to change the size of the tooltips, the tooltip text size, the bar colors, size of the title, resize the x and y labels, move the legend on top, etc.

Any help is much appreciated.

Here is my Python

@app.route("/pygal1", methods = ["GET", "POST"])
def pygal1():

    bar_chart = pygal.HorizontalStackedBar()
    bar_chart.title = "Remarquable sequences"
    bar_chart.x_labels = map(str, range(11))
    bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])
    bar_chart.add('Padovan', [1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12])
    bar = bar_chart.render_data_uri()



    return render_template("pygal1.html", bar=bar)

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Pygal</title>
        <head>
            <body>

<div class ="container-1" style="margin-left:14px;">
    <embed type="image/svg+xml" src="{{bar|safe}}" style="max-width:500px"/>



</div>

            </body>
            </html>
davidism
  • 121,510
  • 29
  • 395
  • 339
MichaelRSF
  • 886
  • 5
  • 16
  • 40
  • I think I found a way around the problem. By going to the webpage, and right-clicking to do inspect, I'm able to see the elements, classes, and ids that make up the pygal chart. Still can't get it to work though. – MichaelRSF Apr 17 '19 at 16:15

0 Answers0