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

calliope-chart

v1.4.7

Published

data visualization

Downloads

21

Readme

Documentation Overview

Getting Started

Installation

Use npm/yarn to install the libraries

npm install calliope-chart

or

yarn add calliope-chart

Import calliope-chart

import {AutoVis} from "calliope-chart";

Usage

(1) Create a DOM element that the visualization will be attached to.

<div id="vis"></div>

(2) Then, build your visualization specification.

var yourSpec = {...}

(3) Finally, visualize the chart with the specification.

const autovis = new AutoVis();
autovis.container('#vis');
autovis.paragraph('#caption');
autovis.load(yourSpec);
autovis.generate();

Single Visualization Specification

{
    // Properties for data (Required)
    "data": {
        "url": ...,
        "schema": [...]
    },

    // Properties for fact (Required)
    "fact": {
        "type": ...,
        "subspace": [...],
        "measure": [...],
        "breakdown": [...],
        "focus": [...]
    },

    // Properties for chart (Optional)
    "chart": {
        "size": ...,
        "type": ...,
        "style": ...,
        "duration": ...,
        "caption": ...,
    }
}

Properties for data

1. Data from URL

| Property | Type | Description | | ---- | ---- | ---- | | url | String | Required. A string describing the data source.For example: {"url": "data/cars.csv"}| | schema | Object[] | An array of field objects. Default: [] |

2. Inline Data

| Property | Type | Description | | ---- | ---- | ---- | | values | Object[] | Required. The full data set, included inline.For example: {"values": [{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43}]}| | schema | Object[] | An array of field objects. Default: [] |

Properties for fact

| Property | Type | Description | | ---- | ---- | ---- | | type | String | Required. A string describing the fact type (one of "trend", "categorization", "value", "difference", "distribution", "proportion", "rank", "extreme", "outlier", and "association") | | subspace | Object[] | Subspace describes the data scope of the fact, which is defined by a set of data filters.Default: [] | | breakdown | Object[] | Breakdown is a set of temporal or categorical data fields based on which the data items in the subspace are further divided into groups. Default: according to the fact type.| | measure | Object[] | Measure is a set of numerical data fields based on which we can retrieve a data value or calculate a derived value, such as count, sum, avg, min, or max, by aggregating the subspace or each data group. Default: according to the fact type. | | focus | Object[] | Focus indicates a set of specific data items in the subspace that require attention. Default: according to the fact type. |

Properties for chart

| Property | Type | Description | | ---- | ---- | ---- | | size | String | A string describing the chart size (one of "small" (235x150), "middle" (360x200), "wide" (560x220), and "large" (640x640))Default: large | | type | String | A string describing the chart type (one of "verticalbarchart", "horizentalbarchart", "progresschart", "areachart", "bubblechart", "bubblemap", "donutchart", "filledmap", "linechart", "piechart", "scatterplot", "treemap", "textchart", "isotypebar", "isotypecluster", "isotypeproportion")Default: Automatic recommendation based on fact | | style | String | A string describing the chart style (one of "business", "comics", "pictograph", ...)Default: "business" | | duration | Number | Time duration for chart animationDefault: 0 (static chart)| | caption | String | A string describing the chartDefault: "" |

An Example

{
    "data": {
        "url": "url/carsales.csv",
        "schema": [
            {
                "field": "Sales",
                "type": "numerical"
            },
            {
                "field": "Brand",
                "type": "categorical"
            },
            {
                "field": "Category",
                "type": "categorical"
            }
        ]
    },
    "fact": {
        "type": "difference",
        "subspace": [
            {
                "field": "Brand",
                "value": "Hyundai"
            }
        ],
        "measure": [
            {
                "field": "Sales",
                "aggregate": "sum"
            }
        ],
        "breakdown": [
            {
                "field": "Category"
            }
        ],
        "focus": [
            {
                "field": "Category",
                "value": "SUV"
            },
            {
                "field": "Category",
                "value": "MPV"
            }
        ]
    },
    "chart": {
        "size": "large",
        "type": "verticalbarchart",
        "style": "business",
        "duration": 1000
    }
}