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

Announcements

News and Announcements icon
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:
  • Yogesh Murugan Profile Picture
    451 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard