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

              
                <html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
  <!--
     ArcGIS API for JavaScript, https://js.arcgis.com
     For more information about the intro-graphics sample,
     read the original sample description at developers.arcgis.com.
     https://developers.arcgis.com/javascript/latest/sample-code/intro-graphics/
     -->
  <title>Intro to graphics | Sample | ArcGIS API for JavaScript 4.23</title>

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

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

  <script>
    require(["esri/Map", "esri/views/MapView", "esri/Graphic"], (
      Map,
      MapView,
      Graphic
    ) => {
      const map = new Map({
        basemap: "hybrid"
      });
      const view = new MapView({
        center: [-80, 35],
        container: "viewDiv",
        map: map,
        zoom: 4
      });
      /****************************
       * Create a polyline graphic
       ****************************/
      // First create a line geometry (this is the Keystone pipeline)
      const polyline = {
        type: "polyline", // autocasts as new Polyline()
        paths: [
          [-111.3, 52.68],
          [-98, 49.5],
          [-93.94, 29.89]
        ]
      };
      // Create a symbol for drawing the line
      const lineSymbol = {
        type: "cim",
        data: {
          type: "CIMSymbolReference",
          symbol: {
            type: "CIMLineSymbol",
            symbolLayers: [{
                type: "CIMSolidStroke",
                enable: "true",
                effects: [{
                  type: "CIMGeometricEffectOffset",
                  method: "Round",
                  offset: -2,
                  option: "Fast"
                }],
                capStyle: "Round",
                joinStyle: "Round",
                miterLimit: 10,
                width: 1.5,
                color: [30, 144, 255, 255]
              },
              {
                type: "CIMSolidStroke",
                enable: true,
                capStyle: "Round",
                joinStyle: "Round",
                miterLimit: 10,
                width: 4,
                color: [220, 220, 220, 255]
              }
            ]
          }
        }
      };
      // Create an object for storing attributes related to the line
      const lineAtt = {
        Name: "Keystone Pipeline",
        Owner: "TransCanada",
        Length: "3,456 km"
      };
      /*******************************************
       * Create a new graphic and add the geometry,
       * symbol, and attributes to it. You may also
       * add a simple PopupTemplate to the graphic.
       * This allows users to view the graphic's
       * attributes when it is clicked.
       ******************************************/
      const polylineGraphic = new Graphic({
        geometry: polyline,
        symbol: lineSymbol,
        attributes: lineAtt,
        popupTemplate: {
          // autocasts as new PopupTemplate()
          title: "{Name}",
          content: [{
            type: "fields",
            fieldInfos: [{
                fieldName: "Name"
              },
              {
                fieldName: "Owner"
              },
              {
                fieldName: "Length"
              }
            ]
          }]
        }
      });
      // Add the graphics to the view's graphics layer
      view.graphics.addMany([polylineGraphic]);
    });
  </script>
</head>

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

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console