Kubed - A port of the popular Javascript library D3.js to Kotlin/JavaFX.

Overview

Kubed: A Kotlin DSL for data visualization

Kubed is a data visualization DSL embedded within the Kotlin programming language. Kubed facilitates the creation of interactive visualizations through data-driven transformations of the JavaFX scenegraph. With Kubed, developers can construct complex data visualizations through the composition of geometric primitives, such as rectangles, lines and text, whose visual properties are defined by functions over the underlying data.

Kubed is heavily inspired by D3.js, and supports many of the features found in D3, including: selections, transitions, scales, colorspaces, easing, and interpolators. Additional features coming soon!

Example

Below is an example of the Kubed DSL; a simple bar chart is constructed.

val values = listOf(4.0, 8.0, 15.0, 16.0, 23.0, 28.0)

val width = 420.0
val barHeight = 20.0

val x = scaleLinear<Double> {
    domain(0.0, values.max!!)
    range(0.0, width)
}

val chart = Group()

val rect = rect<Double> {
    width { d, _ -> x(d) } height(barHeight - 1)
    translateY { _, i, _ -> i * barHeight}
}

chart.selectAll<Double>()
     .data(values)
     .enter()
     .append { d, i, _ -> rect(d, i) }

This is an experimental API and is subject to breaking changes until a first major release.


Documentation

  • Selection
  • Transitions
  • Scales
  • Colorspaces
  • Easing
  • Interpolators
  • Chord Diagrams

Roadmap

Upcoming Features

Miscellanous

  • Adopting Kotlin-style builders rather than call chaining throughout the entire API.
  • Rework of the entire transition system.
