Socket
Book a DemoInstallSign in
Socket

@aquassay/d3-horizon

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aquassay/d3-horizon

Horizon chart for D3

0.5.0
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

d3-horizon

Horizon graph for D3

screenshot

Installation

npm i @aquassay/d3-horizon

Dependencies

  • D3 Brush
  • D3 Array
  • D3 Axis
  • D3 Scale
  • D3 Scale Chromatic
  • D3 Selection
  • D3 Shape

Usage

To show your data, You have to do this :

import { horizon } from '@aquassay/d3-horizon';

const container = document.getElementById('#my-horizon-container');
const data      = [/* your data here */];
const svg       = horizon(data);

container.innerHTML = '';
container.appendChild(svg);

And, if you want to export them to SVG file, You have to do this :

import { getURL } from '@aquassay/d3-horizon';

const link = document.createElement('a');
const url  = getURL(svg);

link.href       = url;
link.download   = 'export.svg';

link.click();

If you want to make a Selection of the data, You can with this : Actually, it return only the first and last dates of the selected range.

import { horizon } from '@aquassay/d3-horizon';

const container = document.getElementById('#my-horizon-container');
const data      = [/* your data here */];
const svg       = horizon(data, {
    onSelectedEnd(range) {
        // action on select part like request more data with axios and redraw the graphics like a zoom
    },
    onSelectedStart() {
        // action on start select to force the hiding of the tooltip or other stuff if needed
    },
});

container.innerHTML = '';
container.appendChild(svg);

Keywords

d3

FAQs

Package last updated on 25 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.