Skip to content

Render as png and access in code behind #10

@jeffmun

Description

@jeffmun

I'm ultimately trying to get google charts saved into a PDF. So it seems like the first step is exporting them as png. I've been able to render them on the page as an image by inserting the following into the AjaxCallback function (found in SendAndDraw.js) right before the draw method.

        /* to render as png */
        google.visualization.events.addListener(chart, 'ready', function () {
            container.innerHTML = '<img src="' + chart.getImageURI() + '">';
            console.log(container.innerHTML);
        });

        chart.draw(view, options);

However, I'm not sure how to save this as a file on the server or how to access the binary image data directly in code behind and skip the save to file part. All my google charts are being created dynamically (based on DataTables that the user creates by selecting the data they wish to view) and are dynamically placed into table cells depending on the number of charts needed.

I only really need these images when the user clicks "Export to PDF". Before that I want to render them natively so that the tool tips, etc. are available.

Working with JavaScript is really new to me so I'm not very clear about where to implement getting the binary image data for each chart on the page. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions