Renderer
HTML renderer for chart.xkcd charts.
render(chart, output_path, chart_js_url, width=600, height=400)
Render a chart to an HTML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chart
|
_BaseChart
|
chart to render. |
required |
output_path
|
Path | str
|
where to write result. |
required |
chart_js_url
|
str
|
URL to load the chart.xkcd JavaScript module from. |
required |
width
|
int
|
chart width in pixels. |
600
|
height
|
int
|
chart height in pixels. |
400
|
Source code in src/chart_xkcd/renderer.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
to_html(chart, chart_js_url, width=600, height=400)
Return HTML for a chart as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chart
|
_BaseChart
|
chart to convert. |
required |
chart_js_url
|
str
|
URL to load the chart.xkcd JavaScript module from. |
required |
width
|
int
|
chart width in pixels. |
600
|
height
|
int
|
chart height in pixels. |
400
|
Returns:
| Type | Description |
|---|---|
str
|
HTML as text. |
Source code in src/chart_xkcd/renderer.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |