angular export chart div excel code example

Example: angular export chart div excel

<body>
    <!--Chart download link-->
   <a id="download" style="cursor: pointer; position: absolute;right: 150px;">ExportChart</a>
   <div id="container" ej-chart e-enablecanvasrendering="true" e-exportsettings-type="png"
   e-exportsettings-mode="client" e-exportsettings-filename="ChartSnapshot" >
   </div>
   <script>
   angular.module('syncApp', ['ejangular'])
   .controller('Chart', function ($scope) {
       });
   function download() {
    var canvas = $("#container").ejChart("export");
    this.href = canvas.toDataURL();
   }
   if (document.getElementById('download').addEventListener)
       document.getElementById('download').addEventListener('click', download, false);
   else
       document.getElementById('download').attachEvent('onclick', download, false);
    </script>
</body>

Tags:

Misc Example