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

@meniga/charts

v6.1.36-alpha.0

Published

A Meniga-branded chart library that uses recharts

Downloads

653

Readme

@meniga/charts

This package is a Meniga-branded wrapper for recharts. Documentation and examples for recharts can be found here: https://recharts.org/en-US/api.

Getting started

Area chart

import { AreasChart } from '@meniga/charts'
<AreasChart
    values={ [
        { id: 1, amount1: 120, amount2: 20, amount3: 210 }
        { id: 2, amount1: 140, amount2: 60, amount3: 230 }
        { id: 3, amount1: 20, amount2: 10, amount3: 110 }
    ]}
    areas={ [{ key: 'amount1' }, { key: 'amount2' }, { key: 'amount3' }] }
    xAxis={ [{ key: 'id', type: 'number', domain: ['dataMin', 'dataMax'] }] }
    yAxis={ [{ type: 'number', domain: ['auto', 'auto'] }] }
    colors={ ['#FF0000', '#00FF00', '#0000FF'] }
    areaOpacity={ 0.2 } />

In the above example we send in all the relevant values, then define which keys we want to create areas from. We specify that we want one x-axis for the id, and one y-axis. For an area chart to know which colors the different areas should be in we also need to provide a list of colors (in which the first color will be used for the first area). We can also change the opacity of the area fill color.

Bar chart

import { BarsChart } from '@meniga/charts'
<BarsChart
    values={ [
        { id: 1, amount1: 120, amount2: 20 }
        { id: 2, amount1: 140, amount2: 60 }
        { id: 3, amount1: 20, amount2: 10 }
    ]}
    xAxis={ [{ key: 'id', type: 'number', domain: ['dataMin', 'dataMax'] }] }
    yAxis={ [{ type: 'number', domain: ['auto', 'auto'] }] }
    bars={ [{ key: 'amount1' }, { key: 'amount2', isPrediction: true }] } />

In the above example we send in all the relevant values, then define which keys we want to create bars from. We specify that we want one x-axis for the id, and one y-axis. To display the bar with the predefined look designed for predictions, pass isPrediction: true

Line chart

import { LinesChart } from '@meniga/charts'
<LinesChart
    values={ [
        { id: 1, amount1: 120, amount2: 20 }
        { id: 2, amount1: 140, amount2: 60 }
        { id: 3, amount1: 20, amount2: 10 }
    ]}
    xAxis={ [{ key: 'id', type: 'number', domain: ['dataMin', 'dataMax'] }] }
    yAxis={ [{ type: 'number', domain: ['auto', 'auto'] }] }
    lines={ [{ key: 'amount1' }, { key: 'amount2', isPrediction: true }] } />

In the above example we send in all the relevant values, then define which keys we want to create lines from. We specify that we want one x-axis for the id, and one y-axis. To display the line with the predefined look designed for predictions, pass isPrediction: true

Combined chart

import { CombinedChart } from '@meniga/charts'
<CombinedChart
    values={ [
        { id: 1, amount1: 120, amount2: 20, amount3: 210 }
        { id: 2, amount1: 140, amount2: 60, amount3: 230 }
        { id: 3, amount1: 20, amount2: 10, amount3: 110 }
    ]}
    xAxis={ [{ key: 'id', type: 'number', domain: ['dataMin', 'dataMax'] }] }
    yAxis={ [{ type: 'number', domain: ['auto', 'auto'] }] }
    lines={ [{ key: 'amount1' }, { key: 'amount2', isPrediction: true }] }
    bars={ [{ key: 'amount3' }] } />

If you want to create a chart with a combination of the different types, CombinedChart should be used. It's created like the other charts, then add lines/bars/areas lists depending on which types you want included.

Meniga-Charts support three four main chart types:

  • AreasChart
  • BarsChart
  • LinesChart
  • CombinedChart (Which can show areas, bars and lines in one)

The chart containers can differ in how they display the content, for example hovering data in a bars chart will select the whole area while hovering data in a lines chart will select the dot on the line.

Utils

amountTickFormatter

Helper to format to amounts in chart.