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 URL and send it to the QuickChart API. 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 Chart.js, one of the most popular front-end libraries for charts, making it easy for you to customize your chart.
Render the Chart Image
The primary QuickChart endpoint is https://quickchart.io/chart. You can use it as a base URL and insert a certain query parameters:
- chart – This is an object.
- width – Adjust pixel to specify the width of your chart.
- height - Adjust pixel to specify the length of your chart.
- devicePixelRatio – Specify the ratio between logical and physical pixels.
For instance, consider you worked with Chart.js config and built the following:
labels: [2000, 2001, 2002, 2003, 2004],
data: [14, 20, 31, 44, 58]
As you observed, this is simply a graph of employees who worked in an organization from 2000 to 2004. Copy the config into the https://quickchart.io/sandbox/ to preview it.
Get the Chart.js config and add it to the main endpoint URL:
The URL now renders the chart as your browser loads it. In order to add it in an image, you can insert the URL in the image tag.
Using Programming Languages for Charts
Since URL is used to define a chart, you can build a QuickChart 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 QuickChart 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.
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 a Gmail 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.
- Open a Web browser and visit gmail.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.
- 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.
- 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.
- 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.
- 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.
- 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.