Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: ReportPlayer

require(["esri/dijit/geoenrichment/ReportPlayer/ReportPlayer"], function(ReportPlayer) { /* code goes here */ });

Description

(Added at v3.24)

The ReportPlayer widget runs infographic report templates for a provided analysis area. It works with the standard provided Esri infographic report templates or custom created infographic report templates. Infographics can be viewed in full page mode or as slides. Once the infographic report is generated it can be exported to a PDF, image, or dynamic HTML.

The ReportPlayer requires an authenticated user in order to access ArcGIS items and make requests to Geoenrichment. It does not handle sign-in operations. The application has to authenticate the user before running the ReportPlayer. This code snippet shows how you can setup authentication prior to using the ReportPlayer:

// Required classes
"esri/arcgis/OAuthInfo",
"esri/IdentityManager"

var info = new OAuthInfo({
  appId: "[Application ID]",
  portalUrl: "[Portal URL]",
  popup: false
});

IdentityManager.registerOAuthInfos([info]);

IdentityManager.checkSignInStatus(info.portalUrl).then(function () {
  // Start Report Player
}).otherwise(function () {
  IdentityManager.getCredential(info.portalUrl, {
    oAuthPopupConfirmation: false}).then(function () {
    // Start Report Player
    });
  });
});
For more information on ArcGIS authentication see OAuthInfo.

Samples

Search for samples that use this class.

Constructors

NameSummary
new ReportPlayer(params?, srcNode?)Creates a new ReportPlayer dijit using the given DOM node.

Properties

NameTypeSummary
allowKeyboardNavigationBooleanIndicates whether left and right arrows key can be used to paginate when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES.
configObjectConfiguration to specify the location of the JavaScript API to use when exporting an Infographic to Dynamic HTML.
dataProviderDataProviderGEData Provider for the ReportPlayer which allows you to specify which export options are available when running the report.
defaultZoomBehaviorStringSpecifies how the ReportPlayer should zoom by default.
enableDataDrillingBooleanIndicates whether interactive experience for panels should be enabled.
resizeModeStringSpecifies the resize mode of the ReportPlayer.
scaleSlidesToFitWindowBooleanIf true, indicates that panels should scale to fit the window.
showAreaTitleBooleanIndicates whether the analysis area title will be shown in the toolbar.
showToolbarInPopupBooleanIndicates whether the toolbar will be shown in a compact popup view.
themeStringSpecifies the theme of the ReportPlayer.
viewModeStringSpecifies the display of the report in full page view, slide view, or stacked panel view.

Methods

NameReturn typeSummary
playReport(dataProviderParams, playParams?)DeferredGenerates the report for the supplied parameters.
resize(width?, height?)PromiseSets the width and height of the ReportPlayer when resizeMode is set to PlayerResizeModes.MANUAL.
setMaxHeight(number)NumberSets the maximum height for the Report Player.
setMaxWidth(number)NumberSets the maximum width for the Report Player.
Constructor Details

new ReportPlayer(params?, srcNode?)

Creates a new ReportPlayer dijit using the given DOM node.
Parameters:
<Object> params Optional Various parameters that can be used to configure the ReportPlayer. All properties can be passed into the constructor as options.
<Node | String> srcNode Optional Reference or id of the HTML element where the widget should be rendered.
params properties:
<Boolean> allowKeyboardNavigation Optional Indicates whether left and right arrows key can be used to paginate when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. It defaults to true.
<Object> config Optional As of version 3.26 Configuration to specify the location of the JavaScript API to use when exporting an Infographic to Dynamic HTML. This is required if enabling Export to Dynamic HTML, otherwise it is not required. Please see the config property for its available Object properties.
<DataProviderGE> dataProvider Optional Specifies which export options are available for the report.
<String> defaultZoomBehavior Optional Specifies how the ReportPlayer should zoom by default. It defaults to FIT_PAGE.
<Boolean> enableDataDrilling Optional Indicates whether interactive experience for panels should be enabled. It defaults to true.
<String> resizeMode Optional Specifies the resize mode of the ReportPlayer. It defaults to AUTO.
<Boolean> scaleSlidesToFitWindow Optional If true, indicates that panels should scale to fit the window. Applicable when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. It defaults to true.
<Boolean> showAreaTitle Optional Indicates whether the analysis area title will be shown in the toolbar. It defaults to true.
<Boolean> showToolbarInPopup Optional Indicates whether the toolbar will be shown in a compact popup view. It defaults to false.
<PlayerThemes> theme Optional Specifies the theme of the ReportPlayer. It defaults to DARK.
<String> viewMode Optional Specifies the display of the report in full page view, slide view, or stacked panel view. Defaults to PlayerViewModes.FULL_PAGES for full page view. In version 3.24, you would have used the now deprecated property, isSlidesView. Please use the viewMode property in place of this.
Sample:
var player = new ReportPlayer({
  viewMode: PlayerViewModes.FULL_PAGES,
  theme: PlayerThemes.DARK,
  dataProvider: dataProvider,
  resizeMode: PlayerResizeModes.FIT_WINDOW,
  config: {
    esriDijitCssUrl: "https://js.arcgis.com/3.26/dijit/themes/claro/claro.css",
    esriCssUrl: "https://js.arcgis.com/3.26/esri/css/esri.css",
    playerSourceRootUrl: "https://js.arcgis.com/3.26/" 
  }
}),placeAt(divId);
Property Details

