Search

Spacing

Entities

Adjust the vertical spacing between entity rows.

Spacing
View live example →

Use the dropdown to control the vertical spacing of entities:

  • Justified: Spread entities vertically across the height of the timeline, providing more space for any event labels and font icons.

  • Centered: (default) Cluster entities centrally along the timeline.

If you're using expanded rows, sub-rows aren't affected by entity spacing.

See also:

import { createTimeline } from "kronograph";
import data from "./data";

const timeline = createTimeline("my-timeline");

timeline.options({ entities: { rowSpacing: "justified" } });
timeline.set(data);
timeline.fit();

const spacingSelect = document.getElementById("spacing-select");

spacingSelect.addEventListener("change", (e) => {
  timeline.options({ entities: { rowSpacing: e.target.value } });
});
export default {
  entityTypes: {
    person: {
      color: "#0286F2",
      labelColor: "#EEEEEE",
      lineWidth: 12,
      typeLabel: "People",
    },
    company: {
      color: "#E9B628",
      labelColor: "#FDCA40",
      lineWidth: 2,
      typeLabel: "Companies",
    },
  },
  eventTypes: {
    email: {
      lineWidth: 2,
    },
    phoneCall: {
      lineWidth: 6,
      showArrows: false,
    },
  },
  entities: {
    "smith-johnathan-151": {
      label: "John Smith",
      type: "person",
    },
    "west-josephine-126": {
      label: "Josephine West",
      type: "person",
    },
    "roberts-nathaniel-023": {
      label: "Nathan Roberts",
      type: "person",
    },
    company0375: {
      label: "Leffler Inc.",
      type: "company",
    },
    company1846: {
      label: "EDI Group",
      type: "company",
    },
  },
  events: {
    "email 1": {
      entityIds: ["smith-johnathan-151", "company0375"],
      type: "email",
      time: new Date(2026, 9, 14),
    },
    "email 2": {
      entityIds: ["west-josephine-126", "company0375"],
      type: "email",
      time: new Date(2026, 3, 15),
    },
    "email 3": {
      entityIds: ["roberts-nathaniel-023", "company0375"],
      type: "email",
      time: new Date(2027, 7, 16),
    },
    "call 1": {
      entityIds: ["west-josephine-126", "company0375"],
      type: "phoneCall",
      time: new Date(2027, 10, 14),
    },
    "email 4": {
      entityIds: ["roberts-nathaniel-023", "company0375"],
      type: "email",
      time: new Date(2026, 12, 12),
    },
    "email 5": {
      entityIds: ["smith-johnathan-151", "company0375"],
      type: "email",
      time: new Date(2028, 3, 15),
    },
    "email 6": {
      entityIds: ["smith-johnathan-151", "company1846"],
      type: "email",
      time: new Date(2025, 9, 14),
    },
    "call 2": {
      entityIds: ["west-josephine-126", "company1846"],
      type: "phoneCall",
      time: new Date(2025, 12, 15),
    },
    "email 7": {
      entityIds: ["roberts-nathaniel-023", "company1846"],
      type: "email",
      time: new Date(2028, 2, 16),
    },
    "email 8": {
      entityIds: ["west-josephine-126", "company1846"],
      type: "email",
      time: new Date(2026, 2, 24),
    },
    "email 9": {
      entityIds: ["roberts-nathaniel-023", "company1846"],
      type: "email",
      time: new Date(2028, 6, 16),
    },
    "email 10": {
      entityIds: ["smith-johnathan-151", "company1846"],
      type: "email",
      time: new Date(2028, 7, 12),
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div class="story">
      <div class="story__timeline" id="my-timeline"></div>
      <div class="story__controls story__controls--row">
        <div class="stack">
          <div class="story__controls__item">
            <label for="spacing-select">Entity Row Spacing</label>
            <select id="spacing-select" class="select story__controls__item__child--flex-2">
              <option value="justified">Justified</option>
              <option value="centered">Centered</option>
            </select>
          </div>
        </div>
      </div>
    </div>
    <script type="module" src="./code.js"></script>
  </body>
</html>
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import Timeline from "kronograph/react/Timeline";
import data from "./data";

const { entities, events, entityTypes, eventTypes } = data;

export const Demo = () => {
  const [options, setOptions] = useState({ entities: { rowSpacing: "justified" } });

  return (
    <div className="story">
      <Timeline
        className="story__timeline"
        entityTypes={entityTypes}
        eventTypes={eventTypes}
        entities={entities}
        events={events}
        options={options}
      />
      <div className="story__controls story__controls--row">
        <div className="stack">
          <div className="story__controls__item">
            <label htmlFor="spacing-select">Entity Row Spacing</label>
            <select
              id="spacing-select"
              className="select story__controls__item__child--flex-2"
              defaultValue={"justified"}
              onChange={(e) => {
                setOptions({ entities: { rowSpacing: e.target.value } });
              }}
            >
              <option value="justified">Justified</option>
              <option value="centered">Centered</option>
            </select>
          </div>
        </div>
      </div>
    </div>
  );
};

const root = createRoot(document.getElementById("my-timeline"));
root.render(<Demo />);
export default {
  entityTypes: {
    person: {
      color: "#0286F2",
      labelColor: "#EEEEEE",
      lineWidth: 12,
      typeLabel: "People",
    },
    company: {
      color: "#E9B628",
      labelColor: "#FDCA40",
      lineWidth: 2,
      typeLabel: "Companies",
    },
  },
  eventTypes: {
    email: {
      lineWidth: 2,
    },
    phoneCall: {
      lineWidth: 6,
      showArrows: false,
    },
  },
  entities: {
    "smith-johnathan-151": {
      label: "John Smith",
      type: "person",
    },
    "west-josephine-126": {
      label: "Josephine West",
      type: "person",
    },
    "roberts-nathaniel-023": {
      label: "Nathan Roberts",
      type: "person",
    },
    company0375: {
      label: "Leffler Inc.",
      type: "company",
    },
    company1846: {
      label: "EDI Group",
      type: "company",
    },
  },
  events: {
    "email 1": {
      entityIds: ["smith-johnathan-151", "company0375"],
      type: "email",
      time: new Date(2026, 9, 14),
    },
    "email 2": {
      entityIds: ["west-josephine-126", "company0375"],
      type: "email",
      time: new Date(2026, 3, 15),
    },
    "email 3": {
      entityIds: ["roberts-nathaniel-023", "company0375"],
      type: "email",
      time: new Date(2027, 7, 16),
    },
    "call 1": {
      entityIds: ["west-josephine-126", "company0375"],
      type: "phoneCall",
      time: new Date(2027, 10, 14),
    },
    "email 4": {
      entityIds: ["roberts-nathaniel-023", "company0375"],
      type: "email",
      time: new Date(2026, 12, 12),
    },
    "email 5": {
      entityIds: ["smith-johnathan-151", "company0375"],
      type: "email",
      time: new Date(2028, 3, 15),
    },
    "email 6": {
      entityIds: ["smith-johnathan-151", "company1846"],
      type: "email",
      time: new Date(2025, 9, 14),
    },
    "call 2": {
      entityIds: ["west-josephine-126", "company1846"],
      type: "phoneCall",
      time: new Date(2025, 12, 15),
    },
    "email 7": {
      entityIds: ["roberts-nathaniel-023", "company1846"],
      type: "email",
      time: new Date(2028, 2, 16),
    },
    "email 8": {
      entityIds: ["west-josephine-126", "company1846"],
      type: "email",
      time: new Date(2026, 2, 24),
    },
    "email 9": {
      entityIds: ["roberts-nathaniel-023", "company1846"],
      type: "email",
      time: new Date(2028, 6, 16),
    },
    "email 10": {
      entityIds: ["smith-johnathan-151", "company1846"],
      type: "email",
      time: new Date(2028, 7, 12),
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div id="my-timeline" style="height: 100vh"></div>
    <script type="module" src="./code.jsx"></script>
  </body>
</html>

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.