`charts.css.py` brings `charts.css` to Python. Online documentation and samples is available at the link below.

Overview

charts.css.py

charts.css.py provides a python API to convert your 2-dimension data lists into html snippet, which will be rendered into charts by CSS, when serving inside a browser.

  • The output of charts.css.py is not images. Consequently, charts.css.py is a pure Python package without any image library dependency. You can use charts.css.py on any platform.
  • The output of charts.css.py is a normal HTML table. Search engines and screen readers will be able to consume your data even when CSS rendering is unavailable.
  • Once the html snippet is delivered into the browser window, the rendering is done by CSS, which is typically faster than JS-heavy chart libraries.
  • Since the output is normal HTML, you could customize its size and position, by defining your own CSS styles.

Installation

pip install charts.css.py

Usage

Just combine the output of charts.css.py functions and the predefined CSS style <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/charts.css/dist/charts.min.css"> into your html page.

For example, the following code snippet can convert a 2-dimension list into column chart:

from charts.css import column
STYLESHEET = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/charts.css/dist/charts.min.css">'
chart = column(
    [
        ["Continent", "1st year", "2nd year", "3rd year", "4th year", "5th year"],
        ["Asia", 20.0, 30.0, 40.0, 50.0, 75.0],
        ["Euro", 40.0, 60.0, 75.0, 90.0, 100.0],
    ],
    headers_in_first_row=True,
    headers_in_first_column=True,
    )
# Now, variable chart contains html snippet of "<table>...</table>", and
# STYLESHEET is just a constant string of "<link href='https://.../charts.css'>".
# You can somehow insert them into the proper places of your full html page.
# Here in this sample, we take a shortcut by simply concatenating them.
open("output.html", "w").write(STYLESHEET + chart)

The output.html will be rendered in browser like this:

Sample output

Advanced Usage

There are currently 4 different charts implemented: bar, column, line, area. All those methods support many parameters to further customize the chart appearance. bar() and column() also support stacking by value or stacking by percentage. All those features are demonstrated in the different samples in this document.

Lastly, this package also provides a command-line tool csv2chart. You can use it to convert csv file into an html file. For example, csv2chart sample.csv output.html. You can also run csv2chart -h to know all the parameters it supports.

Versioning

charts.css.py uses Semantic Versioning.

You might also like...
🐞 📊 Ladybug extension to generate 2D charts

ladybug-charts Ladybug extension to generate 2D charts. Installation pip install ladybug-charts QuickStart import ladybug_charts API Documentation Loc

GitHub English Top Charts

Help you discover excellent English projects and get rid of the interference of other spoken language.

Data-FX is an addon for Blender (2.9) that allows for the visualization of data with different charts
Data-FX is an addon for Blender (2.9) that allows for the visualization of data with different charts

Data-FX Data-FX is an addon for Blender (2.9) that allows for the visualization of data with different charts Currently, there are only 2 chart option

Glue is a python project to link visualizations of scientific datasets across many files.
Glue is a python project to link visualizations of scientific datasets across many files.

Glue Glue is a python project to link visualizations of scientific datasets across many files. Click on the image for a quick demo: Features Interacti

Flipper Zero documentation repo

Flipper Zero Docs Participation To fix a bug or add something new to this repository, you need to open a pull-request. Also, on every page of the site

A tool for automatically generating 3D printable STLs from freely available lidar scan data.
A tool for automatically generating 3D printable STLs from freely available lidar scan data.

mini-map-maker A tool for automatically generating 3D printable STLs from freely available lidar scan data. Screenshots Tutorial To use this script, g

A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.
A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.

Update ! ANONFILE MIGHT NOT WORK ! About A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe w

Debugging, monitoring and visualization for Python Machine Learning and Data Science
Debugging, monitoring and visualization for Python Machine Learning and Data Science

Welcome to TensorWatch TensorWatch is a debugging and visualization tool designed for data science, deep learning and reinforcement learning from Micr

Python module for drawing and rendering beautiful atoms and molecules using Blender.

Batoms is a Python package for editing and rendering atoms and molecules objects using blender. A Python interface that allows for automating workflows.

Comments
  • charts.css.py 0.4.0

    charts.css.py 0.4.0

    This release adds some helper and parameters to help you fine tune the chart appearance. They are especially useful when you attempt to render some csv data input with many rows.

    • Feature: A transpose(...) helper to flip your input data diagonally so that it swaps its x-axis and y-axis.
    • Feature: New parameter hide_label. It is useful when primary axis contains too many rows.
    • Feature: New parameter tooltip_builder which has a shape of lambda value="...", label="...": "...".
    • Feature: New parameter value_converter which typically will be assigned with either int or float.
    • Change: By default, data axes will no longer be shown. You can turn it back on by the new show_data_axes parameter.

    The online documentation will be updated to demonstrate these new features.

    opened by rayluo 0
  • Release 0.3.0

    Release 0.3.0

    • Line chart should not accept non-zero data_spacing or datasets_spacing. Now it would rightfully reject such an input.
    • Provide an online document/sample
    • Backport to Brython 3.7 and 3.8. The recommended Brython version is still its latest version, currently 3.9.
    opened by rayluo 0
  • charts.css.py 0.1.0

    charts.css.py 0.1.0

    The first release contains:

    • Basic functionality including bar, column, line and area
    • An experimental helper wrapper
    • Barely enough documentation in README.md
    • Also comes with a command-line tool csv2chart. I use it for my ad-hoc test. Let me know if you find it useful.
    opened by rayluo 0
Releases(0.4.0)
  • 0.4.0(Jun 27, 2021)

    This release adds some helper and parameters to help you fine tune the chart appearance. They are especially useful when you attempt to render some csv data input with many rows.

    • Feature: A transpose(...) helper to flip your input data diagonally so that it swaps its x-axis and y-axis.
    • Feature: New parameter value_converter which typically will be assigned with either int or float. With its help, now you can consume data directly from csv by data = list(csv.reader(f)).
    • Feature: New parameter hide_label. It is useful when primary axis contains too many rows.
    • Feature: New parameter tooltip_builder which has a shape of lambda value="...", label="...": "...".
    • Change: By default, data axes will no longer be shown. You can turn it back on by the new show_data_axes parameter.

    The online documentation ~will be~ has been updated to demonstrate these new features.

    Source code(tar.gz)
    Source code(zip)
    charts.css.py-brython.js(8.11 KB)
  • 0.3.0(May 23, 2021)

    • Line chart should not accept non-zero data_spacing or datasets_spacing. Now it would rightfully reject such an input.
    • Provide an online document/sample
    • Backport to Brython 3.7 and 3.8. The recommended Brython version is still its latest version, currently 3.9.
    • Also hosted as a Brython package which can be used by <script src="https://github.com/rayluo/charts.css.py/releases/download/0.3.0/charts.css.py-brython.js"></script>. Requires Brython 3.7.5 or above.
    Source code(tar.gz)
    Source code(zip)
    charts.css.py-brython.js(7.20 KB)
  • 0.2.0(May 17, 2021)

  • 0.1.0(May 14, 2021)

    The first release contains:

    • Basic functionality including bar, column, line and area
    • An experimental helper wrapper
    • Barely enough documentation in README.md
    • Also comes with a command-line tool csv2chart. I use it for my ad-hoc test. Let me know if you find it useful.
    Source code(tar.gz)
    Source code(zip)
Displaying plot of death rates from past years in Poland. Data source from these years is in readme

