Home Forums Chart Support base64 Reply To: base64


What i do is:

Create a Form with POST Method and a text area inside with style=”display:none;” to hidde it.

<form action="/GetBase64Chart/" method="post" name="formToSendBase64" id="formToSendBase64">
    <textarea style="display:none;" id="txtareaBase64" name="txtareaBase64"> </textarea>

and with JS i create a button to “Export” the Base64 to the backend. Then i get the base64 of the canvas chart and i passed it to the textarea value like in the next code…

$("#exportButton").click(function () {
                var canvas = $("#Chart .canvasjs-chart-canvas").get(0);

                var dataURL = canvas.toDataURL();

                document.getElementById("txtareaBase64").value = dataURL;

                var form = document.getElementById("formToSendBase64");