将 highchart 配置转换为图像文件的 Python 包
项目描述
highchartexport
使用 HighCharts 的导出服务器将 highchart 配置转换为图像文件,即http://export.highcharts.com/
安装
您可以使用 pip 命令
pip install highchartexport
例子
在终端
highchartexport --json "{\"chart\":{\"type\":\"area\"},\"series\":[{\"data\":[1,2,3,4,5,6],\"name\":\"areaplot\"}]}" --out area_chart.png
highchartexport --json "{\"chart\":{\"type\":\"area\"},\"series\":[{\"data\":[1,2,3,4,5,6],\"name\":\"areaplot\"}]}" --out area_chart.png --width 2000 --scale 2
通过 highchart json 文件
- 对于 PNG 图像文件
highchartexport --in hc_config.json --out area_chart.png --width 2000 --scale 2 --type png
- 对于 SVG 文件
highchartexport --in hc_config.json --out area_chart.svg --width 2000 --scale 2 --type svg
- 对于带有 StockChart 的 SVG 文件
highchartexport --in hc_config.json --out area_chart.svg --chart StockChart --width 2000 --scale 2 --type svg
- 对于带有地图的 PDF 文件
highchartexport --in hc_config.json --out area_chart.svg --chart Map --width 2000 --scale 2 --type pdf
在你的 Python 程序中导入
import highchartexport as hc_export
config = {
"chart": {
"type": 'bubble',
"plotBorderWidth": 1,
"zoomType": 'xy'
},
"title": {
"text": 'Highcharts bubbles save in pdf file'
},
"series": [{
"data": [
[19, 81, 63],
[98, 5, 89],
[51, 50, 73],
],
"marker": {
"fillColor": {
"radialGradient": { "cx": 0.4, "cy": 0.3, "r": 0.7 },
"stops": [
[0, 'rgba(255,255,255,0.5)'],
[1, 'rgba(200, 200, 200, 0.8)']
]
}
}
}]
}
# use default width and scale value
hc_export.save_as_pdf(config=config, filename="bubble.pdf")
# you can pass width and scale value
hc_export.save_as_pdf(config=config, filename="bubble.pdf", width=1000, scale=4)
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
highchartexport-0.0.5.tar.gz
(25.2 kB
查看哈希)
内置分布
highchartexport-0.0.5-py3-none-any.whl
(17.4 kB
查看哈希)
关
highchartexport -0.0.5.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 3b32ff5bf4d204ebd8b2d195e01de004d0c618aa2de156a441f1ddb1e2b410ad |
|
| MD5 | 2a2542628c11869065475a607b206e19 |
|
| 布莱克2-256 | 79fce31ea31e95dd064e7db4bbe695bd9df453ed55247c1dbfde81d57d511ef0 |
关
highchartexport -0.0.5-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 01f6963ecefd89f42692a0d6745c1e2cfc65d19f9ba07a609fb354e21eaba137 |
|
| MD5 | 92e46e4ea16100e6648a1e4192659b88 |
|
| 布莱克2-256 | 726fa88e9214732b970b95c3e3dbdd7cd0708646c2de472a747ffcdaeb36041e |