Average-Death-Rate Displaying plot of death rates from past years in Poland The goal collect the data from a CSV file count the ADR (Average Death Rat

Oliwier Szymański 0 Sep 12, 2021
Data parsing and validation using Python type hints

pydantic Data validation and settings management using Python type hinting. Fast and extensible, pydantic plays nicely with your linters/IDE/brain. De

Samuel Colvin 12.1k Jan 06, 2023
Frbmclust - Clusterize FRB profiles using hierarchical clustering, plot corresponding parameters distributions

frbmclust Getting Started Clusterize FRB profiles using hierarchical clustering,

3 May 06, 2022
A workshop on data visualization in Python with notebooks and exercises for following along.

Beyond the Basics: Data Visualization in Python The human brain excels at finding patterns in visual representations, which is why data visualizations

Stefanie Molin 162 Dec 05, 2022
Python+Numpy+OpenGL: fast, scalable and beautiful scientific visualization

Python+Numpy+OpenGL: fast, scalable and beautiful scientific visualization

Glumpy 1.1k Jan 05, 2023
Python package for the analysis and visualisation of finite-difference fields.

discretisedfield Marijan Beg1,2, Martin Lang2, Samuel Holt3, Ryan A. Pepper4, Hans Fangohr2,5,6 1 Department of Earth Science and Engineering, Imperia

ubermag 12 Dec 14, 2022
Python package to Create, Read, Write, Edit, and Visualize GSFLOW models

pygsflow pyGSFLOW is a python package to Create, Read, Write, Edit, and Visualize GSFLOW models API Documentation pyGSFLOW API documentation can be fo

pyGSFLOW 21 Dec 14, 2022
An animation engine for explanatory math videos

Powered By: An animation engine for explanatory math videos Hi there, I'm Zheer 👋 I'm a Software Engineer and student!! 🌱 I’m currently learning eve

Zaheer ud Din Faiz 2 Nov 04, 2021
Rockstar - Makes you a Rockstar C++ Programmer in 2 minutes

Rockstar Rockstar is one amazing library, which will make you a Rockstar Programmer in just 2 minutes. In last decade, people learned C++ in 21 days.

4k Jan 05, 2023
Flow-based visual scripting for Python

A simple visual node editor for Python Ryven combines flow-based visual scripting with Python. It gives you absolute freedom for your nodes and a simp

Leon Thomm 3.1k Jan 06, 2023
股票行情实时数据接口-A股,完全免费的沪深证券股票数据-中国股市,python最简封装的API接口

股票行情实时数据接口-A股,完全免费的沪深证券股票数据-中国股市,python最简封装的API接口,包含日线,历史K线,分时线,分钟线,全部实时采集,系统包括新浪腾讯双数据核心采集获取,自动故障切换,STOCK数据格式成DataFrame格式,可用来查询研究量化分析,股票程序自动化交易系统.为量化研究者在数据获取方面极大地减轻工作量,更加专注于策略和模型的研究与实现。

dev 572 Jan 08, 2023
Using SQLite within Python to create database and analyze Starcraft 2 units data (Pandas also used)

SQLite python Starcraft 2 English This project shows the usage of SQLite with python. To create, modify and communicate with the SQLite database from

1 Dec 30, 2021
HiPlot makes understanding high dimensional data easy

HiPlot - High dimensional Interactive Plotting HiPlot is a lightweight interactive visualization tool to help AI researchers discover correlations and

Facebook Research 2.4k Jan 04, 2023
erdantic is a simple tool for drawing entity relationship diagrams (ERDs) for Python data model classes

erdantic is a simple tool for drawing entity relationship diagrams (ERDs) for Python data model classes. Diagrams are rendered using the venerable Graphviz library.

DrivenData 129 Jan 04, 2023
Flexitext is a Python library that makes it easier to draw text with multiple styles in Matplotlib

Flexitext is a Python library that makes it easier to draw text with multiple styles in Matplotlib

Tomás Capretto 93 Dec 28, 2022
Python Data. Leaflet.js Maps.

folium Python Data, Leaflet.js Maps folium builds on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js

6k Jan 02, 2023
:art: Diagram as Code for prototyping cloud system architectures

Diagrams Diagram as Code. Diagrams lets you draw the cloud system architecture in Python code. It was born for prototyping a new system architecture d

MinJae Kwon 27.5k Dec 30, 2022
2D maze path solver visualizer implemented with python

2D maze path solver visualizer implemented with python

SS 14 Dec 21, 2022
Uniform Manifold Approximation and Projection

UMAP Uniform Manifold Approximation and Projection (UMAP) is a dimension reduction technique that can be used for visualisation similarly to t-SNE, bu

Leland McInnes 6k Jan 08, 2023
Plotting library for IPython/Jupyter notebooks

bqplot 2-D plotting library for Project Jupyter Introduction bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar

3.4k Dec 30, 2022