Exported image with p:linechart is not visible in Microsoft Photos

UI Components for JSF
Post Reply
Bertrand Perrier
Posts: 2
Joined: 07 Dec 2021, 10:06

09 Dec 2021, 10:52

Hello,

I am trying to use the new <p:lineChart> component based on ChartJs javascript library.

https://www.primefaces.org/showcase/ui/ ... fwid=312a1

Based on PrimeFaces showcase about the export function, I see a problem with the exported image in the "Chart as an image" dialog Box.

If you right-click to save the image, and visualize it with Microsoft Photos, graph is not visible.

It has a transparent background, and graphics elements are somehow merged with transparent background with an opcity of 0.1

Changing the background to a white background allows the image to be correctly displayed in Microsoft Photos.

I tried to override chartJs parameters with custom extender function, for example defaultColor to set opacity to 1, but it does not work in my case.

function customExtender() {
Chart.defaults.global.defaultColor = 'rgba(0,0,0,1)'
}

Could you please help on this issue ?

Versions Used :

JSF 2.2.20

PrimeFaces 10.0.0

chartJs 2.9.4

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

09 Dec 2021, 14:45

I would investigate it on the ChartsJS side as all PrimeFaces is calling is a ChartsJS function. Maybe open a ticket on the ChartsJS team side or look on Stack Overflow?

Code: Select all

var img = new Image();
        img.src = this.chart.toBase64Image();
        return img;
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests