10 - Create Charts with Multiple Datasets
Last updated 16/12/2025
This documentation will explain how to create charts with multiple datasets. These datasets can be plotted on the same chart area or used in different chart areas that are displayed on the one page. As you would remember from the Quick Start Guide, you create a chart from a data source, for this example we will be using queries as our data sources.
We are going to add two chart areas on the one chart view, one will display our investment by sector and the other our investment by stock.
The quickest way to add a chart is with Five's Chart Wizard, however, you cannot add multiple datasets using the wizard. We will add the first chart using the Chart Wizard and then edit the record to add another dataset.
Add the InvestmentBySector Query
1. Click Data in the menu followed by Queries in the sub-menu.
2. Click the Add Item button and type InvestmentBySector in the Data Source ID field.
3. Click in the Query field to open Five's Query Builder.

4. Click the SQL tab.

5. Click the Copy button for the syntax below.
SELECT
Sector,
StockCode,
SUM(Bought - Sold) AS Holding,
SUM(OriginalCost * (Bought - Sold) / Bought) AS Investment
FROM (
SELECT
Sector.Name AS Sector,
Stock.StockCode AS StockCode,
Buy.PortfolioKey,
Buy.Quantity AS Bought,
IFNULL((SELECT SUM(Allocation.Quantity) FROM Allocation WHERE Allocation.BuyKey = Buy.BuyKey),0) AS Sold,
Buy.Total AS OriginalCost
FROM
Buy
INNER JOIN Stock ON Buy.StockKey = Stock.StockKey
INNER JOIN Sector ON Stock.SectorKey = Sector.SectorKey
HAVING
(Buy.PortfolioKey = ?) AND
(Bought > Sold)
) AS Summary
GROUP BY
Sector
6. Paste the syntax in the SQL Editor.
7. Click the Save button in the SQL Editor app bar.

8. Click the Fields tab.

9. Select the Holding record.

10. Edit the following fields:
- Select Integer in the Data Type field
- Type 4 in the Size field
- Select _Integer in the Default Display Type field

11. Click the Save button in the form app bar.

12. Select the Investment record.

13. Edit the following fields:
- Select Float in the Data Type field
- Type 8 in the Size field
- Select _Float.2 in the Default Display Type field

14. Click the Save button in the form app bar.

15. Click the Parameters tab.

16. Click the Add Parameters button.

17. Type PortfolioKey in the Parameter ID field.
18. Type

19. Click the Save button in the form app bar.

20. Click the Save button in the form app bar above the list.

Add the InvestmentByStock Query
The InvestmentByStock query has the same query fields and parameter as the InvestmentBySector query. The only difference between the two queries is one line of code in the SQL syntax. We will use the Copy button, as it will copy the InvestmentBySector record including the SQL syntax, the query fields, and the parameter.
1. Click the Copy button.
2. Delete Sector in the Data Source ID field and type Stock.
3. Click in the Query field to open Five's Query Builder.

4. Edit the

5. Click the Save button in the SQL Editor app bar.

6. Click the Save button in the form app bar.

Add the Investment Analysis Chart
Five's Chart Wizard will be used to add the Investment Analysis chart with its first chart area. This is only because it is quicker and a preview is available, you can make the chart and its chart areas all in the Charts view if you wanted to.
1. Click Visual in the menu followed by Chart Wizard in the sub-menu.
2. Type Investment Analysis in the Chart Title field and select InvestmentBySector in the Data Source field.
3. Select Sector in the X Value Column field and Investment in the Y Value Column field.
4. Type InvestmentBySector in the Chart Area ID field and Investment By Sector in the Chart Area Title field.
5. Click the Show Chart Area Title switch.
6. Select Pie in the Chart Type field.

7. Type Investment in the Legend Label field.
8. Click in the Color List Picker field.

9. Select a color block.

10. Click the Add New Color button and select a color block.

11. Repeat step 11 to add one more color and click the Save button.

12. Click the Save button in the Chart Wizard app bar.

Edit the Investment Analysis Chart
We will need to edit the Investment Analysis chart record so that we can add the Investment By Stock chart area.
1. Click Visual in the menu followed by Charts in the sub-menu.
2. Select the Investment Analysis record in the list and click the Edit button in the form app bar.

3. Click the Cancel button in the Columns field and type 2.
4. Type

Add the Investment By Stock Area
The Areas page enables you to add multiple charts to the one chart view.
5. Click the Areas tab.
6. Click the Add Areas button.

7. Type Investment By Stock in the Title field and select Pie in the Chart Type field.
8. Click the Edit button in the Page Position field.

9. Select B1 and click the Save button.

10. Click in the Color List field.

11. Select a color block.
12. Click the Add New Color button and select another color block.

13. Repeat step 14 to add three more colors.

15. Click the Save button in the form app bar.

Add the InvestmentByStock Data Source
The Datasets page enables you to pick a data source to supply the data to your chart.
16. Click the Datasets tab.
17. Click the Add Datasets button.

18. Select InvestmentByStock (Query) in the Data Source field.

Add the Investment By Stock Chart Area Dataset
The Chart Area Datasets page enables you to select the fields required to return the results.
19. Click the Chart Area Datasets tab.
20. Click the Add Chart Area Datasets button.

21. Select Investment By Stock in the Chart Area field.
22. Type Investment in the Legend Label field.
23. Select StockCode in the X Value Column field and Investment in the Y Value Column field.

24. Click the Save button in the form app bar.

25. Click both Save buttons in the stacked form app bars above the list.

Add the Investment Analysis Menu
1. Click Visual in the menu followed by Menus in the sub-menu.
2. Click the Add Item button and type Investment Analysis in the Caption field.
3. Type 1 in the Menu Order field, select InvestmentAnalysis (Chart) in the Action field, and select Portfolios (Portfolios) in the Parent Menu field.
4. Optional: Click the Edit button in the Icon field and open an image file.

5. Click the Save button in the form app bar.

Test the Investment Analysis Charts
1. Select the Growth Portfolio record in the list and click the Down button in the form app bar.

2. Close the browser tab and return to Five.