em0ney / meteor-amcharts

AmCharts free, a responsive js chart framework, packaged for meteor
3 stars 8 forks source link

Fix export functionality #6

Open em0ney opened 9 years ago

em0ney commented 9 years ago

As per feedback from @jonlachlan we need to fix export functionality and include new examples with working exports

jonlachlan commented 9 years ago

I've worked out some kinks with this throughout the evening, thought I would share them.

Package.describe({
  name: "amcharts",
  summary: "my free version of amcharts",
  version: "3.14.0"
});

Package.on_use(function (api) {
  api.add_files('amcharts/amcharts.js', 'client',{'bare':true});
  api.add_files('amcharts/funnel.js', 'client');
  api.add_files('amcharts/gantt.js', 'client');
  api.add_files('amcharts/gauge.js', 'client');
  api.add_files('amcharts/pie.js', 'client');
  api.add_files('amcharts/radar.js', 'client');
  api.add_files('amcharts/serial.js', 'client');
  api.add_files('amcharts/xy.js', 'client');
  api.add_files('amcharts/images/dragIcon.gif', 'client');
  api.add_files('amcharts/images/dragIconBlack.gif', 'client');
  api.add_files('amcharts/images/dragIconH.gif', 'client');
  api.add_files('amcharts/images/dragIconHBlack.gif', 'client');
  api.add_files('amcharts/images/dragIconRectBig.png', 'client');
  api.add_files('amcharts/images/dragIconRectBigBlack.png', 'client');
  api.add_files('amcharts/images/dragIconRectBigBlackH.png', 'client');
  api.add_files('amcharts/images/dragIconRectBigH.png', 'client');
  api.add_files('amcharts/images/dragIconRectSmall.png', 'client');
  api.add_files('amcharts/images/dragIconRectSmallBlack.png', 'client');
  api.add_files('amcharts/images/dragIconRectSmallBlackH.png', 'client');
  api.add_files('amcharts/images/dragIconRectSmallH.png', 'client');
//  api.add_files('amcharts/images/dragIconHBlack.gif', 'client');
  api.add_files('amcharts/images/dragIconRoundBig.png', 'client');
  api.add_files('amcharts/images/dragIconRoundBigBlack.png', 'client');
  api.add_files('amcharts/images/dragIconRoundBigBlackH.png', 'client');
  api.add_files('amcharts/images/dragIconRoundBigH.png', 'client');
  api.add_files('amcharts/images/dragIconRoundSmall.png', 'client');
  api.add_files('amcharts/images/dragIconRoundSmallBlack.png', 'client');
  api.add_files('amcharts/images/dragIconRoundSmallBlackH.png', 'client');
  api.add_files('amcharts/images/dragIconRoundSmallH.png', 'client');
  api.add_files('amcharts/images/export.png', 'client');
  api.add_files('amcharts/images/exportWhite.png', 'client');
  api.add_files('amcharts/images/lens_old.png', 'client');
  api.add_files('amcharts/images/lens.png', 'client');
  api.add_files('amcharts/images/lensWhite_old.png', 'client');
  api.add_files('amcharts/images/lensWhite.png', 'client');
  api.add_files('amcharts/lang/az.js', 'client');
  api.add_files('amcharts/lang/bg.js', 'client');
  api.add_files('amcharts/lang/de.js', 'client');
  api.add_files('amcharts/lang/es.js', 'client');
  api.add_files('amcharts/lang/fi.js', 'client');
  api.add_files('amcharts/lang/fo.js', 'client');
  api.add_files('amcharts/lang/fr.js', 'client');
  api.add_files('amcharts/lang/hr.js', 'client');
  api.add_files('amcharts/lang/hu.js', 'client');
  api.add_files('amcharts/lang/id.js', 'client');
  api.add_files('amcharts/lang/is.js', 'client');
  api.add_files('amcharts/lang/it.js', 'client');
  api.add_files('amcharts/lang/lt.js', 'client');
  api.add_files('amcharts/lang/lv.js', 'client');
  api.add_files('amcharts/lang/mk.js', 'client');
  api.add_files('amcharts/lang/mn.js', 'client');
  api.add_files('amcharts/lang/mt.js', 'client');
  api.add_files('amcharts/lang/nl.js', 'client');
  api.add_files('amcharts/lang/no.js', 'client');
  api.add_files('amcharts/lang/pl.js', 'client');
  api.add_files('amcharts/lang/pt.js', 'client');
  api.add_files('amcharts/lang/ro.js', 'client');
  api.add_files('amcharts/lang/ru.js', 'client');
  api.add_files('amcharts/lang/rw.js', 'client');
  api.add_files('amcharts/lang/sk.js', 'client');
  api.add_files('amcharts/lang/so.js', 'client');
  api.add_files('amcharts/lang/th.js', 'client');
  api.add_files('amcharts/lang/tr.js', 'client');
  api.add_files('amcharts/patterns/black/pattern1.png', 'client');
  api.add_files('amcharts/patterns/black/pattern10.png', 'client');
  api.add_files('amcharts/patterns/black/pattern11.png', 'client');
  api.add_files('amcharts/patterns/black/pattern12.png', 'client');
  api.add_files('amcharts/patterns/black/pattern13.png', 'client');
  api.add_files('amcharts/patterns/black/pattern14.png', 'client');
  api.add_files('amcharts/patterns/black/pattern15.png', 'client');
  api.add_files('amcharts/patterns/black/pattern16.png', 'client');
  api.add_files('amcharts/patterns/black/pattern17.png', 'client');
  api.add_files('amcharts/patterns/black/pattern18.png', 'client');
  api.add_files('amcharts/patterns/black/pattern19.png', 'client');
  api.add_files('amcharts/patterns/black/pattern2.png', 'client');
  api.add_files('amcharts/patterns/black/pattern20.png', 'client');
  api.add_files('amcharts/patterns/black/pattern21.png', 'client');
  api.add_files('amcharts/patterns/black/pattern3.png', 'client');
  api.add_files('amcharts/patterns/black/pattern4.png', 'client');
  api.add_files('amcharts/patterns/black/pattern5.png', 'client');
  api.add_files('amcharts/patterns/black/pattern6.png', 'client');
  api.add_files('amcharts/patterns/black/pattern7.png', 'client');
  api.add_files('amcharts/patterns/black/pattern8.png', 'client');
  api.add_files('amcharts/patterns/black/pattern9.png', 'client');
  api.add_files('amcharts/patterns/chalk/pattern1.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern1r.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern2.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern3.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern4.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern5.jpg', 'client');
  api.add_files('amcharts/patterns/chalk/pattern6.jpg', 'client');
  api.add_files('amcharts/patterns/white/pattern1.png', 'client');
  api.add_files('amcharts/patterns/white/pattern10.png', 'client');
  api.add_files('amcharts/patterns/white/pattern11.png', 'client');
  api.add_files('amcharts/patterns/white/pattern12.png', 'client');
  api.add_files('amcharts/patterns/white/pattern13.png', 'client');
  api.add_files('amcharts/patterns/white/pattern14.png', 'client');
  api.add_files('amcharts/patterns/white/pattern15.png', 'client');
  api.add_files('amcharts/patterns/white/pattern16.png', 'client');
  api.add_files('amcharts/patterns/white/pattern17.png', 'client');
  api.add_files('amcharts/patterns/white/pattern18.png', 'client');
  api.add_files('amcharts/patterns/white/pattern19.png', 'client');
  api.add_files('amcharts/patterns/white/pattern2.png', 'client');
  api.add_files('amcharts/patterns/white/pattern20.png', 'client');
  api.add_files('amcharts/patterns/white/pattern21.png', 'client');
  api.add_files('amcharts/patterns/white/pattern3.png', 'client');
  api.add_files('amcharts/patterns/white/pattern4.png', 'client');
  api.add_files('amcharts/patterns/white/pattern5.png', 'client');
  api.add_files('amcharts/patterns/white/pattern6.png', 'client');
  api.add_files('amcharts/patterns/white/pattern7.png', 'client');
  api.add_files('amcharts/patterns/white/pattern8.png', 'client');
  api.add_files('amcharts/patterns/white/pattern9.png', 'client');
  api.add_files('amcharts/plugins/dataloader/dataloader.js', 'client');
  api.add_files('amcharts/plugins/dataloader/lang/_define.js', 'client');
  api.add_files('amcharts/plugins/dataloader/lang/en.js', 'client');
  api.add_files('amcharts/plugins/dataloader/lang/lt.js', 'client');
  api.add_files('amcharts/plugins/export/export.js', 'client');
  api.add_files('amcharts/plugins/export/export.css', 'client');
  api.add_files('amcharts/plugins/export/libs/blob.js/blob.js', 'client');
  api.add_files('amcharts/plugins/export/libs/fabric.js/fabric.js', 'client');
  api.add_files('amcharts/plugins/export/libs/FileSaver.js/FileSaver.js', 'client',{'bare':true});
  api.add_files('amcharts/plugins/export/libs/jszip/jszip.js', 'client');
  api.add_files('amcharts/plugins/export/libs/pdfmake/pdfmake.js', 'client');
  api.add_files('amcharts/plugins/export/libs/pdfmake/vfs_fonts.js', 'client');
  api.add_files('amcharts/plugins/export/libs/xlsx/xlsx.js', 'client',{'bare':true});
  api.add_files('amcharts/plugins/responsive/responsive.js', 'client');
  api.add_files('amcharts/themes/black.js', 'client');
  api.add_files('amcharts/themes/chalk.js', 'client');
  api.add_files('amcharts/themes/dark.js', 'client');
  api.add_files('amcharts/themes/light.js', 'client');
  api.add_files('amcharts/themes/patterns.js', 'client');
  api.add_files('amcharts/plugins/responsive/responsive.js', 'client');
  api.export("AmCharts","client");
  api.export("saveAs","client");
  api.export("XLSX","client");
});
if(!AmCharts.translations.dataLoader) {
  AmCharts.translations.dataLoader = {};
}

I don't like to add files within my packages, so I can drop in new versions easily, but I'm not sure how to get around it in this case...

// within your chart definition:
... 
 "pathToImages": "/packages/amcharts/lib/images/",
 "export": {
  "enabled": true,
  "libs": {
   "autoLoad": false
  }
 }
...
carlwithac commented 9 years ago

I added "autoLoad":false and added the export plugin .js files to my lib folder manually, fixed it.

charpeni commented 9 years ago

This should be fixed since the 3.17.3 release.