Installation

dotAtlas comes as an NPM dependency, UNPKG CDN download and also as a traditional ZIP distribution package. Choose the one that best suits your workflow.

NPM dependency

dotAtlas is available as an NPM dependency for modern web application development workflows. To add it to your project, run:

npm install @carrotsearch/dotatlas

or

yarn add @carrotsearch/dotatlas

Once the dotAtlas dependency is installed, you can import the DotAtlas class and plugin classes as follows:

import { DotAtlas, Theme, Effects } from "@carrotsearch/dotatlas";

const dotAtlas = DotAtlas.with(Theme, Effects).embed({ ... });

If you hold a dotAtlas license, see the license key section.

Distribution package

For traditional plain old JavaScript workflows, use the dotAtlas ZIP distribution archive. The contents of the archive are the following:

Contents

dotAtlas distribution archive contains the following files:

Path Description
doc/

This documentation.

demos/

Self-contained code examples demonstrating specific aspects of dotAtlas.

dotatlas.js

dotAtlas implementation in the ES6 modules format, minified.

dotatlas.min.js

dotAtlas implementation as a classic script (the DotAtlas global), minified.

index.js

The ES module entry point that exports DotAtlas and all plugin classes by name.

plugin.*.js, plugin.*.min.js

dotAtlas plugins as ES modules and as classic scripts (globals), respectively. The plugins come as source code under the Apache Software License 2.0, so feel free to copy and modify them as desired.

plugin.legend.css

The default stylesheet of the Legend plugin.

Installation

The way you reference dotAtlas in your page depends on whether you choose the ES modules or the classic scripts.

Classic scripts

To use the classic scripts, include the desired *.min.js scripts in your page and use the global symbols they provide. The following example uses the DotAtlas class along with the Theme plugin:

<body>
  <script src="dotatlas.min.js"></script>
  <script src="plugin.theme.min.js"></script>

  <script>
    var dotAtlas = DotAtlas.with(Theme).embed({ ... });
  </script>
</body>

ES6 modules

The support for ES6 modules in modern browsers is very good and you can use this format with dotAtlas too. The following example uses the main DotAtlas class and the Theme plugin. Note the type="module" attribute added to the script tag and the fact that we now import from the *.js versions of the scripts.

<body>
  <script type="module">
    import { DotAtlas, Theme } from "./index.js";

    const dotAtlas = DotAtlas.with(Theme).embed({ ... });
  </script>
</body>

UNPKG CDN

dotAtlas is also available on the UNPKG CDN, ready to be directly imported into your page.

To reference the latest available version, use the following URL:

https://unpkg.com/@carrotsearch/dotatlas/dotatlas.js

To reference a specific version, use a URL similar to:

https://unpkg.com/@carrotsearch/dotatlas@1.1.0/dotatlas.js

Note that the UNPKG CDN contains all the JavaScript files available in the distribution package, for example:

dotAtlas as an ES module:

https://unpkg.com/@carrotsearch/dotatlas@1.1.0/dotatlas.js

dotAtlas as a classic script:

https://unpkg.com/@carrotsearch/dotatlas@1.1.0/dotatlas.min.js

dotAtlas themes plugin, ES6 modules variant:

https://unpkg.com/@carrotsearch/dotatlas@1.1.0/plugin.theme.js

License key

Without a license key, dotAtlas displays the dotAtlas logo over the visualization. If you purchased a dotAtlas license, you receive a license key that unlocks the branding options. To use the key, pass it in the licenseKey option:

const dotAtlas = DotAtlas.embed({
  element: document.getElementById("map"),
  licenseKey: "eyJhIjp7fSwiaSI6IjIwMjYtMTAtMTUiLCJuIjoiQWNtZSBDb3Jwb3JhdGlvbiIsInAiOiJkb3RhdGxhcyIsInYiOjF9...",
  ...
});

The license key is a signed string that contains the licensee name, the date of issue and, for time-limited licenses, the expiry dates of the license and the maintenance period. dotAtlas verifies the key during embedding. If the key is not valid, has expired, was issued for a different product, or its maintenance period ended before the release of your dotAtlas version, dotAtlas logs the reason in the browser's console and displays the logo.

To check whether the key unlocked the branding options, call the version() method of the dotAtlas instance.

In versions before 1.1.0, the licensed version of dotAtlas was a separate package that you downloaded from https://secure.carrotsearch.com. Starting with version 1.1.0, there is no separate package to download: the license key is all you need.