Search

Without Sliders

Time Bar

Hide range sliders to focus on data within range.

Without Sliders
View live example →

Click on bars to highlight them.

Sliders are a manual control for the time bar range prop. You can hide the sliders to show only data within range.

Set the sliders.type option to ‘none’ to remove sliders.

See also

import React, { useState } from "react";
import { createRoot } from "react-dom/client";

import { TimeBar } from "regraph";

import data from "./data";
import { style } from "@ci/theme/rg/js/storyStyles";

export const Demo = () => <WithoutSliders items={data()} />;

function WithoutSliders(props) {
  const { items } = props;
  const [highlight, setHighlight] = useState([]);

  const removeHighlight = () => {
    setHighlight([]);
  };

  const highlightBar = ({ type, start }) => {
    setHighlight(type === "bar" ? [start] : []);
  };

  return (
    <div className="timebar-wrapper">
      <TimeBar
        items={items}
        highlight={highlight}
        onChange={removeHighlight}
        onClick={highlightBar}
        options={{
          sliders: { type: "none" },
          style: { ...style.primary1, hoverColor: style.primary0.color },
        }}
      />
    </div>
  );
}

const root = createRoot(document.getElementById("regraph"));
root.render(<Demo />);
function data() {
  return {
    id1: { times: [{ time: Date.now(), value: 2 }] },
    id2: { times: [{ time: Date.now() + 1000 * 60 * 60 }] },
    id3: { times: [{ time: Date.now() + 1000 * 60 * 60 * 3, value: 3 }] },
  };
}

export default data;
<!doctype html>
<html>
  <body>
    <div id="regraph" 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.