1 Answer 1

0
I found a workaround to convert chart into pdf: 

1. Converted chart to png image by using below method

 

    convertChartToImg(chartId): Observable<string> {
            return new Observable(observer => {
              const chart = document.querySelector(chartId);
              if (chart) {
                this.subs.add(this.captureService.getImage(canvas, true)
                  .pipe(
                    tap((img: string) => {
                      observer.next(img)
                    })
                  ).subscribe());
              }
            })
          }

2. Replaced chart with png image.
3. Updated my target element and send pdf.

Working example, please refer the below link:

https://stackblitz.com/edit/angular-ivy-y3x9we?file=src%2Fapp%2Fapp.module.ts,src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts,package.json

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.