| | 50 | Now we'd like to make our basic report a bit more colorfull, so let's add a little chart. We are using [http://www.lorenzogil.com/projects/pycha/ PyCha] to generate them from our [source:/examples/pie_chart template]: |
| | 51 | |
| | 52 | {{{ |
| | 53 | options: |
| | 54 | width: 600 |
| | 55 | height: 400 |
| | 56 | background: {hide: true} |
| | 57 | legend: {hide: true} |
| | 58 | padding: {bottom: 10, left: 70, right: 10, top: 10} |
| | 59 | chart: |
| | 60 | type: pie |
| | 61 | output_type: png |
| | 62 | dataset: |
| | 63 | {% for line in o.lines %} |
| | 64 | - - ${line.item.name} |
| | 65 | - - [0, $line.amount] |
| | 66 | {% end %} |
| | 67 | }}} |
| | 68 | |
| | 69 | Once again we are using the same syntax as genshi but this time this is a [http://genshi.edgewall.org/wiki/Documentation/text-templates.html TextTemplate]. This file follow the [http://www.yaml.org/ YAML] format thus we can render it into a data structure that will be sent to !PyCha. |
| | 70 | |
| | 71 | And here is the result: |
| | 72 | |
| | 73 | [[Image(http://www.openhex.com/static/relatorio_trac/pie.png)]] |
| | 74 | |
| | 75 | == A (not-so) real example == |
| | 76 | |
| | 77 | Now that we have everything to start working on our [source:/examples/invoice.odt complicated template], we will go through it one step at a time. |