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

magx-sparkline

v1.0.0

Published

Lit component for creating sparklines

Downloads

2

Readme

Magx-Sparkline

Sparkline is a very plain and usually smallish chart that is used to show a variation in a measurement. It is used for providing a quick-glance and simple information without extra bells and whistles.

Magx-Sparkline uses Lit as the base libray for creating the web components and Vite as the build tool.

Examples

See the index.html and main.ts files that show various different sparkline examples.

How To Use

Install the component using npm:

$ npm install magx-sparkline

View the examples:

$ npm run dev

Then connect on your browser to the localhost URL provided by Vite.

First create either instance of MagxSparkline class or declare <magx-sparkline> element in DOM. If you declare the element in DOM, you can define multiple different attributes to customize the sparkline. Similarly you can customize the component completely programmatically.

The key values to changes are the type of the sparkline (line chart / bar chart), the outlook of the line and filling, and the reference line y-position and outlook that defines, which values are over/under zero line.

New data can be added dynamically and the total amount of data points on the sparkline can be defined at will.

The key attributes to modify are:

| Attribute | Method on class | HTML Attribute | ---- | ---- | ---- | | Sparkline type | setType() | type | | Background color | setBackgroundColor() | bckgCol | | Line / bar outline width | setLineWidth() | lineWidth | | Line / bar type and color(s) | setLineColor() | lineType, lineColor, lineAboveCol, lineBelowCol | | Fill color between reference line and sparkline | setFill() | fillType, fillCol, fillAboveCol, fillBelowCol | | Reference line type | setReferenceLine() | refLineType, refLineYPos | | Reference line width | setReferenceLineWidth() | refLineWidth | | Reference line color | setReferenceLineColor() | refLineColor |
| Endpoint marker color and radius | setEndpoint() | endpointCol, endpointRadius | | Set lower bound limit | setLowerBound() | lowerBound | | Set upper bound limit | setUpperBound() | upperBound | | Cap values on lower bound | setCap() | capBelow | | Cap values on upper bound | setCap() | capAbove | | Set data | setDataPointNum(), addDatapoint(), setData() | data |