Are you looking to insert charts in email? Want to learn about a tool that can make chart creation easy as a pie?
Although email is a ubiquitous format, it does have its fair share of limitations. Email service providers, such asOutlook eliminate SVG, JavaScript, and other alternatives. Therefore, in order to insert a graph or chart in an email, you have to consider rendering it in the form of an image..
Generally, it takes a lot of resources to render dynamics charts at scale, needing headless browsers, server render farm, and other configuration.
Luckily, you can use a service that renders graphs and eliminates this complexity. All you need to do is to construct URLand send it to a chart API, such as Image-Charts. It will then return a chart image. Since it’s all about creating a URL, you can also do it in your preferred programming environment, such as use Java, C#, or Python for sending charts.
By modifying the URL, you can create dynamic charts. Such an API is provided via Image-Charts, one of the most popular tools for charts, making it easy for you to customize your chart.
What Is Image-Charts API?
The Image-Charts API processes a URL POSTor GET request and returns a charge image. The API can generate different types of charts, from radar or bar charts to line and pie charts. All the chart information that you want, like labels, colors, size, and chart data are included in the URL.
In order to create a simple chart, just make sure that your URL mentions the chart size, data and type. Everything else will be managed by Image-Charts. You can enter the URL directly in your browser or refer to it with an <img> tag.
Using Programming Languages for Charts
Since URL is used to define a chart, you can build a Image-Charts URL in any programming language of your choice. Use the above mentioned instructions to construct your chart configuration and insert it in an <img> tag in your email.
The use of this lightweight approach can help you to avoid third-party dependencies. Also, keep in mind that Image-Charts has released libraries for different languages, so you can explore a lot in this regard. After generating the chart, you can easily work with any email service and send a chart through email.
Python is one of the most popular programming languages right now. Let's see how you can use Image-Charts with Python. First, you have to install the Python Package by typing the following command:
pip install image-charts
Next, you have to import the Image-Charts python library with the following command:
from ImageCharts import ImageCharts
Now, generate the chart image.
pie = ImageCharts().cht('p').chd('a:2.5,5,8.3').chs('100x100')
pie.to_url())# https://image-charts.com/chart?chd=a%3A2.5%2C5%2C8.3&chs=600x300&cht=p
pie.to_file('/path/to/chart.png'); #
pie.to_data_uri()# data:image/png;base64,iVBORw0KGgo...
pie.to_binary()# b'\x89PNG\r\n\x1a\n\x00\x00...
Inserting a Chart in Gmail
Google’s Gmail email service offers users with a wide range of features other than standard email. When you register aGmail account, you are provided access to Google Documents service. What this service does is that it grants you the ability to create presentations, spreadsheets, and text documents online.
If you use your Gmail account to create a spreadsheet, you can generate a chart or graph of the data in your spreadsheet.In this way, you can make your Google account a free and convenient alternative to conventional desktop spreadsheet applications.
1. Open a Web browser and visitgmail.com Move your mouse cursor around the “Sign in” option, enter your Gmail account login credentials in the provided spaces and hit the “Sign in” button to log in to your account.
2. Click the “Documents” tab at the top of your Gmail home page. Click the “Create New” button, which opens multiple options in a dropdown menu. Choose “Spreadsheet” from the menu to generate a new spreadsheet.
3. Type the information that you want to add to the graph in the cells of the spreadsheet. Google’s spreadsheet application works similar to other applications, where each cell acts as an individual piece of data and each column contains the data of all its cells.
4. Click and drag your mouse cursor around the cells that you would like to add in the graph and highlight them. Open the Insert menu and choose the “Chart” option.
5. Open the “Charts” tab and choose the chart type. After picking a suitable chart, click the “Insert”button for adding the chart in the spreadsheet.
6. Click on the “File” menu and choose the “Save” option. Pick a name for the spreadsheet in the space offered and select the “OK” button for saving the spreadsheet. You can access the spreadsheet and its graph whenever you log in to your account.
Do you want to learn more about chart-images? Go through this tutorial and learn how to use an image chart API. In case you have any queries regarding graphs and charts, you can visit and send us your query. Our experts can resolve your issue in a jiffy.