Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      Size visual variable themes | Sample | ArcGIS API for JavaScript 4.18
    </title>

    <link
      rel="stylesheet"
      href="https://jsdev.arcgis.com/next/esri/themes/light/main.css"
    />
    <script src="https://jsdev.arcgis.com/next/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
      #size-theme-container {
        padding: 10px 10px 5px 10px;
      }
      #symbol-style-container {
        padding: 5px 10px 5px 10px;
      }
    </style>

    <script>
      require([
        "esri/WebScene",
        "esri/views/SceneView",
        "esri/layers/FeatureLayer",
        "esri/smartMapping/renderers/size",
        "esri/smartMapping/renderers/univariateColorSize",
        "esri/widgets/Legend",
        "esri/core/watchUtils"
      ], function (
        WebScene,
        SceneView,
        FeatureLayer,
        sizeRendererCreator,
        univariateRendererCreator,
        Legend,
        watchUtils
      ) {

        const clippingArea = {
          "spatialReference": {
            "latestWkid": 3857,
            "wkid": 102100
          },
          "xmin": -9400479.373579163,
          "ymin": 5150542.1260154415,
          "xmax": -9155706.748909581,
          "ymax": 5297332.579794139
        };

        const layer = new FeatureLayer({
          title: "Census tracts",
          portalItem: {
            id: "1566547c530643bb86fc8cbcb3c07875"
          },
          minScale: 0,
          maxScale: 0,
          opacity: 0.01
        });

        const map = new WebScene({
          basemap: {
            portalItem: {
              id: "ba223f982a3c4a0ea8c9953346e2a201"
            }
          },
          layers: [layer]
        });

        view = new SceneView({
          container: "viewDiv",
          map,
          environment: {
            background: {
              type: "color",
              color: "rgba(223, 236, 240,1)"
            },
            atmosphereEnabled: false,
            starsEnabled: false
          },
          camera: {
            "position": {
              "spatialReference": {
                "latestWkid": 3857,
                "wkid": 102100
              },
              "x": -9188084.45719222,
              "y": 4996797.687246369,
              "z": 66472.89310743527
            },
            "heading": 341.89081361907427,
            "tilt": 72.81094838143106
          },
          viewingMode: "local",
          clippingArea,
          constraints: {
            snapToZoom: false
          }
        });

        view.when(async () => {
          const layerView = await view.whenLayerView(layer);
          watchUtils.whenFalseOnce(layerView, "updating", updateLayer);
        });

        const legend = new Legend({
          view,
          container: document.getElementById("legend-container")
        });
        view.ui.add("container-div", "bottom-right");

        const themeSelect = document.getElementById("size-theme-select");
        themeSelect.addEventListener("change", updateLayer);

        // update the layer's renderer each time the user changes a parameter
        async function updateLayer() {
          const theme = themeSelect.value;

          const renderer = await createRenderer({ theme });
          layer.renderer = renderer;
          layer.opacity = 1;
        }

        async function createRenderer({ theme }) {
          // Update the legend title based on the selected theme
          const legendTitles = {
            above: `Increase in number of households 2000-2010`,
            below: `Decline in number of households 2000-2010`,
            "above-and-below": `Change in number of households 2000-2010`
          };

          let params = {
            layer,
            view,
            theme,
            valueExpression: `$feature.TOTHU10 - $feature.TOTHU00`,
            valueExpressionTitle: legendTitles[theme],
            defaultSymbolEnabled: false,
            symbolType: "3d-volumetric-uniform"
          };
          const { renderer } = await univariateRendererCreator.createContinuousRenderer(params);
          return renderer;
        }
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
    <div id="container-div" class="esri-widget">
      <div id="theme-container" class="esri-widget">
        <div id="size-theme-container">
          Select size theme:
          <select id="size-theme-select">
            <option value="above">above</option>
            <option value="below">below</option>
            <option value="above-and-below" selected>above-and-below</option>
          </select>
        </div>
      </div>
      <div id="legend-container"></div>
    </div>
  </body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console