FRAMES | NO FRAMES |
Compares up to three target profiles to a single base profile.
Availability: Business Analyst Server.
TaskResultOutput MultiProfileBarChart ( MultiProfileBarChartParameters Parameters, esriReportFormat ReportFormat, TaskOutputType[] OutputTypes, esriFolderItem OutputReportItem );
Parameter | Description |
---|---|
Parameters | Configuration options for analysis. Type MultiProfileBarChartParameters. |
ReportFormat | This parameter should be null. This parameter is deprecated. |
OutputTypes | Array of task output options. Options for this method include creating a report (GetReport). Type TaskOutputType[]. |
OutputReportItem | (Optional
parameter — can be null). Configuration options for storing the output report in the repository. This will enable viewing and working with the output result in subsequent tasks. Type esriFolderItem. |
Variable of type TaskResultOutput
Segmentation Charts graphically display values for each Tapestry segment when comparing two or more profiles. These charts are used to illustrate the values in a Customer Tapestry Profile Report.
The MultiProfileBarChart method compares up to three target profiles to a single base profile. The first target profile in the list of segmentation profiles will be used to create the bar chart. The other two target profiles will be displayed as trend lines on top of the bar chart.
A sample multi-profile comparison bar chart is illustrated below. The y-axis contains a bar for each of the Tapestry segments, and the x-axis is scale dependent on the index values of a profile comparison.
Each bar within the chart displays three distinct pieces of information:
The example below generates a Multi-Profile Bar Chart from two different target profiles derived from two separate lists of customers and a base profile derived from a geographic area. Also, all profiles are stored in the repository.
C# |
// Instantiate the BAServerHelper class to access analysis methods BAServerHelper baServerHelper = new BAServerHelper(); baServerHelper.ActiveDatasetID = "USA_ESRI"; // Optional parameter baServerHelper.IsFullErrorMessage = true; // Default is false // You can specify below a domain of your local Business Analyst Server. //baServerHelper.BAServerDomain = "esri.com"; // If a domain name is specified, a local server name in output URLs is replaced with the // fully-addressable server name so people and machines outside the domain of your local // Business Analyst Server instance can access these URLs. RenderingParameters imageOptions; TaskOutputType[] outputOptions; esriFolderItem outputLayer; esriFolderItem outputReport; esriFolderItem outputItem; ProfileByTableGeocodingParameters targetProfileParameters; string targetProfile; // ========= STEP 1: Create a target segmentation profile by the table of customers RecordSet table = new RecordSet(); // Create table fields string[] fieldNames = new string[] { "CUST_ID", "NAME", "ADDRESS", "CITY", "STATE", "ZIP", "STORE_ID", "SALES" }; table.Fields = new Fields(); table.Fields.FieldArray = new Field[fieldNames.Length]; for (int i = 0; i < fieldNames.Length; i++) { Field field = new Field(); field.Name = fieldNames[i]; field.Type = esriFieldType.esriFieldTypeString; table.Fields.FieldArray[i] = field; } // The last field is numeric table.Fields.FieldArray[fieldNames.Length - 1].Type = esriFieldType.esriFieldTypeInteger; // Create table records table.Records = new Record[5]; table.Records[0] = new Record(); table.Records[0].Values = new object[] { "101", "CUST1", "2355 Pine St.", "San Francisco", "CA", "94115", "1", 12343 }; table.Records[1] = new Record(); table.Records[1].Values = new object[] { "102", "CUST2", "2501 California St.", "San Francisco", "CA", "94115", "1", 10008 }; table.Records[2] = new Record(); table.Records[2].Values = new object[] { "103", "CUST3", "563 Ruger St.", "San Francisco", "CA", "94129", "2", 3200 }; table.Records[3] = new Record(); table.Records[3].Values = new object[] { "104", "CUST4", "301 Finley Rd.", "San Francisco", "CA", "94129", "2", 15802 }; table.Records[4] = new Record(); table.Records[4].Values = new object[] { "105", "CUST5", "614 Balboa St.", "San Francisco", "CA", "94129", "2", 4750 }; TableData tableData = new TableData(); tableData.RecordSet = table; // Specify geocode data GeocodeData geocodeData = new GeocodeData(); geocodeData.Table = tableData; targetProfileParameters = new ProfileByTableGeocodingParameters(); // Set specific analysis parameters targetProfileParameters.GeocodeData = geocodeData; targetProfileParameters.SegmentationBase = "Total Households"; targetProfileParameters.WeightField = "SALES"; // Set other parameters // In general, a non-null esriFolderItem is specified to save a newly-created // item to the server-side repository or to reference an existing item in it. outputItem = new esriFolderItem(); outputItem.folderType = esriFolderType.esriFolderSegProfiles; outputItem.itemName = "targetProfile1_MultiProfileBarChart"; outputItem.projectName = "Default Project"; outputItem.workspaceName = "Default Workspace"; targetProfile = baServerHelper.ProfileByTableGeocoding(targetProfileParameters, outputItem); ProfileData targetProfileData1 = new ProfileData(); targetProfileData1.Description = targetProfile; // ========= STEP 2: Create record set by customer addresses RecordSetByAddress[] customerAddresses = new RecordSetByAddress[7]; customerAddresses[0] = new RecordSetByAddress(); customerAddresses[0].Name = "customer1"; customerAddresses[0].Description = "Ocean Beach Customer"; customerAddresses[0].StoreID = "1"; customerAddresses[0].Address = "5080 Newport Ave."; customerAddresses[0].City = "San Diego"; customerAddresses[0].State = "CA"; customerAddresses[0].ZIP = "92107"; customerAddresses[0].CustomerID = "1"; customerAddresses[1] = new RecordSetByAddress(); customerAddresses[1].Name = "customer2"; customerAddresses[1].Description = "La Jolla Customer"; customerAddresses[1].StoreID = "1"; customerAddresses[1].Address = "1250 Prospect St."; customerAddresses[1].City = "La Jolla"; customerAddresses[1].State = "CA"; customerAddresses[1].ZIP = "92037"; customerAddresses[1].CustomerID = "2"; customerAddresses[2] = new RecordSetByAddress(); customerAddresses[2].Name = "customer3"; customerAddresses[2].Description = "Pacific Beach Customer"; customerAddresses[2].StoreID = "1"; customerAddresses[2].Address = "1762 Garnet Ave."; customerAddresses[2].City = "San Diego"; customerAddresses[2].State = "CA"; customerAddresses[2].ZIP = "92109"; customerAddresses[2].CustomerID = "3"; customerAddresses[3] = new RecordSetByAddress(); customerAddresses[3].Name = "customer4"; customerAddresses[3].Description = "Morena Customer"; customerAddresses[3].StoreID = "2"; customerAddresses[3].Address = "1240 W. Morena Blvd."; customerAddresses[3].City = "San Diego"; customerAddresses[3].State = "CA"; customerAddresses[3].ZIP = "92111"; customerAddresses[3].CustomerID = "4"; customerAddresses[4] = new RecordSetByAddress(); customerAddresses[4].Name = "customer5"; customerAddresses[4].Description = "Clairemont Customer"; customerAddresses[4].StoreID = "2"; customerAddresses[4].Address = "6393 Balboa Ave."; customerAddresses[4].City = "San Diego"; customerAddresses[4].State = "CA"; customerAddresses[4].ZIP = "92111"; customerAddresses[4].CustomerID = "5"; customerAddresses[5] = new RecordSetByAddress(); customerAddresses[5].Name = "customer6"; customerAddresses[5].Description = "Bird Rock Customer"; customerAddresses[5].StoreID = "2"; customerAddresses[5].Address = "5735 La Jolla Blvd."; customerAddresses[5].City = "La Jolla"; customerAddresses[5].State = "CA"; customerAddresses[5].ZIP = "92037"; customerAddresses[5].CustomerID = "6"; customerAddresses[6] = new RecordSetByAddress(); customerAddresses[6].Name = "customer7"; customerAddresses[6].Description = "University City Customer"; customerAddresses[6].StoreID = "1"; customerAddresses[6].Address = "3254 Governor Dr."; customerAddresses[6].City = "San Diego"; customerAddresses[6].State = "CA"; customerAddresses[6].ZIP = "92122"; customerAddresses[6].CustomerID = "7"; TaskResultOutput recordSetResult = baServerHelper.CreateRecordSetByAddresses(customerAddresses, esriFolderType.esriFolderCustomerLayers); tableData = new TableData(); tableData.RecordSet = recordSetResult.RecordSet; geocodeData = new GeocodeData(); geocodeData.Table = tableData; // ========= STEP 3: Create another target segmentation profile by this record set targetProfileParameters = new ProfileByTableGeocodingParameters(); // Set specific analysis parameters (weight field is absent in this record set!) targetProfileParameters.GeocodeData = geocodeData; targetProfileParameters.SegmentationBase = "Total Households"; // Set other parameters // In general, a non-null esriFolderItem is specified to save a newly-created // item to the server-side repository or to reference an existing item in it. outputItem = new esriFolderItem(); outputItem.folderType = esriFolderType.esriFolderSegProfiles; outputItem.itemName = "targetProfile2_MultiProfileBarChart"; outputItem.projectName = "Default Project"; outputItem.workspaceName = "Default Workspace"; targetProfile = baServerHelper.ProfileByTableGeocoding(targetProfileParameters, outputItem); ProfileData targetProfileData2 = new ProfileData(); targetProfileData2.Description = targetProfile; // ========= STEP 4: Create a boundary layer from standard geographies // The San Francisco County study area is selected as the boundary. StandardLevelsOfGeographyParameters geographyParameters = new StandardLevelsOfGeographyParameters(); // Set specific analysis parameters geographyParameters.GeographyFeaturesBehavior = esriStdGeographyType.esriStdGeographyTypeFirst; geographyParameters.GeographyIDs = new string[] { "06075" }; // FIPS ID code for San Francisco County geographyParameters.GeographyLevelID = "US.Counties"; // Set other parameters imageOptions = null; outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass }; outputLayer = null; outputReport = null; TaskResultOutput geographyResult = baServerHelper.StandardLevelsOfGeography(geographyParameters, imageOptions, outputOptions, outputLayer, outputReport); DataLayer boundaryLayer = new DataLayer(); boundaryLayer.RecordSet = geographyResult.RecordSet; // ========= STEP 5: Create a base segmentation profile by the boundary layer ProfileByAreaSummationParameters baseProfileParameters = new ProfileByAreaSummationParameters(); // Set specific analysis parameters baseProfileParameters.AreaIDField = "AREA_ID"; baseProfileParameters.Boundaries = boundaryLayer; baseProfileParameters.SegmentationBase = "Total Households"; // Set other parameters // In general, a non-null esriFolderItem is specified to save a newly-created // item to the server-side repository or to reference an existing item in it. outputItem = new esriFolderItem(); outputItem.folderType = esriFolderType.esriFolderSegProfiles; outputItem.itemName = "baseProfile_MultiProfileBarChart"; outputItem.projectName = "Default Project"; outputItem.workspaceName = "Default Workspace"; string baseProfile = baServerHelper.ProfileByAreaSummation(baseProfileParameters, outputItem); ProfileData baseProfileData = new ProfileData(); baseProfileData.Description = baseProfile; // ========= STEP 6: Execute the analysis MultiProfileBarChartParameters parameters = new MultiProfileBarChartParameters(); // Set specific analysis parameters parameters.BaseProfile = baseProfileData; parameters.IndexThreshold = 110; parameters.TargetProfile1 = targetProfileData1; parameters.TargetProfile2 = targetProfileData2; // Set report options ReportOptions reportOptions = new ReportOptions(); reportOptions.ReportFormat = "PDF"; reportOptions.ReportHeader = new KeyValue[1]; reportOptions.ReportHeader[0] = new KeyValue(); reportOptions.ReportHeader[0].Key = "subtitle"; reportOptions.ReportHeader[0].Value = "Multi-Profile Bar Chart Report for two profiles"; parameters.StandardReportOptions = reportOptions; // Set other parameters outputReport = null; TaskResultOutput result = baServerHelper.MultiProfileBarChart(parameters, outputReport); string reportURL = result.Reports[0].ReportURL; |