Creating Charts | DynamicDocs API | Advicement

Overview

The DynamicDocs API provides an effective way to create bespoke pdf documents in bulk with ability to include graphics and logic in the documents.

This is done by writing templates in Latex on this website and then calling the API with json data payload, which consists of dynamic data for the document. Once the call has been the API response will be provide a link to the progress json which in turn will provide a link to download the document.

Example of Line Chart

The following example shows how to create a line chart:

{
"fundData": [
{
"navDate": "2019/01/31",
"Fund": 100,
"Benchmark": 100
},
{
"navDate": "2019/02/28",
"Fund": 102,
"Benchmark": 101
},
{
"navDate": "2019/03/31",
"Fund": 103,
"Benchmark": 104
},
{
"navDate": "2019/04/30",
"Fund": 102,
"Benchmark": 101
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
\documentclass[a4paper]{article}
\usepackage[top=1cm, bottom=1cm, left=1cm, right=1cm,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Font setup
\usepackage[default,scale=0.95]{opensans}
\begin{document}
\vspace{0.5cm}
<<lineChart-1, cache=FALSE, fig.height=5, fig.width=9>>=
params$fundData$navDate <- as.Date(params$fundData$navDate,format='%Y/%m/%d')
ggplot(data=params$fundData)+
geom_line(aes(x=navDate, y=Fund, color =' Fund A '), linetype='solid')+
geom_line(aes(x=navDate, y=Benchmark, color =' Benchmark A ' ), linetype='dashed')+
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
line-chart-Screenshot

Example of Pie Chart

The following example shows how to create a pie chart:

{
"expenses" : [
{
"name": "Home Loan",
"weight": 9800
},
{
"name": "Credit Card",
"weight": 6000
},
{
"name": "Medical Insurance",
"weight": 2750
},
{
"name": "Home Expenses",
"weight": 4500
},
{
"name": "Other",
"weight": 8750
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
\documentclass[a4paper]{article}
\usepackage[top=1cm, bottom=1cm, left=1cm, right=1cm,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Font setup
\usepackage[default,scale=0.95]{opensans}
\begin{document}
\vspace{0.5cm}
<<pieChart-1, cache=FALSE, fig.height=5, fig.width=9>>=
allocationData = params$assetAllocation
colnames(allocationData) = c('Name','Weight')
allocationData$legend = paste(" ", allocationData$Name," - ", formatC(allocationData$Weight,format="f",digits=2),"%
",sep="")
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
pie-chart-Screenshot

Example of Doughnut Chart

The following example shows how to create a doughnut chart:

{
"expenses" : [
{
"name": "Home Loan",
"weight": 9800
},
{
"name": "Credit Card",
"weight": 6000
},
{
"name": "Medical Insurance",
"weight": 2750
},
{
"name": "Home Expenses",
"weight": 4500
},
{
"name": "Other",
"weight": 8750
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
\documentclass[a4paper]{article}
\usepackage[top=1cm, bottom=1cm, left=1cm, right=1cm,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Font setup
\usepackage[default,scale=0.95]{opensans}
\begin{document}
<<doughnutChart-1, cache=FALSE, fig.height=5, fig.width=9>>=
expensesData = params$expenses
colnames(expensesData) = c('Name','Weight')
expensesData$legend = paste(" ", expensesData$Name," - ", formatC(expensesData$Weight,format="f",digits=2)," ",sep="")
expensesData$fraction = expensesData[["Weight"]]/ sum(expensesData[["Weight"]])
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
doughnut-chart-Screenshot

Example of Bar Chart

The following example shows how to create a bar chart:

{
"oneYearReturns": [
{
"AssetClass": "Local Equity",
"Return": 0.125
},
{
"AssetClass": "Local Bonds",
"Return": 0.0666
},
{
"AssetClass": "Local Property",
"Return": -0.156
},
{
"AssetClass": "Local Cash",
"Return": 0.0351
},
{
"AssetClass": "Global Equity",
"Return": 0.103
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
\documentclass[a4paper]{article}
\usepackage[top=1cm, bottom=1cm, left=1cm, right=1cm,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Font setup
\usepackage[default,scale=0.95]{opensans}
\begin{document}
<<barChart-1, cache=FALSE, fig.height=5, fig.width=9>>=
assetClassDF <- params$oneYearReturns
assetClassDF$AssetClass <- factor(assetClassDF$AssetClass,levels = assetClassDF$AssetClass)
assetClassDF$label = paste(format(round(100*assetClassDF$Return,1), digits=2),"%")
assetClassDF$AssetClassLabel <- gsub(" ", "\n", assetClassDF$AssetClass)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bar-chart-Screenshot

More Resources

For more informations on creating charts, please consult the ggplot2 official page or the ggplot2 cheat graphic.