Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@data2viz/d2v-voronoi

data2viz4Apache-2.00.8.17

Data2viz voronoi module

Kotlin, JavaScript, data2viz

readme

Data2viz

Build Status GitHub License

Isomorphic dataviz

Data2viz is a data visualization toolbox for Kotlin Multiplatform.

You can pick what you need in the different modules and use them independently in the following environments: Android, JavaScript(IR and Legacy), and JavaFX (iOs to come).

Your code produces the same results and rendering on each platform.

A lot of algorithms come from d3js modules.

core

This module exposes some basics elements like Circle, Rect, Path, and also some parts of DSL (percent, angles, etc.).

color

This module provides algorithms to create, modify, and convert colors through differents spaces (RGB, HCL, HSL, Lab). It also manage linear and radial color gradients. You can easily use it outside of data2viz.

shape

Algorithms to generate paths: symbols, curves, ...

scale

Different ways to convert data to sizes.

interpolate

Functions to perform interpolation of various elements (numbers, colors, points, curves)

random

Algorithms to generate random data.

axis

Helper module to create axis for charts, using scales.

delaunay

This module is a high performant algorithm to compute the Voronoi diagram. You should use it in many use cases to find the closest point of interest to the pointer position.

ease

This module contains a collection of easing functions to manage acceleration inside animations.

dsv

Minimal way of parsing CSV, TSV files using Kotlin.

force

Use physics to animate your visualizations.

format

Different ways of formating numbers and currencies.

time

Some multiplatform classes to manage time and dates in visualizations.

time-format

Extend formatting to time and dates.

quadtree

Separation of space through the quadtree algorithm.

voronoi

Fortune's algorithm implementation of the Voronoi diagram. You should probably use Delaunay instead.

geo

A collection of mechanisms and functions to project GeoJson elements (points, lines, polygons) on a screen using different implementations of projections.

hexbin

A useful way of aggregating data using hexagons. You can represent data through the fill color or the area.

sankey

A generator for sankey charts.

hierarchy

A generator for hierarchical charts.

tests

An internal module used to simplify multiplatform testing with a higher DSL.

timer

A multiplatform implementation to manage animations through shared frames.

viz

Multiplatorm API and implementation of rendering and events management.

Data2viz allows you to develop data visualizations through a fully typed DSL. It simplifies the creation of complex visualizations via the IDE’s context-based suggestions.

Where should I start?

Documentation

All data2viz documentation is located in a distinct documentation project. You should start there and follow the first JavaFX tutorial.

Data2viz Playground

You can also play with the API without installing anything. Data2viz playground is a website where you can browse existing sample, modify them online and immediately see the result.

Using in your projects

Note that the library is experimental, and the API is subject to change.

The library is published to data2viz space repository.

Gradle

  • Add the data2viz maven repository:
repositories {
    maven { url = uri("https://maven.pkg.jetbrains.space/data2viz/p/maven/public") }
}
  • In multiplatform projects, add a dependency to the commonMain source set dependencies

    kotlin {
      sourceSets {
          commonMain {
               dependencies {
                   implementation("io.data2viz.d2v:axis:0.8.14")
                   implementation("io.data2viz.d2v:chord:0.8.14")
                   implementation("io.data2viz.d2v:color:0.8.14")
                   implementation("io.data2viz.d2v:contour:0.8.14")
                   implementation("io.data2viz.d2v:delaunay:0.8.14")
                   implementation("io.data2viz.d2v:dsv:0.8.14")
                   implementation("io.data2viz.d2v:ease:0.8.14")
                   implementation("io.data2viz.d2v:force:0.8.14")
                   implementation("io.data2viz.d2v:format:0.8.14")
                   implementation("io.data2viz.d2v:geo:0.8.14")
                   implementation("io.data2viz.d2v:hexbin:0.8.14")
                   implementation("io.data2viz.d2v:hierarchy:0.8.14")
                   implementation("io.data2viz.d2v:quadtree:0.8.14")
                   implementation("io.data2viz.d2v:random:0.8.14")
                   implementation("io.data2viz.d2v:scale:0.8.14")
                   implementation("io.data2viz.d2v:shape:0.8.14")
                   implementation("io.data2viz.d2v:tile:0.8.14")
                   implementation("io.data2viz.d2v:time:0.8.14")
                   implementation("io.data2viz.d2v:timer:0.8.14")
                   implementation("io.data2viz.d2v:viz:0.8.14")
               }
          }
      }
    }
  • To use the library in a single-platform project, add a dependency to the dependencies block.

dependencies {
    implementation("io.data2viz.d2v:axis:0.8.14")
    implementation("io.data2viz.d2v:chord:0.8.14")
    implementation("io.data2viz.d2v:color:0.8.14")
    implementation("io.data2viz.d2v:contour:0.8.14")
    implementation("io.data2viz.d2v:delaunay:0.8.14")
    implementation("io.data2viz.d2v:dsv:0.8.14")
    implementation("io.data2viz.d2v:ease:0.8.14")
    implementation("io.data2viz.d2v:force:0.8.14")
    implementation("io.data2viz.d2v:format:0.8.14")
    implementation("io.data2viz.d2v:geo:0.8.14")
    implementation("io.data2viz.d2v:hexbin:0.8.14")
    implementation("io.data2viz.d2v:hierarchy:0.8.14")
    implementation("io.data2viz.d2v:quadtree:0.8.14")
    implementation("io.data2viz.d2v:random:0.8.14")
    implementation("io.data2viz.d2v:scale:0.8.14")
    implementation("io.data2viz.d2v:shape:0.8.14")
    implementation("io.data2viz.d2v:tile:0.8.14")
    implementation("io.data2viz.d2v:time:0.8.14")
    implementation("io.data2viz.d2v:timer:0.8.14")
    implementation("io.data2viz.d2v:viz:0.8.14")
}

