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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stencil-vizzle

v0.0.2

Published

Visualization web components built with Stencil.js and D3.

Downloads

3

Readme

stencil-vizzle

Reusable, easy-to-use visualization web components built with Stencil and D3.js

Motivation

I've been using D3.js since 2012 — almost as long as it's been out — and have built highly configurable, reusable charting functions/classes within a variety of frameworks, namely ExtJS, AngularJS, and React.

As much as I tried to make the charts "universal" in terms of porting across frameworks, there have always been library idiosyncrasies standing in the way, most notably in terms of DOM manipulation, data binding and render lifecycles.

As the Custom Elements specification has matured and browser support has improved, I felt I finally had the opportunity to create true "write once, run anywhere" visualization web components and so here we are.

Inspiration

stencil-vizzle takes its cue from the core tenet of D3.js, e.g. Data-Driven Documents and is influenced by frameworks like RAW/RAWGraphs i.e., ad-hoc mapping of data properties to attributes in your custom element.

Features

  • Framework agnostic
  • No third party libaries required
  • In general, requires little to no transformation of your data prior to use.
  • Highly customizable
  • Show or hide chart features like axes, legend, gridlines, and/or axis labels.
  • Adjustable margins, stroke, stroke width and font sizes
  • inverse support for use on darker backgrounds.

Quick Example w/ Unpkg <script> Tag

A simple, customizable bar chart using user-specified property -> attribute mappings. See the individual READMEs for information on available attributes and how to use them. Additional ready-to-use examples can be found in the examples folder.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
  <title>stencil-vizzle</title>
  <script type="module" src="https://unpkg.com/[email protected]/dist/stencil-vizzle/stencil-vizzle.esm.js"></script>
  <script nomodule="" src="https://unpkg.com/[email protected]/dist/stencil-vizzle/stencil-vizzle.js"></script>
  <style type="text/css">
    body {
      padding: 20px;
      font-family: "Arial", "Helvetica", sans-serif;
    }
  </style>
</head>
<body>
  <stv-bar-chart
    axis-label-font-size="12"
    bar-stroke="#990066"
    chart-id="myStvBarChart"
    canvas-width="600"
    canvas-height="400"
    gridlines
    legend
    legend-metric="name"
    margin-left="35"
    ordinal-metric="contestant"
    linear-metric="score"
    linear-tick-format="localestring"
    tooltips
    x-label="Contestant"
    y-label="Total Score">
  </stv-bar-chart>
</body>

<script>
  document.addEventListener('stv-bar-chart-loaded', function() {
    var data = [
      {contestant: 'A', name: 'Mark', score: 1000},
      {contestant: 'B', name: 'Fred', score: 750},
      {contestant: 'C', name: 'Walter', score: 1250}
    ]
    document.querySelector('stv-bar-chart').chartData = data
  })
</script>
</html>

...and you should see something like this:

TL/DR Quickstart

Run Demo Application

# checkout project
$> npm i
$> npm run demo
# browser should open to localhost:5150

Chart Components

All components are highly configurable via their supported attributes to offer the most flexibility in terms of tailoring your visualization to convey as much or as little information as you wish.

<stv-line-chart>

README

<stv-bar-chart>

README

<stv-stacked-bar-chart>

README

<stv-pie-chart>

README

Developer Section

Dev Server

# checkout project
$> npm i
$> npm start
# browser should open to localhost:3333

Testing

# unit tests, single run
$> npm run test

# unit tests, watch mode
$> npm run test:watch

# e2e tests, single run
$> npm run e2e

# e2e tests, watch mode
$> npm run e2e:watch

Linting

# lint js (tsx) and scss
$> npm run lint

# lint only the *.tsx files
$> npm run lint:stencil

# lint only the *.scss files
$> npm run lint:scss