Pie Chart in tcpdf

Hi Experts,

Is there a way in creating a pie chart in tcpdf or using another tool then importing it as graphic?

I would also like to define my own colours, which can be up to 30.

Thank you,
APD TorontoAsked:
Who is Participating?
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
If you look at the charts.js docs as example http://www.chartjs.org/docs/latest/developers/api.html there is a method to convert to base64, toBase64Image.

Now that you have your base64 data, you can use js/jquery to grab the data and send it to your php processing page that generates the pdf https://tcpdf.org/examples/example_009/
// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.