web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTML chart into Outloo...
Power Automate
Unanswered

HTML chart into Outlook Email Body

(0) ShareShare
ReportReport
Posted on by 17

Situation: I want to build the data for a HTML chart and insert the chart into an Outlook Email.

The HTML code is coming through the flow but when I receive the email it's not there.  

This is the email I get. There's no placeholder or error message that it can't be displayed.

damian_green_0-1710205348618.png

This is what the should be displayed.  I'm using the W3Schools site to display the code, pasted from the outputs from the successful run.

damian_green_2-1710205566318.png

 

Categories:
I have the same question (0)
  • Yogesh Murugan Profile Picture
    443 Moderator on at

    Can you give that HTML code

     

  • damian_green Profile Picture
    17 on at
    <!DOCTYPE html>
    <html>
    <head>
     <script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script>
    </head>
    <body>
     <canvas id="chartCanvas" style="display: none;"></canvas>
     <div id="container"></div>
     <script>
     var chart = new ej.charts.Chart({
     //Initializing Primary X Axis
     primaryXAxis: {
     valueType: 'Category',
     title: 'Countries',
     },
     //Initializing Primary Y Axis
     primaryYAxis: {
     title: 'Medals in number'
     },
     //Initializing Chart Title
     title: 'Olympic Medals',
     //Initializing Chart Series
     series: [
     {
     type: 'Column',
     dataSource: [
     { country: "USA", medal: 50 },
     { country: "China", medal: 40 },
     { country: "Japan", medal: 70 },
     { country: "Australia", medal: 60 },
     { country: "France", medal: 30 },
     ],
     xName: 'country',
     yName: 'medal',
     name: 'Medals',
     marker: {
     dataLabel: {
     visible: true,
     position: 'Top', // Change this to 'Top' to place the data labels above the bars
     font: {
     fontWeight: '600'
     }
     }
     }
     }
     ],
     //Initializing Tooltip
     tooltip: {
     enable: true
     }
     });
    
     chart.appendTo('#container');
    
     // Convert the chart to an image
     var canvas = document.getElementById('chartCanvas');
     canvas.width = chart.element.offsetWidth;
     canvas.height = chart.element.offsetHeight;
     var context = canvas.getContext('2d');
     chart.renderCanvas(context);
    
     // Embed the image in the email
     var img = document.createElement('img');
     img.src=canvas.toDataURL('image/png');
     document.body.appendChild(img);
     </script>
    </body>
    </html>

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard