Пример #1
0
def index():
    # Instantiate the ExportConfig class and add the required configurations
    export_config = ExportConfig()

# Provide path of the chart configuration which we have defined above.
# You can also pass the same object as serialized JSON.
    export_config["chartConfig"] = open("C:/Users/a563684/Documents/Angular/testrouting/src/app/home/chart-config-file1.json",'r').read()

# ATTENTION - Pass the path of the dashboard template
    export_config["templateFilePath"] = "C:/Users/a563684/Documents/Angular/testrouting/src/app/home/dashboard-template.html"

# Provide port and host of FusionExport Service
    export_server_host = "127.0.0.1"
    export_server_port = 1337

# Instantiate the ExportManager class
    em = ExportManager(export_server_host, export_server_port)

# Call the export() method with the export_config as its argument
    em.export(export_config, output_dir=".", unzip = True)
    return "Hello, Fusion"
Пример #2
0
#!/usr/bin/env python

from fusionexport import ExportManager, ExportConfig  # Import sdk

# Instantiate the ExportConfig class and add the required configurations
export_config = ExportConfig()
export_config["chartConfig"] = "chart-config-file.json"
export_config["quality"] = "best"

# Provide port and host of FusionExport Service
export_server_host = "127.0.0.1"
export_server_port = 1337

# Instantiate the ExportManager class
em = ExportManager(export_server_host, export_server_port)
# Call the export() method with the export config and the output location
exported_files = em.export(export_config, "./exports")
print(exported_files)
# Import FusionExport SDK client for Python
from fusionexport import ExportManager, ExportConfig
import os

# Instantiate ExportConfig and ExportManager
export_config = ExportConfig()
export_manager = ExportManager()

# Fetch the curr directory of the template
curr_dir = os.path.dirname(os.path.abspath(__file__))
template_path = os.path.join(curr_dir, 'template.html')

# Set all the configurations
export_config['templateFilePath'] = template_path
export_config['type'] = 'pdf'
export_config['templateFormat'] = 'A4'
export_config['asyncCapture'] = True

# Export your first PDF
export_manager.export(export_config, unzip=True)
Пример #4
0
from fusionexport import ExportManager, ExportConfig  # Import sdk

# Instantiate the ExportConfig class and add the required configurations
export_config = ExportConfig()

export_config["chartConfig"] = "resources/single.json"
export_config["type"] = 'csv'
# Instantiate the ExportManager class
em = ExportManager()

# Call the export() method with the export config and the output location
exported_files = em.export(export_config, "./exported-charts", True)

# print list of exported files
print(exported_files)
Пример #5
0
from fusionexport import ExportManager, ExportConfig

export_config = ExportConfig()
export_config["chartConfig"] = "resources/chartconfig_big.json"
export_config["templateFilePath"] = "resources/dashboard_big_template.html"

em = ExportManager(minify_resources=True)
exported_files = em.export(export_config, "./exported", True)
print(exported_files)
Пример #6
0
def chart(request):

    #Chart data is passed to the `dataSource` parameter, like a dictionary in the form of key-value pairs.
    dataSource = OrderedDict()

    # The `chartConfig` dict contains key-value pairs of data for chart attribute
    chartConfig = OrderedDict()
    chartConfig["caption"] = "MY EXPENDITURE"
    chartConfig["subCaption"] = "Powered by Bon-Appetite"
    chartConfig["xAxisName"] = "DATE"
    chartConfig["yAxisName"] = "AMOUNT"
    chartConfig["theme"] = "candy"

    current_user = request.user
    datem = datetime.today().strftime("%Y-%m")
    #month=datetime.today().strftime("%b")
    dataset = bill.objects.filter(uid=current_user.username,
                                  date__contains=datem).values('bill', 'date')
    dataSource["chart"] = chartConfig
    dataSource["data"] = []

    for entry in dataset:
        usero = {}
        usero["label"] = entry['date']
        usero["value"] = int(entry['bill'])
        dataSource["data"].append(usero)

    line2D = FusionCharts("line", "Hello", "600", "400", "container", "json",
                          dataSource)

    # Instantiate the ExportConfig class and add the required configurations
    export_config = ExportConfig()

    # Provide path of the chart configuration which we have defined above.
    # You can also pass the same object as serialized JSON.
    d = [{
        "type": "line",
        "renderAt": "container",
        "width": "600",
        "height": "400",
        "dataFormat": "json",
        "dataSource": dataSource
    }]
    export_config.set('chartConfig', d)
    export_config.set("outputFile", current_user.username)

    export_server_host = "127.0.0.1"
    export_server_port = 1337

    em = ExportManager(export_server_host, export_server_port)

    em.export(export_config,
              output_dir="C:\\Users\\Neha\\sem5\\zom\\bonbon",
              unzip=True)
    bill.img = "C:\\Users\\Neha\\sem5\\zom\\bonbon\\man.png"

    html_content = render_to_string('mail.html')
    #html_content= '<b> This is your expenditure : </b> <img src="cid:C:\\Users\\Neha\\sem5\\zom\\export.png" >'
    text_content = strip_tags(html_content)

    # create the email, and attach the HTML version as well.
    subject = 'Thank you for registering to our site'
    email_from = settings.EMAIL_HOST_USER
    recipient_list = ['*****@*****.**', '*****@*****.**']
    msg = EmailMultiAlternatives(subject, text_content, email_from,
                                 recipient_list)
    msg.attach_alternative(html_content, "text/html")
    msg.send()

    return render(request, 'graph.html', {'output': line2D.render()})
#!/usr/bin/env python

from fusionexport import ExportManager, ExportConfig  # Import sdk

# Instantiate the ExportConfig class and add the required configurations
export_config = ExportConfig()
export_config["chartConfig"] = "bulk.json"

# Provide port and host of FusionExport Service
export_server_host = "127.0.0.1"
export_server_port = 1337

# Instantiate the ExportManager class
em = ExportManager(export_server_host, export_server_port)
# Call the export() method with the export config and the output location
exported_files = em.export(export_config, "./exports",
                           False)  # here False for exporting as zip format
print(exported_files)
Пример #8
0
from fusionexport import ExportManager, ExportConfig

# Instantiate the ExportConfig class and add the required configurations
export_config = ExportConfig()

# Provide path of the chart configuration which we have defined above.
# You can also pass the same object as serialized JSON.
export_config["chartConfig"] = open("app/home/chart-config-file.json", 'r')

# ATTENTION - Pass the path of the dashboard template
export_config["templateFilePath"] = "app/home/home.component.html.html"

# Provide port and host of FusionExport Service
export_server_host = "127.0.0.1"
export_server_port = 1337

# Instantiate the ExportManager class
em = ExportManager(export_server_host, export_server_port)

# Call the export() method with the export_config as its argument
em.export(export_config, outputDir="./app", unzip=True)