Skip to main content

Library that takes as input config and datasets for highcharts, and outputs SVG image of rendered chart

Project description

Utluna Chart SVG Renderer

Using chrome-driver


!!! Important !!!

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

echo "" >> /etc/apk/repositories
echo "" >> /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


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>{}</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(

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" ""><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="">

which is an SVG file contents


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



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ut2chartrender, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size ut2chartrender-0.0.6-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ut2chartrender-0.0.6.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page