<Boolean> allowKeyboardNavigation

Indicates whether left and right arrows key can be used to paginate when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. (Added at v3.25)
Default value: true

<Object> config

Configuration to specify the location of the JavaScript API to use when exporting an Infographic to Dynamic HTML. This is required if enabling Export to Dynamic HTML, otherwise it is not required. See the object specifications table below for the structure of the config object. (Added at v3.26)
Object Specifications:
<config>
<String> esriCssUrl Optional An optional string URL referencing the esri.css stylesheet in the Esri JavaScript API, e.g. e.g. "https://js.arcgis.com/3.26/esri/css/esri.css".
<String> esriDijitCssUrl Optional An optional string URL referencing the claro.css stylesheet in the Esri JavaScript API, e.g. "https://js.arcgis.com/3.26/dijit/themes/claro/claro.css".
<String> playerSourceRootUrl Optional An optional string URL referencing the Esri JavaScript API, e.g. "https://js.arcgis.com/3.26/".

<DataProviderGE> dataProvider

Data Provider for the ReportPlayer which allows you to specify which export options are available when running the report.

<String> defaultZoomBehavior

Specifies how the ReportPlayer should zoom by default. Please refer to PlayerZoomBehaviors for additional information on this. (Added at v3.25)
Default value: FIT_PAGE

<Boolean> enableDataDrilling

Indicates whether interactive experience for panels should be enabled. (Added at v3.25)
Default value: true

<String> resizeMode

Specifies the resize mode of the ReportPlayer. Please refer to PlayerResizeModes for additional information on this.
Default value: AUTO

<Boolean> scaleSlidesToFitWindow

If true, indicates that panels should scale to fit the window. Applicable when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. (Added at v3.25)
Default value: true

<Boolean> showAreaTitle

Indicates whether the analysis area title will be shown in the toolbar. (Added at v3.25)
Default value: true

<Boolean> showToolbarInPopup

Indicates whether the toolbar will be shown in a compact popup view. (Added at v3.25)
Default value: false

<String> theme

Specifies the theme of the ReportPlayer. Please refer to PlayerThemes for additional information on this.
Default value: DARK

<String> viewMode

Specifies the display of the report in full page view, slide view, or stacked panel view. Please refer to PlayerViewModes for additional information on this. (Added at v3.25)
Default value: FULL_PAGES
Method Details

playReport(dataProviderParams, playParams?)

Generates the report for the supplied parameters.
Return type: Deferred
Parameters:
<Object> dataProviderParams Required See the object specifications table below for the structure of the dataProviderParams object.
<Object> playParams Optional See the object specifications table below for the structure of the playParams object.
Object Specifications:
<analysisJson>
<String> address Optional Address of location, can be displayed in the generated infographic.
<String> description Optional A description for the location, can be displayed in the generated infographic.
<String> feature Required Feature of the generated infographic. Geometry is required. Attributes, symbol, and infoTemplate are optional. See sample snippets below:

var analysisJson = [{
  "name": "Area name",
  "shortName": "Area name (short)",
  "description": "Area description",
  "address": "Area address",
  "latitude": "Area Lat.",
  "longitude": "Area Long.",
  "feature": {
    "geometry": {
      "rings": [
        [
          [-8238372.646123883, 4971599.356069453],
          [-8236117.753789412, 4970600.8973874515],
          [-8235730.791333708, 4968556.206880769],
          [-8240211.912117044, 4969607.216019718],
          [-8238372.646123883, 4971599.356069453]
        ]
      ],
      "spatialReference": {
        "wkid": 102100
      }
    },
    "attributes": {
      "ATTR_1": 1000.12345,
      "ATTR_2": 2000.12345,
      "ATTR_3": 3000.12345
    },
    "symbol": {
      "color": [
        64,
        128,
        194,
        50
      ],
      "outline": {
        "color": [
          64,
          128,
          194,
          255
        ],
        "width": 1.5,
        "type": "esriSLS",
        "style": "esriSLSSolid"
      },
      "type": "esriSFS",
      "style": "esriSFSSolid"
    },
    "infoTemplate": {
      "fieldInfos": [
        {
          "fieldName": "ATTR_1",
          "label": "Attribute 1",
          "format": { places: 1 },
          "visible": true
        },
        {
          "fieldName": "ATTR_2",
          "label": "Attribute 2",
          "format": { places: 2 },
          "visible": true
        },
        {
          "fieldName": "ATTR_3",
          "label": "Attribute 3",
          "format": { places: 3 },
          "visible": true
        }
      ]
    }
  }
}];

The following shows how to specify the location information. This will appear in the UI and in the infographic.
var analysisArea = {
  // Optional. Specify if an area is related to a location point
  // (e.g. a ring around a location).
  // Will populate SITE_NAME & STORE_NAME attributes in the report.
  "locationName": "New York site",
  "name": "New York site (1 mile)",
  // Full area name. If locationName is missing,
  // will populate SITE_NAME & STORE_NAME attributes
  // in the report.
  "shortName": "1 mile",
  // Will be shown in drop downs for quick
  // area selection.
  "description": "Ring of 1 mile",
  // Will populate AREA_DESC2 in the report. 
  "address": "Apple st. 32, CA",
  "latitude": "Area Lat.",
  "longitude": "Area Long."
}

The analysis area's geometry can be set three various ways:
// 1 - Using a Graphic

// Can also use Graphic's Json.
// Attributes can optionally contain STORE_LAT
// and STORE_LONG to specify
// the point of reference used for locator reports.

analysisArea.feature = new Graphic(geometry, symbol, attributes) 
// 2 - Geographies. This is used to enrich by geography
// ids instead of the feature geometry. STORE_LAT and
// STORE_LONG are optional and are used as a point of
// reference for locator reports.

analysisArea.geographies = [{ 
  id: "01",  // Required
  levelId: "US.States",  // Required
  attributes: { STORE_LAT: Number, STORE_LONG: Number, ... other attributes },  // Optional
  symbol: Symbol or Json // Optional, use this to apply custom symbolization.
}]
// 3 - Buffer - Will be enriched with a geometry to build
// a buffer ring.

analysisArea.buffer = {
  // e.g. {x: -8259520.139751502, y: 4974476.975557825,
  // spatialReference: {wkid: 102100}
  point: Geometry or Json,
  units: String,  // e.g. "esriMiles"
  radius: Number, // e.g. 1
  // Optional, to pass attributes to the enriched polygon
  attributes: Object,
  // Optional, to apply custom symbolization to the enriched polygon
  symbol: Symbol or Json
}
<Object[]> geographies Optional An array of geographies to be used instead of a feature geometry.
"geographies": {
  {"id":"32", "levelId":"US.States"},
  {"id":"06", "levelId":"US.States"}
}
<String> latitude Optional Latitude of location, can be displayed in the generated infographic.
<String> longitude Optional Longitude of location, can be displayed in the generated infographic.
<String> name Optional The name of the location, this is often displayed in the generated infographic.
<String> shortName Optional A short name for the location, can be displayed in the generated infographic.
<dataProviderParams>
<Object> analysisAreas Required An array of analysisJson objects which detail the location that the infographic will run on. See the additional information regarding the analysisJson object.
<String> countryID Required Two-digit country code. For example: "US".
<String> geoenrichmentUrl Optional The URL of the Geoenrichment service. If not specified, it will be discovered via the portal helper services.
<String> portalUrl Required URL of the ArcGIS Portal instance. For example, "https://www.arcgis.com".
<String> reportID Required The itemID of the Report Template to run. This is the ID of the ReportTemplate item in your content. Can also use one of the following strings to run an Eri infographic:
  • at-risk-population (USA only)
  • executive-summary-call-outs (USA only)
  • demographic-summary (USA only)
  • transportation-to-work (USA only)
  • health-care (USA only)
  • marketing-profile (USA only)
  • portrait-property-flyer (USA only)
  • tapestry-profile (USA only)
  • skyscraper (USA only)
  • nearby-restaurants (USA only)
  • key-facts (USA, Canada, and MBR countries only)
<playParams>
<Boolean> disableAnimation Optional Indicates whether to disable the animation in the generated report. Defaults to false.
<Boolean> waitUntilAllContentIsReady Optional Set this value to true if required to know when the report has finished loading all of its content. The default value is false.
Sample:
// This sample runs the Esri Deomgraphic Summary Infographic for the United States

var params = {
  portalUrl: "https://www.arcgis.com",
  countryID: "US",
  reportID: "demographic-summary",
  analysisAreas: analysisJson
};

player.playReport(params);
// This sample runs a report and receives a callback after the Infographic report has been generated.

player.playReport(params, {waitUntilAllContentIsReady: true}).then(function() {
 // Content has been loaded, do something
});

resize(width?, height?)

Sets the width and height of the ReportPlayer when resizeMode is set to PlayerResizeModes.MANUAL. If in any other resizeMode, call this without setting any parameters to resize to the specified resizeMode. (Added at v3.25)
Return type: Promise
Parameters:
<Number> width Optional The width in pixels.
<Number> height Optional The height in pixels.

setMaxHeight(number)

Sets the maximum height for the Report Player. This is applicable when resizeMode is set to PlayerResizeModes.MANUAL. (Added at v3.25)
Return type: Number
Parameters:
<Number> number Required The height in pixels.

setMaxWidth(number)

Sets the maximum width for the Report Player. This is applicable when resizeMode is set to PlayerResizeModes.MANUAL. (Added at v3.25)
Return type: Number
Parameters:
<Number> number Required The width in pixels.
Show Modal