Easily create data visualization of static or streaming data
Get Started
pip install easycharts
Create EasyCharts Server
# charts.py
from fastapi import FastAPI
from easycharts import ChartServer
server = FastAPI()
@server.on_event('startup')
async def setup():
server.charts = await ChartServer.create(
server,
charts_db="test"
)
await server.charts.create_dataset(
"test",
labels=['a', 'b', 'c', 'd'],
dataset=[1,2,3,4]
)
Start Server
uvicorn --host 0.0.0.0 --port 0.0.0.0 charts:server
Update Data via API
In a separate window, access the OpenAPI docs to demonstrate dynanimc updates to the graph
http://0.0.0.0:8220/docs
Line
Bar
APIS
Real World Usage - Resource Monitoring
import datetime, psutil
import asyncio
from fastapi import FastAPI
from easycharts import ChartServer
from easyschedule import EasyScheduler
scheduler = EasyScheduler()
server = FastAPI()
every_minute = '* * * * *'
@server.on_event('startup')
async def setup():
asyncio.create_task(scheduler.start())
server.charts = await ChartServer.create(
server,
charts_db="charts_database",
chart_prefix = '/mycharts'
)
await server.charts.create_dataset(
"test",
labels=['a', 'b', 'c', 'd'],
dataset=[1,2,3,4]
)
# set initial sync time
label=datetime.datetime.now().isoformat()[11:19]
await server.charts.create_dataset(
'cpu',
labels=[label],
dataset=[psutil.cpu_percent()]
)
await server.charts.create_dataset(
'mem',
labels=[label],
dataset=[psutil.virtual_memory().percent]
)
@scheduler(schedule=every_minute)
async def resource_monitor():
time_now=datetime.datetime.now().isoformat()[11:19]
# updates CPU & MEM datasets with current time
await server.charts.update_dataset(
'cpu',
label=time_now,
data=psutil.cpu_percent()
)
await server.charts.update_dataset(
'mem',
label=time_now,
data=psutil.virtual_memory().percent
)
Metadata
Release files for easycharts 0.106
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easycharts-0.106-py3-none-any.whl | Python 3 | none | any | Details for easycharts-0.106-py3-none-any.whl |
Release files / easycharts-0.106-py3-none-any.whl
| Download URL | easycharts-0.106-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab90d2bd1b55f9d159a18ed3e2a5b9d4be2a9449ba83d545300e28f22ac3fb0b
|
|
BLAKE2b-256 checksum How to use checksums |
14652a5d51d4e5132857aa4bd1913fff934a21128a02a270d6a31adfac8c293f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Security for easycharts 0.106
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.