Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                <html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
  <title>
    JavaScript 4.21
  </title>

  <link rel="stylesheet" href="https://js.arcgis.com/4.21/esri/themes/light/main.css" />

  <script src="https://js.arcgis.com/4.21/"></script>

  <style>
    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
  </style>

  <script>
    require([
      "esri/Map",
      "esri/PopupTemplate",
      "esri/views/MapView",
      "esri/Graphic",
      "esri/geometry/Point",
      "esri/widgets/Print"
    ], (Map, PopupTemplate, MapView, Graphic, Point, Print) => {
      const map = new Map({
        basemap: "gray-vector"
      });
      const view = new MapView({
        center: [-97.63, 38.34],
        container: "viewDiv",
        map: map,
        zoom: 3
      });
      /*************************
       * Create point graphics
       *************************/
      // First create a point geometry
      const point1 = new Point({
        longitude: -117.19,
        latitude: 34.05
      });
      // Then create another point geometry
      const point2 = new Point({
        longitude: -87.63,
        latitude: 41.88
      });
      // Then create another point geometry
      const point3 = new Point({
        longitude: -71.06,
        latitude: 42.36
      });
      // Then create another point geometry
      const point4 = new Point({
        longitude: -122.33,
        latitude: 47.6
      });
      // Then create a final point geometry
      const point5 = new Point({
        longitude: -104.99,
        latitude: 39.74
      });
      // Create a symbol for drawing the point
      const textSymbol = {
        type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
        color: [226, 119, 40],
        outline: {
          // autocasts as new SimpleLineSymbol()
          color: [255, 255, 255],
          width: 2
        }
      };
      // Create a symbol for labels
      const textSymbol2 = {
        type: "text", // autocasts as new TextSymbol()
        color: "white",
        haloColor: "blue",
        haloSize: "1px",
        text: "Thomas Edward Patrick Brady Jr. (born August 3, 1977) " + "\n" + "is an American football player who is a quarterback for" + "\n" + " the Tampa Bay Buccaneers of the " + "\n" + "National Football League (NFL)." + "\n" + "He spent his first 20 seasons with the New England Patriots, " + "\n" + "where he was a central contributor to the franchise from 2001 to 2019. " + "\n" + "Brady is widely considered to be the greatest quarterback of all time. " + "\n" + "Source:https://en.wikipedia.org/wiki/Tom_Brady",
        xoffset: 0,
        yoffset: 0,
        font: {
          size: 12,
          family: "sans-serif",
          weight: "bold"
        },
        lineWidth: 300,
        horizontalAlignment: "left",
        verticalAlignment: "bottom"
      };
      //text: "Thomas Edward Patrick Brady Jr. (born August 3, 1977) " + "\n" + "is an American football player who is a quarterback for" + "\n" + " the Tampa Bay Buccaneers of the " + "\n" + "National Football League (NFL)." + "\n" + "He spent his first 20 seasons with the New England Patriots, " + "\n" + "where he was a central contributor to the franchise from 2001 to 2019. " + "\n" + "Brady is widely considered to be the greatest quarterback of all time. " + "\n" + "Source:https://en.wikipedia.org/wiki/Tom_Brady"
      // Create a graphic and add the geometry and symbol to it
      const pointGraphic1 = new Graphic({
        geometry: point1,
        symbol: textSymbol
      });
      // Create a graphic and add the geometry and symbol to it
      const pointGraphic1a = new Graphic({
        geometry: point1,
        symbol: textSymbol2
      });
      // Create another graphic and add the geometry and symbol to it
      const pointGraphic2 = new Graphic({
        geometry: point2,
        symbol: textSymbol
      });
      // Create another graphic and add the geometry and symbol to it
      const pointGraphic3 = new Graphic({
        geometry: point3,
        symbol: textSymbol
      });
      // Create another graphic and add the geometry and symbol to it
      const pointGraphic3a = new Graphic({
        geometry: point3,
        symbol: textSymbol2
      });
      // Create another graphic and add the geometry and symbol to it
      const pointGraphic4 = new Graphic({
        geometry: point4,
        symbol: textSymbol
      });
      // Create one last graphic and add the geometry and symbol to it
      const pointGraphic5 = new Graphic({
        geometry: point5,
        symbol: textSymbol
      });
      // Add the graphics to the view's graphics layer
      view.graphics.addMany([
        pointGraphic1,
        pointGraphic1a,
        pointGraphic2,
        pointGraphic3,
        pointGraphic3a,
        pointGraphic4,
        pointGraphic5
      ]);
      view.when(function() {
        var print = new Print({
          view: view,
          // specify your own print service
          printServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
        });
        // Add widget to the top right corner of the view
        view.ui.add(print, "top-left");
      });
    });
  </script>
</head>

<body>
  <div id="viewDiv"></div>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console