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

Dump chart to image for email #272

Open
tomerikko opened this issue Sep 3, 2021 · 5 comments
Open

Dump chart to image for email #272

tomerikko opened this issue Sep 3, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@tomerikko
Copy link

Hi @PrzemyslawKlys ,
i am trying to find a way to create a graph > convert it to an image > and use the image in an email Body.
that is to avoid any issues with different email clients.
Any idea on how to do that would be grateful :)

i looked in New-ChartPie couldn't see any option to dump to file, so i am assuming some piping and functions magic is needed.

if you have any simple idea i would appreciate that.

thanks again!
Tomer.

@PrzemyslawKlys
Copy link
Member

Won't work. Similar to diagrams #271 it's all generated on the fly.

I've started some tests on how to create charts in simple CSS that would work in email but it wasn't any good, giving mixed results. I have to find library that would be generating charts straight to images and then try to make it usable in PSWriteHTML.

@tomerikko
Copy link
Author

Got it, thanks @PrzemyslawKlys , your work and help is truly appreciated.

@tomerikko
Copy link
Author

not sure if it helps with your project @PrzemyslawKlys or not.
but also for the rest, i found a way to create a chart and dump it to an image.
https://www.alkanesolutions.co.uk/2019/03/13/charting-with-powershell/
take this example above, and in the end instead of showdialog to open a page, just dump it to image, with this command:
$chart.SaveImage("c:\chartimage.png","png")

@PrzemyslawKlys
Copy link
Member

Yes it's helpful. I saw this before and was playing with it - but https://github.com/dotnet/winforms-datavisualization is deprecated.

But I have an idea for it. Probably need to create a new PowerShell module - there goes my free time.

@PrzemyslawKlys
Copy link
Member

Actually, you can find the module using what you proposed https://github.com/iainbrighton/PScriboCharts

@PrzemyslawKlys PrzemyslawKlys added the enhancement New feature or request label Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants