File: custom_data.py

package info (click to toggle)
python-leather 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 652 kB
  • sloc: python: 2,385; makefile: 117; sh: 5
file content (21 lines) | stat: -rw-r--r-- 352 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import leather

data = [
    {'x': 0, 'q': {'y': [3]}},
    {'x': 4, 'q': {'y': [5]}},
    {'x': 7, 'q': {'y': [9]}},
    {'x': 8, 'q': {'y': [4]}},
]


def x(row, index):
    return row['x']


def y(row, index):
    return row['q']['y'][0]


chart = leather.Chart('Line')
chart.add_line(data, x=x, y=y)
chart.to_svg('examples/charts/custom_data.svg')