JSFiddle - React, Tailwind, and code Playground
by Alex Azuero
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Visualize data with class breaks - 4.0</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.0/esri/css/main.css">
<script src="https://js.arcgis.com/4.0/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#infoDiv {
position: absolute;
bottom: 0;
left: 0;
max-width: 300px;
background-color: whitesmoke;
padding: 8px;
border-top-right-radius: 5px;
color: darkslategray;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/renderers/ClassBreaksRenderer",
"esri/symbols/SimpleFillSymbol",
"esri/widgets/Legend",
"dojo/domReady!"
], function(
Map, MapView, FeatureLayer, ClassBreaksRenderer, SimpleFillSymbol,
Legend
) {
/*****************************************************************
* Define symbols for each class break.
*****************************************************************/
var less35 = new SimpleFillSymbol({
color: "#7B3294",
style: "solid",
outline: {
width: 0.5,
color: "white"
}
});
var less50 = new SimpleFillSymbol({
color: "#C2A5CF",
style: "solid",
outline: {
width: 0.5,
color: "white"
}
});
var more50 = new SimpleFillSymbol({
color: "#A6DBA0",
style: "solid",
outline: {
width: 0.5,
color: "white"
}
});
var more75 = new SimpleFillSymbol({
color: "#008837",
style: "solid",
outline: {
width: 0.5,
color: "white"
}
});
...