From 21b4e366fc0e8efa4ac03bf10ff1fb00b268907a Mon Sep 17 00:00:00 2001 From: crustcrm1 Date: Mon, 12 Nov 2018 12:14:49 +0100 Subject: [PATCH] Added example JSON for charts API calls --- crm/docs/Chart-API.md | 119 ++++++++++++++++++++++++++++------ crm/docs/api/chart-bar.json | 16 +++++ crm/docs/api/chart-donut.json | 40 ++++++++++++ crm/docs/api/chart-line.json | 40 ++++++++++++ crm/docs/api/chart-pie.json | 31 +++++++++ 5 files changed, 226 insertions(+), 20 deletions(-) create mode 100644 crm/docs/api/chart-bar.json create mode 100644 crm/docs/api/chart-donut.json create mode 100644 crm/docs/api/chart-line.json create mode 100644 crm/docs/api/chart-pie.json diff --git a/crm/docs/Chart-API.md b/crm/docs/Chart-API.md index 0cda64ec1..66cd97192 100644 --- a/crm/docs/Chart-API.md +++ b/crm/docs/Chart-API.md @@ -10,10 +10,21 @@ Example chart: select Opportunity value for all opportunities between 1/1/2018 a { "kind": "line", "data": [ - ["Close date", "2018-01-01", "2018-01-02", "2018-01-03", "2018-01-04"], - ["Opportunity value", 30, 200, 100, 400] + [ + "Close date", + "2018-01-01", + "2018-01-02", + "2018-01-03", + "2018-01-04" + ], + [ + "Opportunity value", + 30, + 200, + 100, + 400 ] - , + ], "fields": { "Close date": { "kind": "datetime", @@ -24,6 +35,16 @@ Example chart: select Opportunity value for all opportunities between 1/1/2018 a "name": "(Field name)", "kind": "(Field kind)" } + }, + "meta": { + "name": "Line chart", + "description": "Description for the chart", + "kind": "line", + "module": 62511111111111110, + "x": 62522222222222220, + "xmin": "1/1/2018", + "xmax": "31/12/2018", + "y": 62533333333333336 } } ``` @@ -42,15 +63,32 @@ Lost, 2 { "kind": "pie", "data": [ - ["Open", 10], - ["Won", 5], - ["Lost", 2] + [ + "Open", + 10 + ], + [ + "Won", + 5 + ], + [ + "Lost", + 2 ] - , + ], "fields": { "state": { - "kind": "string", + "kind": "string" } + }, + "meta": { + "name": "Pie chart", + "description": "", + "kind": "pie", + "module": 62511111111111110, + "x": 62522222222222220, + "y": 62533333333333336, + "count": 62566666666666664 } } ``` @@ -65,15 +103,32 @@ This will need to return a sum of all the opportunies by type (very similar to c { "kind": "donut", "data": [ - ["Open", 120000], - ["Won", 1000000], - ["Lost", 30000] + [ + "Open", + 120000 + ], + [ + "Won", + 1000000 + ], + [ + "Lost", + 30000 ] - , + ], "fields": { "type": { - "kind": "string", + "kind": "string" } + }, + "meta": { + "name": "Donut chart", + "description": "Description for the chart", + "kind": "donut", + "module": 62511111111111110, + "x": 62522222222222220, + "y": 62533333333333336, + "sum": 62555555555555550 } } ``` @@ -86,17 +141,41 @@ Example bar chart with number of leads per country: select lead.country from lea { "kind": "bar", "data": [ - ["France", 12], - ["Slovenia", 10], - ["Spain", 3], - ["United Kingdom", 5], - ["Germany", 20'] + [ + "France", + 12 + ], + [ + "Slovenia", + 10 + ], + [ + "Spain", + 3 + ], + [ + "United Kingdom", + 5 + ], + [ + "Germany", + 20 ] - , + ], "fields": { "country": { - "kind": "string", + "kind": "string" } + }, + "meta": { + "name": "Bar chart", + "description": "", + "kind": "bar", + "module": 62511111111111110, + "x": 62522222222222220, + "y": 62533333333333336, + "groupby": 62544444444444450, + "count": 62566666666666664 } } ``` diff --git a/crm/docs/api/chart-bar.json b/crm/docs/api/chart-bar.json new file mode 100644 index 000000000..b9457a1dc --- /dev/null +++ b/crm/docs/api/chart-bar.json @@ -0,0 +1,16 @@ +{ + "kind": "bar", + "data": [ + ["France", 12], + ["Slovenia", 10], + ["Spain", 3], + ["United Kingdom", 5], + ["Germany", 20] + ] + , + "fields": { + "country": { + "kind": "string", + } + } +} diff --git a/crm/docs/api/chart-donut.json b/crm/docs/api/chart-donut.json new file mode 100644 index 000000000..bcfd86be2 --- /dev/null +++ b/crm/docs/api/chart-donut.json @@ -0,0 +1,40 @@ +{ + "kind": "bar", + "data": [ + [ + "France", + 12 + ], + [ + "Slovenia", + 10 + ], + [ + "Spain", + 3 + ], + [ + "United Kingdom", + 5 + ], + [ + "Germany", + 20 + ] + ], + "fields": { + "country": { + "kind": "string" + } + }, + "meta": { + "name": "Bar chart", + "description": "", + "kind": "bar", + "module": 62511111111111110, + "x": 62522222222222220, + "y": 62533333333333336, + "groupby": 62544444444444450, + "count": 62566666666666664 + } +} diff --git a/crm/docs/api/chart-line.json b/crm/docs/api/chart-line.json new file mode 100644 index 000000000..7de6d5302 --- /dev/null +++ b/crm/docs/api/chart-line.json @@ -0,0 +1,40 @@ +{ + "kind": "line", + "data": [ + [ + "Close date", + "2018-01-01", + "2018-01-02", + "2018-01-03", + "2018-01-04" + ], + [ + "Opportunity value", + 30, + 200, + 100, + 400 + ] + ], + "fields": { + "Close date": { + "kind": "datetime", + "min": "1/1/2018", + "max": "31/12/2018" + }, + "Opportunity value": { + "name": "(Field name)", + "kind": "(Field kind)" + } + }, + "meta": { + "name": "Line chart", + "description": "Description for the chart", + "kind": "line", + "module": 62511111111111110, + "x": 62522222222222220, + "xmin": "1/1/2018", + "xmax": "31/12/2018", + "y": 62533333333333336 + } +} diff --git a/crm/docs/api/chart-pie.json b/crm/docs/api/chart-pie.json new file mode 100644 index 000000000..7782d0de9 --- /dev/null +++ b/crm/docs/api/chart-pie.json @@ -0,0 +1,31 @@ +{ + "kind": "pie", + "data": [ + [ + "Open", + 10 + ], + [ + "Won", + 5 + ], + [ + "Lost", + 2 + ] + ], + "fields": { + "state": { + "kind": "string" + } + }, + "meta": { + "name": "Pie chart", + "description": "", + "kind": "pie", + "module": 62511111111111110, + "x": 62522222222222220, + "y": 62533333333333336, + "count": 62566666666666664 + } +}