render Kend UI php chart as svg or png

1 Answer 203 Views
Chart
mira
Top achievements
Rank 1
mira asked on 25 May 2022, 06:57 PM

Is it possible to render chart as a svg, png or binary image by using kendo UI Chart PHP Class

I'm trying to find solution to generate charts from background php script, so any frontend charts with js and css don't work for me. I need to generate chart as an image and save it, just by running the script from background.

1 Answer, 1 is accepted

Sort by
1
Accepted
Georgi Denchev
Telerik team
answered on 30 May 2022, 09:55 AM

Hello, Mira,

The Chart can be rendered as a canvas/svg inside the browser.

I'm assuming that your question is if you can download the rendered Chart as an svg/image file, to which the answer is also yes. You can use the exportImage and exportSVG methods for this purpose.

The Kendo UI for PHP classes render JavaScript/Html elements. They are meant to make it easier to configure widgets with PHP, however the end result is still JavaScript code.

You cannot "generate" the chart without a browser. You should look for an approach similar to the one that is used when testing an application. A browser window is loaded in the background(invisible), the page is then rendered and the chart is created and saved as an image/svg.

You can check the following GitHub project which seems to be offerring a headless mode for Chrome:

https://github.com/chrome-php/chrome 

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Chart
Asked by
mira
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or