Error: smartMapping.createClassedColorRenderer: unable to find suitable style scheme.

632
4
02-05-2018 08:46 AM
akshayloya
Occasional Contributor II
Hi,
I don't know what wrong I'm doing here. I'm trying to implement smart mapping renderer on web app builder.
I have just copy pasted the code from sample itself still it is giving me an error.
Error: smartMapping.createClassedColorRenderer: unable to find suitable style scheme.
Can someone please help me with the issue.
   
define([
 'dojo/_base/declare',
 'jimu/BaseWidget',


 "dojo/query",
 "dojo/_base/lang",
 'dojo/_base/array',
 "dojox/form/RangeSlider",
 "dijit/form/VerticalRule",
 "dijit/form/VerticalSlider",
 "dijit/form/VerticalRuleLabels",
 "dojo/dom-construct",
 "dojo/dom",
 "dojo/on",
 "dojox/widget/ColorPicker",
 "dijit/form/DropDownButton",
 "dijit/ColorPalette",
 "dijit/layout/BorderContainer",
 "dijit/layout/ContentPane",


 "esri/renderers/SimpleRenderer",
 "esri/symbols/SimpleMarkerSymbol",
 "esri/Color",
 "esri/renderers/DotDensityRenderer",
 "esri/renderers/ScaleDependentRenderer",
 "esri/dijit/Legend",
 "esri/renderers/smartMapping",
 "esri/dijit/ClassedColorSlider",
 "esri/layers/FeatureLayer",
 
],
 function (
 declare,
 BaseWidget,


 query,
 lang,
 array,
 RangeSlider,
 VerticalRule,
 VerticalSlider,
 VerticalRuleLabels,
 domConstruct,
 dom,
 on,
 ColorPicker,
 DropDownButton,
 ColorPalette,
 BorderContainer,
 ContentPane,


 SimpleRenderer,
 SimpleMarkerSymbol,
 Color,
 DotDensityRenderer,
 ScaleDependentRenderer,
 Legend,
 smartMapping,
 ClassedColorSlider,
 FeatureLayer
 ) {
 .................



 var outFields = ["POP2007", "POP07_SQMI", "WHITE", "BLACK", "AMERI_ES", "ASIAN", "HAWN_PI", "OTHER", "MULT_RACE", "HISPANIC", "STATE_NAME", "NAME"];
 var layer1 = new FeatureLayer("//sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2", {
 "id": "Washington",
 "mode": FeatureLayer.MODE_SNAPSHOT,
 "outFields": outFields,
 "opacity": 0.8
 });


 //only working with Washington state
 layer1.setDefinitionExpression("STATE_NAME='Washington'");
 this.map.addLayer(layer1);


 layer1.on("load", lang.hitch(this, function () {
 smartMapping.createClassedColorRenderer({
 layer: layer1,
 field: "POP2007",
 basemap: this.map.getBasemap(),
 classificationMethod: "quantile"
 }).then(function (response) {
 layer1.setRenderer(response.renderer);
 layer1.redraw();
 // createLegend(this.map, layer1, field);
 });
 }));
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Akshay,

  What errors if any are shown in the browsers web console?

0 Kudos
akshayloya
Occasional Contributor II

PFA

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

I don't think that this.map.getBasemap() returns anything but undefined or null. Try manually setting the base map.

 smartMapping.createClassedColorRenderer({
   layer: layer1,
   field: "POP2007",
   basemap: "streets",
   classificationMethod: "quantile"
 }).then(function (response) {
0 Kudos
akshayloya
Occasional Contributor II

Sure. Will try that. Thanks.

0 Kudos