• Exporting without amcharts


    Once you have all that you are ready to create your export instance and generate the files like following:
    <script type="text/javascript">
        // Server namespace with required variables
        window.AmCharts = {
            translations: {},
            addInitHandler: function() { /* NOOP */ }
        };
    </script>
    
    <script type="text/javascript" src="http://amcharts.com/lib/3/plugins/export/export.js"></script>
    
    <!-- REQUIRED FOR EXCEL -->
    <script type="text/javascript" src="http://amcharts.com/lib/3/plugins/export/libs/jszip/jszip.js"></script>
    <script type="text/javascript" src="http://amcharts.com/lib/3/plugins/export/libs/xlsx/xlsx.js"></script>
    
    <!-- REQUIRED FOR DOWNLOAD -->
    <script type="text/javascript" src="http://amcharts.com/lib/3/plugins/export/libs/FileSaver.js/FileSaver.js"></script>
    
    <!-- REQUIRED FOR PDF, png,jpg,annotate,print-->
    <script type="text/javascript" src="http://www.amcharts.com/lib/3/plugins/export/libs/fabric.js/fabric.js"></script>
    <script type="text/javascript" src="http://www.amcharts.com/lib/3/plugins/export/libs/pdfmake/pdfmake.js"></script>
    <script type="text/javascript" src="http://www.amcharts.com/lib/3/plugins/export/libs/pdfmake/vfs_fonts.js"></script>
    <!-- ACTUAL MAGICAL PART --> <script type="text/javascript"> // CREATE EXPORT INSTANCE var ame = new AmCharts.export({},{ // Export settings }); // DATA ARRAY var data = [ {"country": "USA","visits": 2025}, {"country": "China","visits": 1882}, {"country": "Japan","visits": 1809}, {"country": "Germany ","visits": 1322}, {"country": "UK","visits": 1122}, {"country": "France","visits": 1114}, {"country": "India","visits": 984}, {"country": "Spain","visits": 711}, {"country": "Netherlands","visits": 665}, {"country": "Russia","visits": 580}, {"country": "South Korea","visits": 443}, {"country": "Canada","visits": 441}, {"country": "Brazil","visits": 395} ]; // CONVERT DATA TO CSV ame.toCSV({ data: data // CONVERT CALLBACK },function(output) { var info = this.defaults.formats.CSV; var filename = this.config.filename + "." + info.extension; var mimetype = info.mimeType; // OFFER OUTPUT AS DOWNLOAD this.download(output,mimetype,filename); }); </script>
  • 0 comments:

    Post a Comment

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari