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

perfect-timeseries-chart

v0.0.5

Published

Perfect Timeseries Chart

Downloads

4

Readme

The Perfect Timeseries Chart

I have some observability data over time and I want to look at it in a stacked bar chart as part of a dashboard, but I don't want to learn the intricacies of some big graphing library or incorporate some fancy solution like Kibana or Grafana.

I just want to send the data into a component and have it visualized right without hassle.

I don't want everything and the kitchen sink, I just want a single perfect timeseries chart component.

import React from "react"
import { TimeSeriesChart } from "perfect-timeseries-chart"

const hour = 1000 * 60 * 60
const data = [
  {
    time: Date.now(),
    counts: { red: 5, blue: 8, green: 12 },
  },
  {
    time: Date.now() - 1 * hour,
    counts: { red: 1, blue: 2, bleu: 2, green: 3 },
  },
  {
    time: Date.now() - 2 * hour,
    counts: { green: 0, red: 8, blue: 5, bleu: 2 },
  },
  {
    time: Date.now() - 3 * hour,
    counts: { red: 8, blue: 4, green: 0 },
  },
]
export default function MyDashboard() {
  return <TimeSeriesChart data={data} />
}

Features

  • data is the only required input.
  • To change the time interval displayed, use the start and end props (they will accept either a Date or epoch timestamp in ms).
  • Coloring is hash-based and deterministic - the same content will be displayed with the same color every time, without any need to store a palette. You can override specific hash-generated colors if needed.
  • Stacked bar chart by default, but there are a few other display options: Line graph, Stacked Area, and Heatmap for histograms over time. To switch between them, use the displayMode prop.