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

How to send multiple datasets using node-jasper library? #64

Open
raoufxd opened this issue Nov 8, 2021 · 1 comment
Open

How to send multiple datasets using node-jasper library? #64

raoufxd opened this issue Nov 8, 2021 · 1 comment

Comments

@raoufxd
Copy link

raoufxd commented Nov 8, 2021

I have a task to generate PDFs with nodeJS, so i am working with the node-jasper library.

what i want to know is how can i send multiple datasets in order to fill multiple charts. I can only send one dataset (the main dataset):/

Steps that i followed:

  1. Create a new report and add a piechart and barchart
  2. I also create two datasets in the jasper reports named "dataset1" and "dataset2"
  3. I saved the report as ( "report.jrxml" and build it to get "report.jasper")
  4. In the nodejs part i want to do something like this but i cant find how
var report = {
       report: 'hw',
       data: {
           data1: "test data1", 
           title: "test title"
       },
       dataset1: [
           {
               c: "en",
               x: 'English',
               y: 40,
           },
           {   
               c: 'fr',
               x: 'French',
               y: 60,
           },
       ],
       dataset2: [
           {
               c: "usd",
               x: 'Dollar',
               y: 15,
           },
           {   
               c: 'eu',
               x: 'euro',
               y: 20,
           },
       ]
   }

   var pdf = jasper.pdf(report); 

can you help please ?

@dcsline
Copy link

dcsline commented Nov 13, 2021

@raoufxd: For your Task to generate PDFs - there are different ways with NodeJS. If you want PDF's based on reports, than is node-jaser a good choice. One possibility is to set up the data source in such a way that the data for the different charts can be obtained from it.

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