Browse Components

Scatter

Explore relationships between two numeric measures.

Basic

Hover, tap or focus a mark to inspect exact values. Arrow keys move between observations.

Experience and satisfaction
Experience and satisfaction — example data
ObservationMonthsScore
Team A348
Team B863
Team C1258
Team D1678
Team E2174
Team F2589
Team G3083
View Code
HTML
<figure class="chart" data-chart="scatter">
  <figcaption>
    Experience and satisfaction
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Experience and satisfaction — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Months
          </th>
          <th scope="col">
            Score
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">
            Team A
          </th>
          <td>
            3
          </td>
          <td>
            48
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team B
          </th>
          <td>
            8
          </td>
          <td>
            63
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team C
          </th>
          <td>
            12
          </td>
          <td>
            58
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team D
          </th>
          <td>
            16
          </td>
          <td>
            78
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team E
          </th>
          <td>
            21
          </td>
          <td>
            74
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team F
          </th>
          <td>
            25
          </td>
          <td>
            89
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team G
          </th>
          <td>
            30
          </td>
          <td>
            83
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</figure>

Right-to-left

Labels follow the reading direction. Numeric and radial axes keep their established orientation.

Experience and satisfaction
Experience and satisfaction — example data
ObservationMonthsScore
Team A348
Team B863
Team C1258
Team D1678
Team E2174
Team F2589
Team G3083
View Code
HTML
<figure class="chart" dir="rtl" data-chart="scatter">
  <figcaption>
    Experience and satisfaction
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Experience and satisfaction — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Months
          </th>
          <th scope="col">
            Score
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">
            Team A
          </th>
          <td>
            3
          </td>
          <td>
            48
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team B
          </th>
          <td>
            8
          </td>
          <td>
            63
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team C
          </th>
          <td>
            12
          </td>
          <td>
            58
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team D
          </th>
          <td>
            16
          </td>
          <td>
            78
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team E
          </th>
          <td>
            21
          </td>
          <td>
            74
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team F
          </th>
          <td>
            25
          </td>
          <td>
            89
          </td>
        </tr>
        <tr>
          <th scope="row">
            Team G
          </th>
          <td>
            30
          </td>
          <td>
            83
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</figure>

Empty data

The chart keeps its reserved space without inventing observations.

Experience and satisfaction
Experience and satisfaction — example data
ObservationMonthsScore
View Code
HTML
<figure class="chart" data-chart="scatter">
  <figcaption>
    Experience and satisfaction
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Experience and satisfaction — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Months
          </th>
          <th scope="col">
            Score
          </th>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
  </div>
</figure>

Installation

Download these files into the matching paths in your project, or use Create to assemble a kit. Include each dependency once. Do not also load app.css.

Add to your page
<link rel="stylesheet" href="/library/assets/base.css">
<link rel="stylesheet" href="/library/assets/chart-core.css">
<link rel="stylesheet" href="/library/assets/chart-plots.css">
<link rel="stylesheet" href="/library/assets/scatter-chart.css">
<script defer src="/library/assets/chart-core.js"></script>
<script defer src="/library/assets/chart-plots.js"></script>
<script defer src="/library/assets/scatter-chart.js"></script>

12,194 bytes CSS including base · 15,364 bytes runtime JavaScript

Usage

Data format

Two columns: X and Y. Each row is a named observation. Numeric coordinates determine placement; they are not equally spaced categories. Negative coordinates are supported. Numeric axes retain their direction in RTL.

Shared interactions

Hover, tap or focus a mark to inspect its exact value. Arrow keys, Home and End move between marks; Escape dismisses the tooltip. The source table remains available without JavaScript. Enhanced charts expose exact values through accessible marks and tooltips.

Lifecycle and themes

Load Chart Core, Chart Plots and this component module. Theme tokens supply colors in light and dark modes. Use layoutCharts.refresh(root) after changing the table and destroy(root) before unmounting. Wide charts scroll within their frame.

Building with AI? The AI Manifest has these notes and the full contract. See the AI Guide.