EmbeddedData

class visigoth.common.embedded_data.EmbeddedData(data, text='Download', filename=None, columns=None, column_labels={}, zip=True, font_height=24, text_attributes={}, hint='(Right Click + Save Link As...)')

Create an embedded data link

Parameters

data – A relational data set (for example, list of dicts/lists/tuples describing each row)

Example

(Link to open example in new tab):

Source Code (Link to Github):

# -*- coding: utf-8 -*-

from visigoth import Diagram
from visigoth.common import EmbeddedData

data = [("A",10),("B",4),("D",12),("D.2",3),("D.3",5)]*100

d = Diagram()

eh1 = EmbeddedData(data,"Download data as a zipped CSV",filename="data.csv",
                   column_labels={0:"LETTER",1:"NUMBER"})
d.add(eh1)

eh2 = EmbeddedData(data,"Download data as CSV",filename="data.csv",zip=False,
                   column_labels={0:"LETTER",1:"NUMBER"})
d.add(eh2)

html = d.draw(format="html")

f = open("example.html", "w")
f.write(html)
f.close()