Charts

The Encodian population engine enables JSON data to be manipulated to produce charts. 

The article provides detailed examples for creating the following charts.

Pie Chart

Bubble Chart

 

 

Pie Chart

Example Document: Encodian - Template Syntax - Charts Pie.pptx

Example JSON data:

{
"Manager": [
   {
     "Name": "Steve",
     "Contract": [
       {"Client": "PulsePoint Technologies", "Price": "10000"},
       {"Client": "SwiftSpark Innovations", "Price": "5000"}
     ]},
   {
     "Name": "Caroline",
     "Contract": [
       {"Client": "Everglow Enterprises", "Price": "60000"},
       {"Client": "Alpha Catalysts", "Price": "1000"}
     ]},
   {
     "Name": "Adam",
     "Contract": [
       {"Client": "AlphaLink Dynamics", "Price": "20000"},
       {"Client": "OptiGlobe Solutions", "Price": "10000"}
     ]}
]}

For this example we will show a pie chart with the contract prices summed for the individual managers. 

Add a Pie Chart to your document and then configure it as follows:

1.  <<foreach [in  Manager]>> <<x [Name]>>

Please note this doesn't need a closing tag.

2. <<y [Contract.Sum(c => c.Price)]>>

This uses enumeration to get the total of each managers prices

 

This generates the following output:

 

Bubble Chart

Example Document: Encodian - Template Syntax - Charts Bubble.pptx

Example JSON data:

{
"HouseSales": [
{"Location": "72 Blue Steet", "SalePrice": 450000, "Date": "13/01/2024"},
{"Location": "13 River Avenue", "SalePrice": 200000, "Date": "21/06/2024"},
{"Location": "129 Oak House", "SalePrice": 150000, "Date": "01/04/2024"},
{"Location": "72 High Street", "SalePrice": 650000, "Date": "23/05/2024"},
{"Location": "23 Water End", "SalePrice": 400000, "Date": "05/01/2024"},
{"Location": "2 Willington Road", "SalePrice": 350000, "Date": "21/03/2024"},
{"Location": "43 Edward Gardens", "SalePrice": 500000, "Date": "08/02/2024"},
{"Location": "64 Grange Lane", "SalePrice": 300000, "Date": "12/05/2024"}
]
}

For this example we want to plot the house sales by month onto a bubble chart. 

Add a Bubble Chart to your document and then configure it as follows:

1. <<foreach [in HouseSales.GroupBy(c => c.Date.Value.Month)]>> <<x[Key]>>

Using enumeration group everything by month. This then sets the x value of the chart to the month number.

If grouping by Month please make sure the culture name is set within the action; not doing this may result in incorrect results.  

2.  Total Sale Price <<y [Sum(c => c.SalePrice)]>><<size [Count()]>>

Sum up the sale prices of each month. And sets the size of the bubble based on how many houses are sold each month. 

This generates the following output:

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk