Skip to main content

Utluna Chart SVG Renderer

Using chrome-driver

Installation

!!! Important !!!

Make sure you have chrome-driver installed On Alpine v3.10, run:

echo "https://dl-4.alpinelinux.org/alpine/v3.10/main" >> /etc/apk/repositories
echo "https://dl-4.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories
apk update
apk add chromium chromium-chromedriver

Once chrome driver is successfully installed, install the library itself:

Use the package manager pip to install ut2chartrenderer.

pip installation instructions are here

pip install ut2chartrender

Usage

Import library

import ut2chartrender

Define settings in such way:

settings = {
  "options": {
    "title": {
      "text": "Atmosphere Temperature by Altitude"
    },
    "subtitle": {
      "text": "According to the Standard Atmosphere Model"
    },
    "xAxis": {
      "reversed": false,
      "title": {
        "enabled": true,
        "text": "Altitude"
      },
      "labels": {
        "formatter": "function () { return this.value + \"km\"; }"
      },
      "maxPadding": 0.05,
      "showLastLabel": true
    },
    "yAxis": {
      "title": {
        "text": "Temperature"
      },
      "labels": {
        "formatter": "function () { return this.value + \"°\"; }"
      },
      "lineWidth": 2
    },
    "legend": {
      "enabled": true
    },
    "tooltip": {
      "headerFormat": "<b>{series.name}</b><br/>",
      "pointFormat": "{point.x} km: {point.y}°C"
    }
  },
  "datasets": [
    {
      "name": "Temperature by altitude",
      "series_type": "spline",
      "marker": {
        "enabled": true
      },
      "data": [
        [0, 15],[10, -50],[20, -56.5],[30, -46.5],[40, -22.1],[50, -2.5],[60, -27.7],[70, -55.7],[80, -76.5]
      ]
    }
  ]
}

Finally generate chart: Way #1:

svg_xml = ut2chartrender.generate_chart(**settings)

or way #2:

svg_xml = ut2chartrender.generate_chart(
    options=settings["options"],
    datasets=settings["datasets"
)

If you dump svg_xml variable, you should see something like this:

<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="highcharts-root" height="400" style='font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif;font-size:12px;' version="1.1" viewbox="0 0 800 400" width="800" xmlns="http://www.w3.org/2000/svg">

which is an SVG file contents

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Metadata

Release files for ut2chartrender 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ut2chartrender 0.0.6
File Size Uploaded Provenance Actions
ut2chartrender-0.0.6.tar.gz 3.9 kB Without provenance Details for ut2chartrender-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ut2chartrender 0.0.6
File Interpreter ABI Platform Actions
ut2chartrender-0.0.6-py3-none-any.whl Python 3 none any Details for ut2chartrender-0.0.6-py3-none-any.whl

Total release size: 8.8 kB

Release files / ut2chartrender-0.0.6.tar.gz

Download URL ut2chartrender-0.0.6.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d5860fadfc66cb45e44255a3fc827ccb764c4303246d3fc721ccd385794651a2
BLAKE2b-256 checksum
How to use checksums
db0343f72e2b8ef03959770c2d91f28269da7c0d43fef818abe7f5dbb26b2972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.3

Release files / ut2chartrender-0.0.6-py3-none-any.whl

Download URL ut2chartrender-0.0.6-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b14ae2b05d18cc74c010ca52c85abaebc1b1b897846849d3b0dfc9aa91f478
BLAKE2b-256 checksum
How to use checksums
59c04ae30753e8847492f2ef0eb816ce1f991fa101f46b96b30e399292040f36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.3

Security for ut2chartrender 0.0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page