GithubHelp home page GithubHelp logo

tombor / statsbreaks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from riatelab/statsbreaks

0.0 0.0 0.0 511 KB

A javascript package to group the values of a statistical series into classes (discretization)

License: MIT License

JavaScript 100.00%

statsbreaks's Introduction

statsbreaks is a javascript package whose objective is to split (to classify/to discretize) a quantitative data set into a (k) number of classes or thematic categories. The general aim is to create a choropleth map, for example with bertin.js.

logo

npm jsdeliver license code size

statsbreaks is javascript package to make data classification for choropleth maps.

1. Installation

In browser

Last version

<script src="https://cdn.jsdelivr.net/npm/statsbreaks" charset="utf-8"></script>

Pinned version

<script src="https://cdn.jsdelivr.net/npm/[email protected]" charset="utf-8"></script>

In Observable

Last version

stat = require("statsbreaks")

Pinned version

stat = require("[email protected]")

breaks

The shape function allows to compute breaks according to several discretization methods. Source

Code
stat.breaks({ values: data, method: "jenks", nb: 5, precision: 0 })
Parameters
  • values: an array of quantitative values
  • method: method of discretization. "quantile", "q6", "equal", "jenks" or "geometric".
  • nb: number of classes
  • precision : rounding. 2 transform 35667.877876 to 35667.87 -2 transform 35667.877876 to 35600.

shape

The shape function allows to draw the shape of the data. This step is important to choose the right discretization method. Source

Code
stat.shape(data, precision, marks, log)
Parameters
  • data: an array of quantitative values
  • precision: a number. Curve accuracy (default:25)
  • marks: a boolean (default true)
  • log : a boolean. transforms into a logarithm (default: false)

view

The view function allows to visualize the result of a discretization. Source

Code
stat.view(breaks, colors, data)
Parameters
  • breaks: an array of n breaks
  • colors: an array of n-1 colors (optional)
  • data : the input data set to display ticks (optional)

statsbreaks's People

Contributors

fbahoken avatar mthh avatar neocarto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.