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

saber-bar-chart

v1.0.3

Published

saber-bar-chart React component

Downloads

10

Readme

saber-bar-chart

created by: Chad Sterling

Travis npm package Coveralls

Do you need more bar charts in your life but don't want to go through the pain of setting them up? Are you finding in this post "Rise of Skywalker" era that there aren't enough lightsaber-ings happening in this world? well Have i got the solution for you! a LightSaber-ish barchart!

Features:

  • Star Field Background put together by Keith Clark: https://codepen.io/keithclark/pen/zqcEd
  • Identify the colors for the various light sabers in your bar chart
  • Create a popup for each of your bars that give the viewer additional data details
  • this is in react, so all you gotta do is drop this into the middle of your project and you're good to go in style
  • mousing over any bar in your graph gives a cool lightsaber sound effect!!

here's a gif of what it could look like

Requirements: in order to use the barchart, it requires data to be set up in a specific way

Color Array

  • this is an array of colors (represented as strings). these colors will represent the colors of the bars in your graph. Note that if you have more bars than colors in your color array, the colors will just repeat from the begining. You want striping? Just use 2 colors. Here is my example from the demo
    • colors = ["red", "green", "blue", "purple"]
  • this array is then passed into the ColorArray property in your SaberBarChart

bars look like light sabers when moused over

Bar Data

  • this is an list of objects that contain information about the bars in your data
  • Each object in your list should contain 3 key value pairs:
    • label - this is the string that you want to label your bar with
    • value - this is the value your bar represents. Note that bars are displayed relative to each other, so no need to include units, just a number value
    • details - this is an object that contains key value pairs for information about the object in question. When the bar is clicked on, this is the data tha is displayed
  • Here's an example of what the bar Data should look like:
    barData=[
    {
        label: "EF76 Nebulon-B escort frigate",
        value: 854,
        details: {
            "name": "EF76 Nebulon-B escort frigate", 
            "manufacturer": "Kuat Drive Yards", 
            "cost_in_credits": "8500000", 
            "length": "300", 
            "max_atmosphering_speed": "800", 
            "crew": "854", 
            "passengers": "75", 
        },
    },
    {
        label: "Trade Federation cruiser",
        value: 600,
        details: {
            "name": "Trade Federation cruiser", 
            "model": "Providence-class carrier/destroyer", 
            "manufacturer": "Rendili StarDrive, Free Dac Volunteers Engineering corps.", 
        },
    },        
    ]
  • This essentially gives you 2 bars and the details that will pop up when the user clicks on either of the bars

click on bar to get an alert popup

  • so in order to get your Saber Bar Chart going, just pass your 2 parameters into the bar chart and let me do the rest:
   <SaberBarChart
        ColorArray = {this.colors}
        Bars = {this.barData}
      /> 
  • Note: the properties are named ColorArray and Bars

Voila