Comments
  • having trouble compiling the project

    having trouble compiling the project

    I'm getting this error when building the project

    $ gradle
    --------
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file '/Users/chris/Development/buffer/kubed/kubed-contour/build.gradle' line: 15
    
    * What went wrong:
    A problem occurred evaluating project ':kubed-contour'.
    > Could not find method sourcesJar() for arguments [build_b808absl75l1m7uhb220r46ft$_run_closure1$_closure6$_closure7$_closure8@b8b1f9d] on object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    opened by zcaudate 4
  • Any plans to use typealiases where it makes sense?

    Any plans to use typealiases where it makes sense?

    For example: (Double) -> Double could be either interpolator or deinterpolator. There is no way to quickly tell, other than carefully following the code.

    Same for: fun deinterpolateClamp(deinterpolate: (Double, Double) -> (Double) -> Double): (Double, Double) -> (Double) -> Double { - doesn't show intent very well.

    With the help of some typealiases, we can type less, but more importantly, clearly show the intent. For example:

    // The names for aliases themselves can be different.
    // Perhaps, you can make them more concise while remaining descriptive.
    typealias Interpolator<T> = (Double) -> T
    typealias Deinterpolator<T> = (T) -> Double
    
    typealias InterpolatorFactory<T> = (T, T) -> Interpolator<T>
    typealias DeinterpolatorFactory<T> = (T, T) -> Deinterpolator<T>
    
    typealias PiecewiseInterpolatorFactory<T> = (List<Double>, List<T>, DeinterpolatorFactory<Double>, InterpolatorFactory<T>) -> Interpolator<T>
    typealias PiecewiseDeinterpolatorFactory<T> = (List<T>, List<Double>, DeinterpolatorFactory<T>, InterpolatorFactory<Double>) -> Deinterpolator<T>
    

    Then

    fun deinterpolateClamp(deinterpolate: (Double, Double) -> (Double) -> Double): (Double, Double) -> (Double) -> Double {
    

    can become

    /**
     * Converts the given deinterpolator factory to a clamping one:
     * t returned by factory produced deinterpolators is guaranteed to be in [0, 1].
     */
    protected fun clampDeinterpolatorFactory(deinterpolatorOf: DeinterpolatorFactory<Double>): DeinterpolatorFactory<Double>
    
    opened by yay 3
  • Issues executing the project

    Issues executing the project

    Hello, I find the project interesting. I don't have Kotlin experience. I did git pull and tried to open the project in Intelij, it was complaining that JavaFx is missing. I added in kubed-demos build.gradle this: compile "org.openjfx:javafx-base:13:win" // ALL THIS ARE JAVAFX LIBRARIES compile "org.openjfx:javafx-graphics:13:win" compile "org.openjfx:javafx-controls:13:win" compile "org.openjfx:javafx-web:13:win" compile "org.openjfx:javafx-swing:13:win" compile "org.openjfx:javafx-media:13:win" compile 'no.tornado:tornadofx:1.7.15'

    But then still the error in the image are shown. What i did wrong ?

    image

    opened by dprutean 2
  • Linear scale 'invert' method doesn't work

    Linear scale 'invert' method doesn't work

    fun main(args: Array<String>) {
        val scale = scaleLinear<Double>().domain(-100.0, 100.0).range(0.0, 100.0)
        println(scale(0.0))
        println(scale.invert(50.0)) // is this really supposed to throw?
    }
    
    opened by yay 1
  • Mercator:reclip is setting the clipExtent incorrectly

    Mercator:reclip is setting the clipExtent incorrectly

    Mercator:reclip is not setting the clipExtent correctly when no clipExtent has been provided.

    For example the following produces a clipExtent of [-480.5, -480.5, 961.0, 961.0]:

    val projection = mercator {
        scale = (width - 3) / (2 * PI)
        translateX = width / 2
        translateY = height / 2
        precision = 0.1
    }
    
    opened by hudsonb 1
  • Performance improvements

    Performance improvements

    Hi,

    I'm looking at this now and I'm quite impressed, nice work there! But one thing that concerned me when profiling the CirclesDemo is how much time is spent null checking and getting the datum:

    screen shot 2018-02-26 at 15 12 34

    In this example 38% of all CPU time is spent in these two methods.

    Property lookup in a HashMap is bound to be slow:

    internal const val DATA_PROPERTY: String = "__data__"
    
    /**
     * The datum associated with this Node, or Selection.UNDEFINED if there is none.
     */
    var Node.datum: Any?
        get() = properties[DATA_PROPERTY]
        set(value) { properties[DATA_PROPERTY] = value }
    

    I don't have any good ideas as to how this can be improved yet, just observations.

    opened by yay 3
  • Create demo application

    Create demo application

    Currently, the kubed-demos project contains a number of demonstrations but they require that they be compiled and then run individually.

    Kubed should provide a demo application that can be downloaded and launched, similar to the ControlsFX sampler application.

    opened by hudsonb 0
Owner
Brian Hudson
Brian Hudson
Lightweight JavaFX Framework for Kotlin

TornadoFX JavaFX Framework for Kotlin Important: TornadoFX is not yet compatible with Java 9/10 Oracle is intending to decouple JavaFX from the JDK. W

Edvin Syse 3.6k Dec 29, 2022
An attempt to port CSGO's Skeet.cc GUI into minecraft

------------------------------------------- Source installation information for modders ------------------------------------------- This code follows

3tnt 29 Dec 30, 2022
Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.

FXTrayIcon Library intended for use in JavaFX applications that makes adding a System Tray icon easier. The FXTrayIcon class handles all the messy AWT

Dustin Redmond 248 Dec 30, 2022
Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile Intention Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE and provides the functionalities to use and handle easily Tile

Peter Rogge 13 Apr 13, 2022
DataFX - is a JavaFX frameworks that provides additional features to create MVC based applications in JavaFX by providing routing and a context for CDI.

What you’ve stumbled upon here is a project that intends to make retrieving, massaging, populating, viewing, and editing data in JavaFX UI controls ea

Guigarage 110 Dec 29, 2022
组件化、极简依赖、模块单独运行、mvvm、kotlin、koin、jetpack(livedata、viewmodel、lifecycle、viewbinding、...)、buildsrc、coroutines

相关内容 组件化、支持模块单独运行 androidx mvvm kotlin koin jetpack(livedata、viewmodel、lifecycle、viewbinding、...) buildsrc coroutines liveeventbus ... 项目用到的依赖库 APK下载体

panyy 51 Jan 3, 2023
An advanced book explorer/catalog application written in Java and Kotlin.

Boomega An advanced book explorer/catalog application written in Java and Kotlin. ✨ Features Cross-platform Dark/Light theme, modern UI Multiple UI la

Daniel Gyoerffy 54 Nov 10, 2022
A library of +70 ready-to-use animations for JavaFX

AnimateFX A library of ready-to-use animations for JavaFX Features: Custom animations Custom interpolators Play/Stop animation Play an animation after

Loïc Sculier 366 Jan 5, 2023
A JavaFX library that allows Java2D code (Graphics2D) to be used to draw to a Canvas node.

FXGraphics2D Version 2.1, 3 October 2020. Overview FXGraphics2D is a free implementation of Java's Graphics2D API that targets the JavaFX Canvas. It m

David Gilbert 184 Dec 31, 2022
A library for JavaFX that gives you the ability to show progress on the Windows taskbar.

A clean and easy way to implement this amazing native Windows taskbar-progressbar functionality in javaFX Background Since Windows 7 there is a taskba

Daniel Gyoerffy 77 Nov 28, 2022
A JavaFX 3D Visualization and Component Library

FXyz3D FXyz3D Core: FXyz3D Client: FXyz3D Importers: A JavaFX 3D Visualization and Component Library How to build The project is managed by gradle. To

null 16 Aug 23, 2020
A library for creating and editing graph-like diagrams in JavaFX.

Graph Editor A library for creating and editing graph-like diagrams in JavaFX. This project is a fork of tesis-dynaware/graph-editor 1.3.1, which is n

Steffen 125 Jan 1, 2023
A 3D chart library for Java applications (JavaFX, Swing or server-side).

Orson Charts (C)opyright 2013-2020, by Object Refinery Limited. All rights reserved. Version 2.0, 15 March 2020. Overview Orson Charts is a 3D chart l

David Gilbert 96 Sep 27, 2022
A JavaFX library containing tiles that can be used for dashboards.

TilesFX A JavaFX library containing tiles for Dashboards. Donations are welcome at Paypal Intro The Tile is a simple JavaFX Control that comes with di

Gerrit Grunwald 1.3k Dec 30, 2022
Flow Visualization Library for JavaFX and VRL-Studio

VWorkflows Interactive flow/graph visualization for building domain specific visual programming environments. Provides UI bindings for JavaFX. See htt

Michael Hoffer 274 Dec 29, 2022
A Javafx Library for building MVC Applications.

A JavaFx Library For Making MVC Type Desktop Applications Installation requires Java jdk > 7 for windows requres openjdk-7 or 8 and openjfx for linux

Obi Uchenna David 38 Apr 30, 2022
RXControls is a JavaFX custom component library.

RXControls RXControls Version 8.x.y need javafx8 RXControls Version 11.x.y need javafx11+ 一个javafx的自定义组件库, 密码可见组件, 轮播图组件, 动态按钮组件等, 音频频谱可视化组件,歌词组件 等...

null 164 Jan 1, 2023
A JavaFX library that contains different kind of charts

Charts A library for scientific charts in JavaFX. This is still a work in development, but here are some of the charts being worked on so far. The cha

Gerrit Grunwald 497 Jan 2, 2023
A 2D chart library for Java applications (JavaFX, Swing or server-side).

JFreeChart Version 2.0.0, not yet released. Overview JFreeChart is a comprehensive free chart library for the Java(tm) platform that can be used on th

David Gilbert 946 Jan 5, 2023