<h1 align="center">
<b>Streamlit G2</b>
</h1>
<div align="center">
[G2](https://github.com/antvis/G2) is a visualization grammar for dashboard building, data exploration and storytelling.
This project was created to allow us to render [G2](https://github.com/antvis/G2) charts in streamlit. [Live Demo](https://antv-g2.streamlit.app/).
![examples](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_GfqQoRCqQkAAAAAAAAAAAAADmJ7AQ/fmt.webp)
[![PyPI version](https://badge.fury.io/py/streamlit-g2.svg)](https://badge.fury.io/py/streamlit-g2)
[![Build Status](https://github.com/antvis/g2/workflows/build/badge.svg?branch=v5)](https://github.com/antvis//actions)
[![Coverage Status](https://img.shields.io/coveralls/github/antvis/g2/v5.svg)](https://coveralls.io/github/antvis/g2?branch=v5)
[![npm Version](https://img.shields.io/npm/v/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
[![npm Download](https://img.shields.io/npm/dm/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
[![npm License](https://img.shields.io/npm/l/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
</div>
## Installation
```
pip install streamlit-g2
```
## Usage
```py
import streamlit as st
from streamlit_g2 import g2
options = {
"type": "interval",
"data": [
{ "genre": 'Sports', "sold": 275 },
{ "genre": 'Strategy', "sold": 115 },
{ "genre": 'Action', "sold": 120 },
{ "genre": 'Shooter', "sold": 350 },
{ "genre": 'Other', "sold": 150 },
],
"encode": {
"x": "genre",
"y": "sold",
"color": "genre",
}
}
g2(options=options, style=None, key="streamlit_g2")
```
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*XqCnTbkpAkQAAAAAAAAAAAAADmJ7AQ/fmt.webp" width="640" alt="example">
## API
Now, There is only one API for `streamlit-g2`, named `g2`, see the `options` in [G2 Spec API](https://g2.antv.antgroup.com/manual/core/api).
| Property | Description | Type | Default |
| -------- | --------------------------------------------------------------------------------------------------------------- | --------------------- | ------- |
| options | the [options](https://g2.antv.antgroup.com/manual/core/api) for the visualization, say `chart.options(options)` | `G2options` \| `null` | - |
| style | the style of the container | `CSSProperties` | - |
## Development
- Building frontend code by running `npm run start` in fold `streamlit_g2/frontend`.
- Run the example by running `streamlit run streamlit_g2/__init__.py` with `_RELEASE = False`.
## License
MIT@[hustcc](https://github.com/hustcc).
Raw data
{
"_id": null,
"home_page": "https://github.com/hustcc/streamlit-g2",
"name": "streamlit-g2",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "antv,g2,streamlit-component,streamlit-g2",
"author": "hustcc",
"author_email": "i@hust.cc",
"download_url": "https://files.pythonhosted.org/packages/83/9d/969730c25fa3a9b1647d1a03b86ce068e89d71b8d07d4e4ced146d68e85b/streamlit-g2-0.1.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">\n <b>Streamlit G2</b>\n</h1>\n\n<div align=\"center\">\n\n[G2](https://github.com/antvis/G2) is a visualization grammar for dashboard building, data exploration and storytelling.\n\nThis project was created to allow us to render [G2](https://github.com/antvis/G2) charts in streamlit. [Live Demo](https://antv-g2.streamlit.app/).\n\n![examples](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_GfqQoRCqQkAAAAAAAAAAAAADmJ7AQ/fmt.webp)\n\n[![PyPI version](https://badge.fury.io/py/streamlit-g2.svg)](https://badge.fury.io/py/streamlit-g2)\n[![Build Status](https://github.com/antvis/g2/workflows/build/badge.svg?branch=v5)](https://github.com/antvis//actions)\n[![Coverage Status](https://img.shields.io/coveralls/github/antvis/g2/v5.svg)](https://coveralls.io/github/antvis/g2?branch=v5)\n[![npm Version](https://img.shields.io/npm/v/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)\n[![npm Download](https://img.shields.io/npm/dm/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)\n[![npm License](https://img.shields.io/npm/l/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)\n\n</div>\n\n\n## Installation\n\n```\npip install streamlit-g2 \n```\n\n\n## Usage\n\n```py\nimport streamlit as st\nfrom streamlit_g2 import g2\n\noptions = {\n \"type\": \"interval\",\n \"data\": [\n { \"genre\": 'Sports', \"sold\": 275 },\n { \"genre\": 'Strategy', \"sold\": 115 },\n { \"genre\": 'Action', \"sold\": 120 },\n { \"genre\": 'Shooter', \"sold\": 350 },\n { \"genre\": 'Other', \"sold\": 150 },\n ],\n \"encode\": {\n \"x\": \"genre\",\n \"y\": \"sold\",\n \"color\": \"genre\",\n }\n}\n\ng2(options=options, style=None, key=\"streamlit_g2\")\n```\n\n<img src=\"https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*XqCnTbkpAkQAAAAAAAAAAAAADmJ7AQ/fmt.webp\" width=\"640\" alt=\"example\">\n\n\n## API\n\nNow, There is only one API for `streamlit-g2`, named `g2`, see the `options` in [G2 Spec API](https://g2.antv.antgroup.com/manual/core/api).\n\n| Property | Description | Type | Default |\n| -------- | --------------------------------------------------------------------------------------------------------------- | --------------------- | ------- |\n| options | the [options](https://g2.antv.antgroup.com/manual/core/api) for the visualization, say `chart.options(options)` | `G2options` \\| `null` | - |\n| style | the style of the container | `CSSProperties` | - |\n\n\n## Development\n\n- Building frontend code by running `npm run start` in fold `streamlit_g2/frontend`.\n- Run the example by running `streamlit run streamlit_g2/__init__.py` with `_RELEASE = False`.\n\n\n## License\n\nMIT@[hustcc](https://github.com/hustcc).\n",
"bugtrack_url": null,
"license": "",
"summary": "Render G2 charts in Streamlit",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/hustcc/streamlit-g2"
},
"split_keywords": [
"antv",
"g2",
"streamlit-component",
"streamlit-g2"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0ae5c89d0a5efc83c7410dcfe9b98d911a6a5980eb75c5289893475ce406dee8",
"md5": "e7c009ba7492c9717e36c8b4fdb7560e",
"sha256": "3ccee14cc8bad14c5c76b19bafbafd00d6c9107f9e899d57a506b4a67b9d80f4"
},
"downloads": -1,
"filename": "streamlit_g2-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7c009ba7492c9717e36c8b4fdb7560e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 1566044,
"upload_time": "2024-01-02T05:37:54",
"upload_time_iso_8601": "2024-01-02T05:37:54.063386Z",
"url": "https://files.pythonhosted.org/packages/0a/e5/c89d0a5efc83c7410dcfe9b98d911a6a5980eb75c5289893475ce406dee8/streamlit_g2-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "839d969730c25fa3a9b1647d1a03b86ce068e89d71b8d07d4e4ced146d68e85b",
"md5": "24629fbdd75ba6c77ca0ea40e5bcf647",
"sha256": "d7a52fc6844c7be39bab9dce4d138eff7d9942ce4472de1d7bdca154ddb30bbf"
},
"downloads": -1,
"filename": "streamlit-g2-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "24629fbdd75ba6c77ca0ea40e5bcf647",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 1549742,
"upload_time": "2024-01-02T05:37:58",
"upload_time_iso_8601": "2024-01-02T05:37:58.371747Z",
"url": "https://files.pythonhosted.org/packages/83/9d/969730c25fa3a9b1647d1a03b86ce068e89d71b8d07d4e4ced146d68e85b/streamlit-g2-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-02 05:37:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hustcc",
"github_project": "streamlit-g2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "streamlit-g2"
}