Current status and roadmap

APIs are mostly stabilized now, but there may still be some breaking changes before v1.0.

Inspirations

  • d3js: a lot of modules and algorithms come from d3js.
  • paperjs: another source of inspiration for viz hierarchy and simple API.
  • chromajs: smart library for managing colors easily.
  • delaunator: a really fast JavaScript library for Delaunay triangulation of 2D points.
  • kotlinx.html: isomorphic html rendering.
  • kotlintest: nice DSL for testing (partly ported in test).

changelog

Version v0.8

This version brings multiplatform events to the library. It is now possible to add pointer events to a visualization and retrieve position during different events: move, click, double-click, ...

This version also includes some major internal modifications on the Geo module.

0.8.16

Published 15 Dec 2021

  • Introduce iOS version (with missing features, like gradient, geo)

0.8.15

Published 4 Oct 2021

  • Upgrade to Kotlin 1.5.31 and Kotlinx.datetime 0.3.0

0.8.14

Published 28 Sep 2021

  • Share the keys pressed during a KZoomEvent (#238)

0.8.13

Published 23 Jun 2021

  • Introduction of TouchEvent (currently only available on Android)
  • Fix VizView.onDraw not doing anything on Android.

0.8.12

Published 14 Apr 2021

  • fix publication script (missing artifact when using enableGranularSourceSetsMetadata)

0.8.11

Published 13 Apr 2021

  • core: add Rect.boundsWith(rotation) and Rect.overlap(rectangle) functions.
  • viz: introduce TextNode.measureText
  • viz: introduce VizContainer (#215)
  • deploy on Space instead of JCenter.

0.8.10

Published 27 Jan 2021

  • Time is now based on Instant rather than LocalDateTime, TimeZone is managed.
  • Time module is deprecated.
  • Added new number locales (es_BO, en_IE, en_IN, ...) and fix some issues with old ones
  • Added new time locales (fa_IR, nb_NO, zh_TW, ...) and fix some issues with old ones
  • fix #231 deprecate stroke and replace with strokeColor

0.8.9

Published 20 Nov 2020

  • Add experimental classes property on Node.

0.8.8

Published 21 Oct 2020

  • Add Scale.copy() see #229.

0.8.7

Published 14 Oct 2020

  • Remove ArrayList to fix #228.

0.8.6

Published 8 Oct 2020

  • Fix JfxGroupRenderer image rendering #227.

0.8.5

Published 30 Sep 2020

  • Introduce new Date Interpolator in the interpolate module

0.8.4

Published 23 Sep 2020

  • Add a image node to allow to draw images/icons #219

0.8.3

Published 16 Sep 2020

  • Fix runtime exception on Weekday #225

0.8.2

Published 10 Sep 2020

  • Reintroduce the date() and Date() constructors, mark them as deprecated (you should use LocalDateTime instead)

0.8.2-RC1

Published 10 Sep 2020

  • Use kotlinx.datetime instead of date from the time module
  • Use LocalDateTime for the TimeScale, the Interval and the whole time-format module

0.8.1

Published 28 Aug 2020

  • Kotlin 1.4 version

0.8.0

Published 27 Aug 2020

  • bug #216 fix an issue when a scale returned tick values outside of its range

0.8.0-RC12

Published 14 Jul 2020

  • Linear RGB interpolation now also interpolates alpha channel
  • bug #202 fix an issue in Stack when all series do not contains values for each category
  • bug #204 BandedScale padding and alignment now use Percent

0.8.0-RC11

Published 14 Jul 2020

  • bug #205: Zoom event position is wrong when canvas has css margins.
  • Fix an issue due to floating points in the ticks() function

0.8.0-RC10

Published 16 Jan 2020

  • android debug variant is now deployed
  • bug: #182
  • Date now implements Comparable<Date>
  • Give access to several properties of AxisElement like stroke color and width
  • Fix an issue due to floating points in the ticks() function
  • Improve ticks() on LogScales, now manage small domains and negative values

Breaking change: publish common code as -common artifact and metadata as artifact without suffix.

0.8.0-RC9

Published 30 Dec 2019

Breaking change: publish common code as -common artifact and metadata as artifact without suffix.

0.8.0-RC8

Published 30 Dec 2019

Breaking change: publish common code as -common artifact and metadata as artifact without suffix.

0.8.0-RC7

Published 18 Dec 2019

Breaking change: new package and artifact names for NPM publications.

0.8.0-RC6

Published 17 Dec 2019

Breaking change: Due to the use of the new MPP (and some constraints that come with it), data2viz artifacts are now deployed on jcenter (instead of maven central) using a new structure.

Ex: io.data2viz:d2v-core-js becomes io.data2viz.d2v:core-js

0.8.0-RC5

  • Breaking change: make distinction between mouse and touch events (#162)

0.8.0-RC4

Published 26 Nov 2019

  • Breaking change timeFormat module renamed in time-format (#164)

0.8.0-RC3

Published 12 Nov 2019

  • Fix KPointerEvent position inside browser when external CSS size applied (#160)

0.8.0-RC2

Published 05 Nov 2019

  • Add Copyright
  • Remove minimum distance for drag (#159)

0.8.0-RC1

Published 20 Sep 2019

  • Adding multiplatform events API
  • Implementation of all major geographic projections

Version v0.7 :

This major version brings support for Android. This addition of Android as a target platform had a big impact on the design of data2viz. Before v0.7 basic visual elements (rectangles, circles, ...) were wrappers on specific platform elements. Now, these elements are a memory version of the visualization. Elements are just rendered on each platform using canvas.