Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback option not working #8

Closed
webroru opened this issue Dec 12, 2016 · 1 comment
Closed

Callback option not working #8

webroru opened this issue Dec 12, 2016 · 1 comment

Comments

@webroru
Copy link

webroru commented Dec 12, 2016

I try use the callback option as described here: http://www.highcharts.com/docs/export-module/render-charts-serverside. But its seems this options work another at your package.

My code:

//Include the exporter module
const exporter = require('highcharts-export-server');

//Export settings
var exportSettings = {
  type: 'pdf',
  instr: {
    title: {
      text: 'My Chart'
    },
    xAxis: {
      categories: ["Jan", "Feb", "Mar", "Apr", "Mar", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
    },
    series: [
      {
        type: 'line',
        data: [1, 3, 2, 4]
      },
      {
        type: 'line',
        data: [5, 3, 4, 2]
      }
    ]
  },
  callback: function (chart) { chart.renderer.arc(200, 150, 100, 50, -Math.PI, 0).attr({ fill: '#FCFFC5', stroke: 'black', 'stroke-width': 1 }).add(); },
  outfile: 'test.pdf',
};

//Set up a pool of PhantomJS workers
exporter.initPool();

/*
 Export settings corresponds to the available CLI arguments described
 above.
 */
exporter.export(exportSettings, function (err, res) {
  exporter.killPool();
});
@cvasseng
Copy link
Contributor

Hi webroru, the callback needs to be a string.

A future enhancement may remove this requirement when using the export server as a node module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants