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

@sigmastocks/sigmastocks-react-components

v0.1.2

Published

Sigmastocks React Components

Downloads

3

Readme

Sigmastocks React Chart

This package contains 3 responsive charts used for building a frontend to sigmastocks:

  • DonutChart
  • RadarChart
  • HistoryChart

Dependencies:

  • chart.js (^2.7.2)
  • d3 (^5.4.0)
  • react-chartjs-2 (^2.7.2)
  • react (^16.3.2)

You probably have react installed so install the rest by running this command:

npm install d3 chart.js react-chartjs-2

How to use the charts:

DonutChart

The DonutChart expects a generated portfolio (either from make_portfolio or invest) as it's dataSet,

Colors and translations are both objects with gics sectors as key.

  import { DonutChart } from 'sigmastocks-react-components';

  Example Usage:

  <DonutChart
  dataSet={make_portfolio_response.data}
  colors={{
      "Energy": "#002776",
      "Materials": "#0071cd",
      "Industrials": "#002776",
      "Consumer Discretionary": "#002776",
      "Consumer Staples": "#0071cd",
      "Health Care": "#002776",
      "Financials": "#0071cd",
      "Information Technology":"#002776",
      "Telecommunication Services": "#0071cd",
      "Utilities": "#002776",
      "Real Estate": "#0071cd"
    }}
    translations={{
      "Energy": "Energy",
      "Materials": "Materials",
      "Industrials": "Industrials",
      "Consumer Discretionary": "Consumer Discretionary",
      "Consumer Staples": "Consumer Staples",
      "Health Care": "Health Care",
      "Financials": "Financials",
      "Information Technology": "Information Technology",
      "Telecommunication Services": "Telecommunication Services",
      "Utilities": "Utilities",
      "Real Estate": "Real Estate"
    }}
  />

RadarChart

The RadarChart can handle multiple RadarCharts on top of eachother.

The dataSet prop expects an array of radar chart responses. The colors prop expect an array of colors in hex code.

The translations prop need an object with all factors and their translations.

  import { RadarChart } from 'sigmastocks-react-components';

  Example Usage:

  <RadarChart
    dataSet={[radar_chart_response.data]}
    colors={["#002776"]}
    translations={{
      "BookToMkt":"BookToMkt",
      "CashFlowToAsset":"CashFlowToAsset",
      "CurMktCap":"CurMktCap",
      "DebtToMktCap":"DebtToMktCap",
      "DividendToPrice":"DividendToPrice",
      "EarningsToPrice":"EarningsToPrice",
      "Momentum24M":"Momentum24M",
      "NetProfitMargin":"NetProfitMargin",
      "ReciprocalPEG":"ReciprocalPEG"
    }}
  />

HistoryChart

The HistoryChart expects a backcast and forcast as dataSet. To show risk-chart set showRisk prop to true.

The backcastColor and indexcastColor props must be hex-code.

  import { HistoryChart } from 'sigmastocks-react-components';

  Example Usage:

  <HistoryChart
    dataSet={backcast_and_forecast_response.data}
    backcastColor={"#002776"}
    indexcastColor={"#0071cd"}
    showRisk={false}
    labels={
      {
        strategy: "Din aktieportfölj",
        index: "OMX SPX",
        xAxisLabel: "Värde (kr)"
      }
    }
  />

How to build, develop and publish

Build:

npm run build

Develop:

npm link

and then link the package to the demo app

cd ../sigmastocks-react-components-demo

npm link sigmastocks-react-components

Publish:

npm publish