datalib

WebJar for datalib

License

License

BSD 3-Clause
Categories

Categories

Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

datalib
Last Version

Last Version

1.9.2
Release Date

Release Date

Type

Type

jar
Description

Description

datalib
WebJar for datalib
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/vega/datalib

Download datalib

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/datalib/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>datalib</artifactId>
    <version>1.9.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/datalib/
implementation 'org.webjars.npm:datalib:1.9.2'
// https://jarcasting.com/artifacts/org.webjars.npm/datalib/
implementation ("org.webjars.npm:datalib:1.9.2")
'org.webjars.npm:datalib:jar:1.9.2'
<dependency org="org.webjars.npm" name="datalib" rev="1.9.2">
  <artifact name="datalib" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='datalib', version='1.9.2')
)
libraryDependencies += "org.webjars.npm" % "datalib" % "1.9.2"
[org.webjars.npm/datalib "1.9.2"]

Dependencies

compile (7)

Group / Artifact Type Version
org.webjars.npm : topojson-client jar [3.0.0,4)
org.webjars.npm : d3-dsv jar [0.1,0.2)
org.webjars.npm : sync-request jar [6.0.0,7)
org.webjars.npm : d3-format jar [0.4,0.5)
org.webjars.npm : d3-time jar [0.1,0.2)
org.webjars.npm : d3-time-format jar [0.2,0.3)
org.webjars.npm : request jar [2.67.0,3)

Project Modules

There are no modules declared in this project.

datalib

Build Status npm version

Datalib is a JavaScript data utility library. It provides facilities for data loading, type inference, common statistics, and string templates. While datalib was created to power Vega and related projects, it is also a standalone library useful for data-driven JavaScript applications on both the client (web browser) and server (e.g., node.js).

For documentation, see the datalib API Reference.

Use

Datalib provides a set of utilities for working with data. These include:

  • Loading and parsing data files (JSON, TopoJSON, CSV, TSV).
  • Summary statistics (mean, deviation, median, correlation, histograms, etc).
  • Group-by aggregation queries, including streaming data support.
  • Data-driven string templates with expressive formatting filters.
  • Utilities for working with JavaScript functions, objects and arrays.

Datalib can be used both server-side and client-side. For use in node.js, simply npm install datalib or include datalib as a dependency in your package.json file. For use on the client, install datalib via bower install datalib or include datalib.min.js on your web page. The minified JS file is built using rollup (see below for details).

Example

// Load datalib.
var dl = require('datalib');

// Load and parse a CSV file. Datalib does type inference for you.
// The result is an array of JavaScript objects with named values.
// Parsed dates are stored as UNIX timestamp values.
var data = dl.csv('https://vega.github.io/datalib/data/stocks.csv');

// Show summary statistics for each column of the data table.
console.log(dl.format.summary(data));

// Compute mean and standard deviation by ticker symbol.
var rollup = dl.groupby('symbol')
  .summarize({'price': ['mean', 'stdev']})
  .execute(data);
console.log(dl.format.table(rollup));

// Compute correlation measures between price and date.
console.log(
  dl.cor(data, 'price', 'date'),      // Pearson product-moment correlation
  dl.cor.rank(data, 'price', 'date'), // Spearman rank correlation
  dl.cor.dist(data, 'price', 'date')  // Distance correlation
);

// Compute mutual information distance between years and binned price.
var bin_price = dl.$bin(data, 'price'); // returns binned price values
var year_date = dl.$year('date');       // returns year from date field
var counts = dl.groupby(year_date, bin_price).count().execute(data);
console.log(dl.mutual.dist(counts, 'bin_price', 'year_date', 'count'));

Build Process

To use datalib in the browser, you need to build the datalib.js and datalib.min.js files. We assume that you have npm installed.

  1. Run npm install in the datalib folder to install dependencies.
  2. Run npm run build. This will invoke rollup to bundle the source files into datalib.js, and then uglify-js to create the minified datalib.min.js.

Webpack 1

If you are using Webpack 1, you need to enable a JSON-loader. To do so, first npm install --save json-loader, then add the loader to your webpack config:

{
  module: {
    loaders: [{
      test: /\.json$/,
      loader: 'json-loader'
    }]
  }
}
org.webjars.npm

Vega

Data Visualization Languages & Tools

Versions

Version
1.9.2