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

@stamen/offsetareachart

v0.2.0

Published

<img src='https://cloud.githubusercontent.com/assets/1127259/11770144/7433df16-a1ac-11e5-9226-d3d64e98142a.png'>

Downloads

4

Readme

OffsetAreaChart

A collection of stacked AreaCharts, drawn with a vertical offset between each. Each child AreaChart shares the same axes, so this component is useful for e.g. allowing comparisons between multiple datasets changing over the same period of time. This component can be styled with or without a fill/stroke, meaning it can display filled area charts or simply a series of line charts.

This component can also draw baselines for each embedded AreaChart that display the extent of each along the x-axis, and it can render dots on those baselines to indicate the presence of data at each discrete step on the x-axis. These features can be useful to indicate data that cannot be rendered as area charts, due to invalid or unformatted data.

Part of the @stamen/panorama toolkit.

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { AreaChart } from '@panorama/toolkit';

let offsetAreaChartConfig = {
  width: 600,
  height: 300,

  // optional; used to draw baselines and metadata presence circles
  data: offsetAreaChartData.offsetAreaChartMetadata,

  // d3 conventional margins
  margin: { top: 10, right: 10, bottom: 10, left: 10 },

  // Optionally specify custom scales
  xScale: d3.scale.linear()
    .domain([minTime, maxTime]),
  yScale: d3.scale.linear()
    .domain(minValue, maxValue])

  // accessor for start and end of baselines
  xAccessor: (d, i) => i ? d.endTime : d.startTime,

  // accessor for metadata presence circles
  metadataAccessor: d => d.metadataTimes,

  // hide axes
  axisProps: null,

  // data and accessors used to render each AreaChart
  areaChartData: offsetAreaChartData.areaChartsData,
  areaChartConfig: {
    xAccessor: d => d.time,
    yAccessor: d => d.value,
  },

  // colors applied to AreaCharts
  colorPalette: [
    '#466834',
    '#C163D5',
    '#D34E2B'
  ],

  // optionally specify an initially selected chart
  selectedChartId: 22,

  // id of each chart
  chartIdAccessor: d => d.length ? d[0].chartId : d.chartId
};

ReactDOM.render(<OffsetAreaChart {...offsetAreaChartConfig}/>, document.body);