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

pugh-chart

v0.0.3

Published

Webcomponent pugh-chart built using Lit

Downloads

4

Readme

pugh-chart

This is a pugh chart web component created with the purpose of allow users to easily implement a pugh chart into their website no matter the framework.

Benefits

  • Easy to implement
  • Easy to use
  • Works in React, Angular, Vue
  • Will work in any framework at all

Dependencies

  • Built using lit

Features

  • Can be created straight in the HTML tag
  • Can have minor styling on top of the base Bootstrap styling or can completely overhaul the styling with the importation of self-made CSS classes
  • Using a settings button in the bottom left, the user can edit the pugh chart and play around with it so as to really capture the full benefits of a pugh chart
  • Base styling is reactive
  • Because this pugh chart is built with web components, the pugh-chart is abstracted from the rest of your HTML and will not interefere with your other code.

Installation

$ npm install pugh-chart

Importing

After installing the web component, it must also be imported.

This can be done in one of three ways.

Javascript module:

import 'pugh-chart';

Or through HTML as follows:

<script type="module">
import 'pugh-chart';
</script>

or

<script type="module" src="pugh-chart"></script>

Usage

After importing simply using the tag will add the web component to the application.

<pugh-chart></pugh-chart>

But this will not include any information and all editing of the pugh chart will have to be done via the website on which the component is hosted. If you wish to have persistent data inputted. This must be passed as an HTML property as seen in the following example.

 <pugh-chart darkMode="true" inputCategories="Price,Fun,Complexity" inputWeights = "1,2,3" inputOptions="Car,1,1,1/Bike,2,2,2"></pugh-chart>

The data is passed to the HTML properties as a string (this was done because arrays had a tendency to sometimes break and in order to have a better overall solution, strings were used). Categories are the metrics by which options will be judged. Weights are the relative weights for each of the categories and correspond by placement in the string. Then options are the options with their scores. To separate each complete option and score grouping from each other, a slash with no spaces around it must be used. Otherwise, to separate different inputs within each string, a comma is always used. Dark mode is set to true (using a string for testing purposes with Storybook but this may be changed in the future). Dark mode is off by default.

Properties

| Property | Type | Default | Description | |-------------------|-----------|--------------------------------------------------|--------------------------------------------------| | darkMode | String | "false" | Choose whether to have the default table styling to be dark mode or not. Done as a string for testing purposes in Storybook. May be changed later. | | editBool | Boolean | false | Choose whether to have table editable as soon as it opens or not. | | href | string | Bootstrap CDN | This is the href used to style the component. By default it is the bootstrap CDN but it can be manually inputted by the user. | | inputCategories | string | "" | These are the categories for the chart that must be inputted as a string with commas separating categories. | | inputOptions | string | "" | These are the options for the chart that must be inputted as a string with commas sepearting score from header but a / separating groupings of entire options. | | inputWeights | string | "" | These are the weights for the chart that must be inputted as a string with commas separating weights. | | tBodyClass | string | "" | tbody class that is left blank but can be inputted by the user. | | tableClass | string | "table table-striped" | This is the table class that is by default table table-striped (from Bootstrap). Can be manually inputted by the user. | | tdClass | string | "" | td class that is left blank but can be inputted by the user. | | thClass | string | "" | th class that is left blank but can be inputted by the user. | | theadClass | string | "" | thead class that is left blank but can be inputted by the user. | | trClass | string | "" | tr class that is left blank but can be inputted by the user. |

Methods

| Method | Type | |------------------|----------------------| | addCriteria | (): void | | addOption | (): void | | deleteCriteria | (index: any): void | | deleteOption | (index: any): void | | fillArray | (): void | (These methods do not need to be used by the user and are only here for reference)