npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bfhp/astro-natal-chart

v0.1.8

Published

Lightweight astrology natal chart SVG renderer

Readme

AstroNatalChart

AstroNatalChart example

Lightweight vanilla JavaScript SVG renderer for drawing astrological natal charts in the browser. No dependencies, no jQuery, and ready for npm installation.

The library renders a classic circular horoscope chart including:

  • Zodiac ring
  • Planet ring
  • Houses (I–XII)
  • Ascendant / Descendant axis
  • MC / IC axis
  • Aspect lines
  • Planet symbols with collision avoidance
  • Aspect-based coloring of planets
  • Optional second set of planets (synastry / transit style)
  • SVG output for sharp rendering at any size

Live Demo

https://bfhp.github.io/astro-natal-chart/


Features

✔ Pure vanilla JSSVG rendering (no canvas) ✔ Responsive scaling ✔ Planet collision avoidance ✔ Classical aspect calculation ✔ Planet coloring by strongest aspect ✔ Optional second planet set (synastry / transits) ✔ Customizable colors and labels ✔ Works in modern browsers without frameworks


Responsive Design

The chart is fully responsive.

It automatically adapts to the width of its container using SVG scaling. The chart is rendered once and then smoothly scales to any size without recalculating geometry.

This makes it suitable for:

  • responsive layouts
  • mobile devices
  • orientation changes (phone / tablet rotation)
  • flexible containers (flexbox / grid)

Example:

<div id="chart" style="max-width:600px;"></div>
#chart {
  width: 100%;
}

The chart will automatically scale to the container width while maintaining a perfect square aspect ratio.


Installation

npm install @bfhp/astro-natal-chart

or include directly:

<script type="module">
    import AstroNatalChart from "./astro-natal-chart.js"
</script>

Basic Usage

import AstroNatalChart from "@bfhp/astro-natal-chart"

const data = {
  cusps: [147, 166, 192, 225, 264, 299, 327, 346, 12, 45, 84, 119],

  planets: {
    Sun: 221,
    Moon: 110,
    Mercury: 244,
    Venus: 202,
    Mars: 184,
    Jupiter: 308,
    Saturn: 238,
    Uranus: 256,
    Neptune: 271,
    Pluto: 214
  }
}

new AstroNatalChart("#chart", data)

HTML:

<div id="chart" style="max-width:600px;"></div>

Synastry / Transits

You can optionally provide a second set of planets.

When two sets are provided:

  • planets from both sets are drawn
  • aspects are calculated only between sets
  • symbols are automatically spaced to avoid collisions

Example:

new AstroNatalChart("#chart", {
  cusps,

  planets: {
    Sun: 221,
    Moon: 110,
    Mercury: 244,
    Venus: 202,
    Mars: 184,
    Jupiter: 308,
    Saturn: 238,
    Uranus: 256,
    Neptune: 271,
    Pluto: 214
  },

  planets2: {
    Sun: 120,
    Moon: 87,
    Mercury: 130,
    Venus: 150,
    Mars: 210,
    Jupiter: 300,
    Saturn: 260,
    Uranus: 250,
    Neptune: 270,
    Pluto: 220
  }
})

If planets2 is not provided, aspects are calculated within the single set (standard natal chart).


Data Format

Cusps

House cusps must be provided in absolute zodiac degrees (0–360°).

Example:

cusps: [
  147, // I
  166, // II
  192, // III
  225, // IV
  264, // V
  299, // VI
  327, // VII
  346, // VIII
  12,  // IX
  45,  // X (MC)
  84,  // XI
  119  // XII
]

Ascendant is automatically taken from house I.


Planets

Planet positions must be provided as absolute zodiac longitude (0–360°).

planets: {
  Sun: 221.5,
  Moon: 110.1,
  Mercury: 244.0,
  Venus: 202.9,
  Mars: 184.6,
  Jupiter: 308.7,
  Saturn: 238.4,
  Uranus: 256.1,
  Neptune: 271.6,
  Pluto: 214.9
}

Supported planets:

Sun
Moon
Mercury
Venus
Mars
Jupiter
Saturn
Uranus
Neptune
Pluto

Aspects

Supported classical aspects:

| Aspect | Angle | |-------------|-------| | Conjunction | 0° | | Sextile | 60° | | Square | 90° | | Trine | 120° | | Opposition | 180° |

Default orbs:

| Aspect | Orb | |-------------|-----| | Conjunction | 8° | | Sextile | 6° | | Square | 6° | | Trine | 6° | | Opposition | 8° |

Planets are colored according to their strongest (tightest) aspect.

Typical colors:

Conjunction  — dark
Sextile      — green
Trine        — green
Square       — red
Opposition   — red

Rendering Layers

The chart is drawn using layered SVG elements:

  1. Planet ring background
  2. House lines
  3. Asc/Dsc axis
  4. MC/IC axis
  5. Aspect background mask
  6. Planet dots
  7. Aspect lines
  8. Zodiac ring
  9. Planet symbols
  10. Center circle
  11. Sun symbol outside the zodiac ring

Collision Avoidance

If several planets are close in longitude (stellium), the renderer automatically:

  • detects overlaps
  • slightly shifts planets along the orbit
  • preserves planetary order

This keeps the chart readable without distorting astrological geometry.


Customization

You can override colors and labels.

Example:

new AstroNatalChart("#chart", {

  cusps,
  planets,

  colors: {
    border: "#006600",
    asc: "#ff0000",
    mc: "#0000ff",
    text: "#222"
  },

  lang: {
    asc: "Asc",
    dsc: "Dsc",
    mc: "MC",
    ic: "IC",

    planets: {
      Sun: "Sun",
      Moon: "Moon",
      Mercury: "Mercury",
      Venus: "Venus",
      Mars: "Mars",
      Jupiter: "Jupiter",
      Saturn: "Saturn",
      Uranus: "Uranus",
      Neptune: "Neptune",
      Pluto: "Pluto",
    }
  }

})

Browser Support

Works in all modern browsers supporting:

  • ES modules
  • SVG
  • modern DOM APIs

Tested in:

  • Chrome
  • Firefox
  • Safari
  • Edge

License

MIT License