Transforming Data for Charts
This guide explains how to transform data using RunJS and RunPy in ToolJet and visualize it using the chart component. The chart component in ToolJet enables the creation of various types of charts, with the option to integrate with Plotly for enhanced customization and advanced visualizations. While ToolJet provides the ability to connect to multiple databases, APIs, and data sources for integration, this guide will focus on using ToolJet DB to fetch the required data.
Plotting a Simple Pie Chart
To create a simple pie chart, the data has been stored in the table with the following structure in ToolJet DB:
id | course |
---|---|
1 | Maths |
2 | Full Stack Web Development |
3 | Digital Marketing Strategy |
4 | Business Ethics |
5 | Maths |
6 | Full Stack Web Development |
7 | Digital Marketing Strategy |
8 | Financial Accounting |
9 | Maths |
10 | Chemistry |
11 | Financial Accounting |
12 | Physics |
13 | Full Stack Web Development |
14 | Maths |
Query to Fetch Data
- Click on + Add button of the query manager at the bottom panel of the editor.
- Select the ToolJet Database as the data source.
- Select your table from the dropdown.
- Select the List rows operation.
- Click on the Preview button to preview the output or Click on the Run button to trigger the query.

This query will fetch the data from the ToolJet DB.