render_sparkline_table_png

Documentation for eth_defi.research.sparkline.render_sparkline_table_png function.

render_sparkline_table_png(vault_prices_df)

Rasterise the canonical website sparkline for blog and email tables.

Render the 100 x 25 SVG directly onto a 300 x 75 canvas. Uniform scaling preserves the observations, step path, time bounds, vertical padding, gradient and round joins, including a 3 px counterpart of the SVG’s 1 px stroke. Resizing the legacy square PNG would compress these vertically.

See the CairoSVG conversion API.

Parameters

vault_prices_df (Union[pandas.DataFrame, eth_defi.research.sparkline.SparklineData, bytes]) – Prepared sparkline data or a single-vault DataFrame indexed by naive UTC timestamps with a finite numeric share_price column. Canonical SVG bytes are also accepted, allowing publication to rasterise the exact SVG payload it uploads without preparing the observations twice.

Returns

Native 4:1 PNG bytes suitable for a 72 x 18 HTML image.

Return type

bytes