简体   繁体   English

在pygal中创建组合图表?

[英]Create a combined chart in pygal?

Is it possible to create a single chart with a line series and a bar series? 是否可以创建带有线系列和条形系列的单个图表?

chart = pygal.Line()
chart.x_labels = 'Red', 'Blue', 'Green'
chart.y_labels = .0001, .0003, .0004, .00045, .0005
chart.add('line', [.0002, .0005, .00035])

In response to your query from pygal's github issue tracker: no 响应您从pygal的github问题跟踪器查询:

https://github.com/Kozea/pygal/issues/46 https://github.com/Kozea/pygal/issues/46

An answer can be found in the documentation at http://www.pygal.org/en/stable/documentation/web.html . 可以在http://www.pygal.org/en/stable/documentation/web.html的文档中找到答案。

<!DOCTYPE html>
<html>
  <head>
    <!-- ... -->
  </head>
  <body>
    <figure>
       <embed type="image/svg+xml" src="/mysvg.svg" />
    </figure>
  </body>
</html>

Duplicating the line in the <figure> tag allows you to vertically combine your charts, aligning at the left of the screen. 复制<figure>标记中的线可让您垂直组合图表,并在屏幕左侧对齐。 With CSS, and defining two figure tags you can then align horizontally the two figures. 使用CSS并定义两个图形标签,然后可以将两个图形水平对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM