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

stock-graphics

v1.1.18

Published

A small library for rendering stock charts

Downloads

33

Readme

Stock-Graphics

It is important to know that while this continues to be updated, it is currently not stable and definitely not ready for usage in any professional setting. As of now, the only functions are to zoom in and zoom out, and both are somewhat bugged. The package isn't tested, and shouldn't be expected to work perfectly.

 npm install stock-graphics

Then, import renderFull so that you can render the graph:

  import { renderFull } from "Stock-Graphics"

You must call this function with two parameters; points and graphicalEffects. These will be explained, but in short, simply call the function like so:

  renderFull(points, graphicalEffects);

In order to set points, write in the form

  points = [
    {x: "Date", y: 34.64}
    ]

And to change the way the graph looks, modify anything in the graphicalEffects object. The object is of the form:

const graphicalEffects = {
  graphHeight: 300, //Total height of the graph [set to "100" to set the graph height to the total height of the container div]
  graphWidth: 600,  //Total width of the graph [set to "100" to set the graph width to the total width of the container div]
  graphLeft: 0,  //Pixels to move to the left
  graphRight: 0,  //Pixels to move to the right
  positioning: "auto",  //Sets the margin-left and margin-right properties
  title: "Apple",   //Name of the stock you wish to render
  ticker: "AAPL",   //Ticker of the stock you wish to render
  fontSize: 14,   //Font size of the title and ticker
  backgroundColor: "white", //Color of the background of the graph. Currently not working
  lineWidth: 5,   //Width in pixels of the graph's lines
  boundaryWidth: 3, //Don't worry about this right now
  gainColor: "green", //Color the graph takes on when there is overall positive growth
  lossColor: "red",   //Color the graph takes on when tehre is overall negative growth
  fillColor: "red",   //Does not do anything. Will be removed.
  dateRangeActive: false,  //Controls whether or not the small date-range indicator at the bottom of the graph is permanently visible.
  graphFontSize: 16,  //Controls the text size of the leftmost vertical values.
  infoDivWidth: 100,  //The width of the small container that tells you the value when you hover over a part of the graph.
  buttonSize: { width: 50, height: 30 },  //Sets the width and height of the buttons
  buttonFontSize: 8,  //Sets the font-size of the buttons
  buttonFontColor: "white", //Sets the font-color of the buttons
  buttonColor: "blue", //Sets the background-color of the buttons
  buttonBorder: "1px solid red", //Sets the border of the buttons
  contentsDiv: "main", //IMPORTANT! This is the ID of the div in which you wish to render your graph
};

The best way to learn how to use this is simply to play around with it. As a quick example of a working set of point values, here is what I have currently running in my test build:

points = [
  { x: "07/01", y: 91.28 },
  { x: "07/02", y: 91.96 },
  { x: "07/03", y: 92.5 },
  { x: "07/04", y: 93.85 },
  { x: "07/05", y: 94.18 },
  { x: "07/06", y: 96.26 },
  { x: "07/07", y: 95.33 },
  { x: "07/08", y: 97.26 },
  { x: "07/09", y: 94.84 },
  { x: "07/10", y: 98.99 },
  { x: "07/11", y: 96.56 },
  { x: "07/12", y: 96.26 },
  { x: "07/13", y: 96.99 },
  { x: "07/14", y: 96.42 },
  { x: "07/15", y: 94.84 },
  { x: "07/16", y: 98.99 },
  { x: "07/17", y: 96.56 },
  { x: "07/18", y: 94.84 },
];

Cheers and have fun!