Stephanevg / PSHTML

Cross platform Powershell module to generate HTML markup language
https://pshtml.readthedocs.io/en/latest/
Other
165 stars 43 forks source link

Render charts in Base64 format #258

Closed LxLeChat closed 5 years ago

LxLeChat commented 5 years ago

Pull Request [Topic]

Added new feature to New-PSHTMLChart. Add the ability to transform the charts to base64 img in the html (when the html is executed for the moment ... )

Please tell us , the type of Change you are submiting:

Select one of the following:

Does it fix an existing issue? Please tell us which one

Related to the following issues: #221 #255 #220

Description of what's been changed

-Added a new switch tobase64 to the New-PSHTMLChart -Added a new condition inside New-PSHTMLChartwhen ToBase64 is used. this will change the default value of the onComplete event of the current chart to this:

if ($tobase64) {
     $ChartOptions.animation.onComplete = 'RemoveCanvasAndCreateBase64Image'
}

-Added a ChartAnimation class to add the animation option for chartoptions -Added a new GetDefinition override in the chart class, this override add a javascript function called RemoveCanvasAndCreateBase64Image. The function to transform the chart into a base64, then create a new img tag in place of the canvas and delete the script tag associated with the chart ( #255 ).

Results of your tests (If applicable)

No new test @ the moment, but i invite you to test on of your example i modified : 4charts.ps1 where all the new features proposed are exposed.

Edit: @ the moment selnium is not implemented

Stephanevg commented 5 years ago

Plop @LxLeChat J'ai regarder ton PR la, et y a qq tests qui on echoué (Ceux qui ce basent sur un string qui comportait l'object JSON de chartsjs.

image

Tu crois que tu peux les fixer avant que je merge?

gracias

Stephanevg commented 5 years ago

Awesome, Merci Mec @LxLeChat !!

Stephanevg commented 5 years ago

ça marche mieux quand on merge les trucs quand meme... ^^