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);
});
}));
Akshay,
What errors if any are shown in the browsers web console?
PFA
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) {
Sure. Will try that. Thanks.