Skip to content

Commit

Permalink
initial prototype of configurable Report widget using jsPDF.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgee committed Dec 10, 2015
1 parent bfe600a commit 4cc0487
Show file tree
Hide file tree
Showing 3 changed files with 841 additions and 0 deletions.
79 changes: 79 additions & 0 deletions config/report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
define([
'esri/layers/ImageParameters'
], function (ImageParameters) {
'use strict';

var imageParameters = new ImageParameters();
imageParameters.format = 'png32';

return {
isDebug: true,

mapOptions: {
basemap: 'streets',
center: [-122.6314, 38.2658],
zoom: 19,
sliderStyle: 'small'
},

titles: {
header: 'CMV Report Widget',
subHeader: 'This is an example of the Report Widget',
pageTitle: 'CMV Report Widget'
},

panes: {
left: {
collapsible: false,
style: 'display:none'
}
},
collapseButtonsPane: 'center', //center or outer

operationalLayers: [
{
type: 'dynamic',
url: 'https://xara1-4.cityofpetaluma.net/arcgis/rest/services/BaseMaps/Basemap_WM_CL/MapServer',
title: 'Basemap',
options: {
id: 'countyBasemap',
opacity: 1,
visible: true,
imageParameters: imageParameters
}
},
{
type: 'dynamic',
url: 'https://xara1-4.cityofpetaluma.net/arcgis/rest/services/BaseMaps/Parcels_Public/MapServer',
title: 'Parcels',
options: {
id: 'countParcels',
opacity: 0.7,
visible: true,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [0]
}
}
],

widgets: {
growler: {
include: true,
id: 'growler',
type: 'domNode',
path: 'gis/dijit/Growler',
srcNodeRef: 'growlerDijit',
options: {}
},
report: {
include: true,
id: 'report',
type: 'invisible',
path: 'widgets/Report',
options: 'config/reportWidget'
}
}
};
});
187 changes: 187 additions & 0 deletions config/reportWidget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
define([
'dojo/topic'
], function (topic) {
'use strict';

return {
map: true,
printTaskURL: 'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',

startup: function () {
window.setTimeout(function () {
topic.publish('reportWidget/createReport');
}, 200);
},

reportLayout: {
layout: {
orientation: 'portrait',
unit: 'pt',
format: 'letter'
},
output: {
type: 'save',
//type: 'datauristring',
//type: 'dataurlnewwindow',
options: 'report.pdf'
},
margins: {
top: 30,
left: 30,
bottom: 30,
right: 30
},
font: {
color: 20,
size: 11,
font: 'helvetica',
style: 'normal'
},
line: {
width: 0.5,
color: 0
},
border: {
width: 0.5,
color: 128
},
header: {
text: 'City of Petaluma Parcel Report',
font: {
color: [41, 128, 185],
size: 20,
style: 'bold'
},
line: {
width: 1
}
},
footer: {
line: {
width: 1.5,
color: 66
},
date: {
includeTime: false,
font: {
color: [66, 66, 66],
size: 9,
style: 'italic'
}
},
copyright: {
text: 'Copyright 2015, City of Petaluma California',
font: {
color: [66, 66, 66],
size: 9,
style: 'italic'
}
}
},
map: {
top: 55,
left: 35,
height: 250,
width: 290,
dpi: 360, //multiple of 72
format: 'PNG32',
preserveScale: true,
border: true
},
images: [],
text: [],
attributes: [
{
top: 67,
left: 350,
height: 235,
width: 225,
title: {
text: 'These are attributes',
font: {
color: 41,
size: 12,
style: 'bold'
}
},
layout: 'stacked',
border: true,
fields: [
{
fieldName: '81520 Johnson Loop'
},
{
fieldName: 'Petaluma, CA 94952'
},
{
},
{
fieldName: '010-999-9999',
label: 'Parcel #'
},
{
},
{
fieldName: 'Cupid\'s Sparrow',
label: 'Subdivision'
},
{
fieldName: '0.45',
label: 'Acres'
},
{
fieldName: '2,250',
label: 'Sq Ft'
},
{
},
{
fieldName: '2',
label: 'Stories'
},
{
fieldName: '4',
label: 'Bedrooms'
},
{
fieldName: '2.5',
label: 'Baths'
},
{
},
{
fieldName: '$125,000',
label: 'Land Value'
},
{
fieldName: '$250,000',
label: 'Structure Value'
}
]
},
{
top: 350,
left: 35,
right: 45,
height: 270,
title: {
text: 'These are attributes two',
font: {
color: 40,
size: 12,
style: 'bold'
}
},
border: true,
layout: 'table',
fields: [
{
label: 'Tabular Attributes will go here'
}
]
}
]

}
};
});
Loading

0 comments on commit 4cc0487

Please sign in to comment.