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

@redsift/ui-rs-radial-chart

v0.1.0

Published

A customizable radial chart.

Downloads

3

Readme

ui-rs-radial-chart

ui-rs-radial-chart is a component for creating a customizable radial chart for your application, e.g. to show data over time like monthly expenses on taxis over a year. It is provided as a custom element for easy integration into your projects.

If your browser does NOT support custom elements natively (see caniuse) you have to install the web components shim and include it in your project before including this component!

The component is part of the RedsiftUI library. For a documentation of the hero unit see the official RedsiftUI documentation.

Builds

Circle CI

A UMD build is available from //static.redsift.io/reusable/ui-rs-radial-chart/latest/ui-rs-radial-chart.umd-es2015.min.js.

To build locally checkout this repository and

> cd ui-rs-radial-chart
> npm install
> npm run build

This will create a ./dist folder with the Javascript and CSS files.

Browser Usage

First include the CSS file in the <head> of your page:

<link rel="stylesheet" href="//static.redsift.io/reusable/ui-rs-radial-chart/latest/css/ui-rs-radial-chart.min.css">

Additionally include the Javascript on the bottom of the <body>:

<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//static.redsift.io/reusable/ui-rs-radial-chart/latest/js/ui-rs-radial-chart.umd-es2015.min.js"></script>

Including the Javascript already registers the custom element rs-radial-chart with the browser. Make sure to include D3 before the component, as it depends on it!

Use the following HTML code to create a rs-radial-chart element:

<rs-radial-chart></rs-radial-chart>

You can optionally provide a DIV with the ID chart like so:

<rs-radial-chart>
  <div id="chart"></div>
</rs-radial-chart>

If provided the chart will render into this DIV, giving you more control over e.g. styling. If not provided a DIV is created automatically by the element.

Data is added to the chart via Javascript in the following form:

var chart = document.querySelector('rs-radial-chart');

var data = [{
    name: "Jan",
    value: 3.6732592034888905,
    color: () => { return '#00ff00'; }
}, {
    name: "Feb",
    value: 3.3835721480313685,
    color: () => { return '#00ff00'; },
    classed: "stripe"
}, {
    name: "Mar",
    value: 46.90614320865888,
    color: () => { return '#00ff11'; }
}, {
    name: "Apr",
    value: 16.262593631395912,
    color: () => { return '#00ff22'; }
}, {
    name: "May",
    value: 53.40171839979518,
    color: () => { return '#00ff33'; }
}, {
    name: "Jun",
    value: 15.899117927917139,
    color: () => { return '#00ff44'; }
}, {
    name: "Jul",
    value: 6.650584346480011,
    color: () => { return '#00ff55'; }
}, {
    name: "Aug",
    value: 26.689381547140503,
    color: () => { return '#00ff66'; }
}, {
    name: "Sep",
    value: 34.29461737322482,
    color: () => { return '#00ff77'; }
}, {
    name: "Oct",
    value: 26.4320733402228,
    color: () => { return '#00ff88'; }
}, {
    name: "Nov",
    value: 51.88087153647562,
    color: () => { return '#00ff99'; }
}, {
    name: "Dec",
    value: 54.6380052855129,
    color: () => { return '#00ffaa'; }
}];

chart.data = data;

CAUTION:

If your browser does not support custom elements (and only then!) make sure to wrap the above code into the following code:

window.addEventListener('WebComponentsReady', function(e) {
  // setup code ...
});

See a description of why this is necessary here.

Development Setup

For development run

> npm run serve

within the repository folder. It will start a web server serving the content of ./samples and supports live-reloading when a source file is changed.