RelaxedJS / ReLaXed

Create PDF documents using web technologies
ISC License
11.8k stars 428 forks source link

Pass variables to chartjs or vegalite from command line. #122

Open cerebroo opened 5 years ago

cerebroo commented 5 years ago

Thanks for such a great package.

We can pass variables to pug from command line. But is it somehow possible to further pass those variables to vegalite or chartjs files?

My use case is to programatically generate PDFs with same layout but slightly different text in html and different data in charts.

Zulko commented 5 years ago

I'm not sure I understand the full use case, could you provide more details ?

cerebroo commented 5 years ago

@Zulko - Our users login to our web dashboard and select a month and and a particular salesman and and hit export report button. We want to use ReLaXed to export sales activity of select salesman for selected month in a pdf. Irrespective of selected month and selected salesman, the design of pdf will be same but:

  1. Some text in pdf e.g. salesman's name, month and sales numbers will differ. We can achieve this by passing this data as json through commandline.
  2. We will use chartjs for charts in pdfs and data in these charts will differ based on selected salesman and selected month. So if we can somehow pass the data through command line to chartjs file as well just like we pass it to pug file, that will be awesome.

Hope I have done a better job in explaining my use case this time.