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

cojasclib

v0.3.2

Published

COmmon JAvascript Standard for Charting LIbraries

Downloads

43

Readme

COJASCLIB

COmmon JAvascript Standard for Charting LIBraries

Note: This package is in active development and therefore should not be used until further notice

Introduction

With the increasing number of javascript libraries for data visualization, and the benefits and flaws of each of them, programmers are often obliged to use several libraries for the same project. These heterogeneity adds unnecessary complexity to the code and can lead to problems. We developped this package as an intent to define a standard for data visualization with a system of pluggable adaptors for external libraries.

Quick start:

npm install cojasclib --save

let Cojasclib = require('cojasclib')

let chart = new Cojasclib.Chart(graphOptions)
let serie = new Cojasclib.Serie({ name: 'serie name', options: serieOptions)

serie.setDataPoint({ x: '', y: '', label: '', options: {} })

chart.setSerie(serie)
chart.render("chartjs", renderingOptions).then(res => {
  this.renderChart(res[0], res[1]);
)

chart Object

setSerie(): Adds serie to final chart object. can be done several time for multi-series

Note: Sort can be set at chartSerie or at chartObject at rendering

  • renderingOptions:
    • sort: true is sorted, false not
    • order: defaults to numeric sort
      • 'array': sort according to the array
      • 'date': date sorted
      • 'alpha': alpha sorted
      • typeof function: The function is passed directly to the lodash function "orderBy"
    • direction: 'ASC' or 'DESC'. Defaults to 'ASC'
    • noConsolidation: true, skips consolidation (only for multiple series). Consolidation populates with empty values the points that are set in one serie and not in another
    • missingPointOptions: In case of consolidation, the options that are used for the created points
    • sortOrdinates: if true, sorts by ordinate (y values)
    • yLabels: Array of labels that defines the order they have to appear. For example: ["fruits", "Vegetables", "Meat"]
    • labelFunction: String modifier function applied to x Labels before displaying. Ex: labelFunction: label => { return label.split("-")[1]; }
    • lengthXMax: INTEGER Max Number of character for splitting x labels, splitting is done on spaces

chart serie object:

  • name: name of the serie. Appears as serie legend
  • opts:
    • sort: true is sorted, false not
    • order: defaults to numeric sort
      • 'array': sort according to the array
      • 'date': date sorted
      • 'alpha': alpha sorted
      • typeof function: The function is passed directly to the lodash function "orderBy"
    • direction: 'ASC' or 'DESC'. Defaults to 'ASC'
    • fillNullDateValues: if a date are missing in the serie, replaces it with the point {label: date, x: date, y: 0}
    • dateFormat: defines the output of the label if it is moment object. see Moment formatting
    • cumulative: adds each value of serie to previous one
    • grouped: if 2 points have the same label, they are cumulated.
    • limitedPoints: Allow to limit the number of points and define a point with "name" as label and the sum of remaining points y as value
  options {
      ...
    limitedPoints = {
        max: x,
        name: 'Others',
    }
    ...
  }
  ;

Data point

  • x: the absciss value
  • label: the x label (defaults to x)
  • y: the ordinate value (defaults to label)
  • z: the z coordinate for a 3d point (defaults to none)
  • options:
    • color: Set this to change a single point color (color: "#C7E84D")

Available plugins

  • chartist
  • chartjs
  • chartcsv

Plugin Development

The idea is that the same settings will work with any Library

TODO

Common Options:

| Option | Type | Description | | ---------------- | ------ | ------------------------------------------------------ | | defaultFontColor | string | Defines font color for all graph text | | legendDisplay | Bool | Wether legend should be displayed | | xDisplay | Bool | If xaxis legends, ticks and labels should be displayed | | yDisplay | Bool | If yaxis legends, ticks and labels should be displayed | | xDisplayGrid | Bool | If xaxis grid should be displayed | | yDisplayGrid | Bool | If yaxis grid should be displayed |

TODO