Coder Social home page Coder Social logo

jfxutils's Introduction

jfxutils

JavaFX Utilities - Zoom and Pan Charts and Pane Scaling

License: Apache 2
Latest Release: 0.3
Development version: 0.4-SNAPSHOT

  • Add zooming functionality to a JavaFX XYChart:
    • Drag mouse in plot area to zoom both axes
    • Drag mouse on X axis to zoom that axis only
    • Drag moues on Y axis to zoom that axis only
    • (0.2) Mouse filter, for example allow only left click drag to zoom
    • (0.2) Animated zooming
    • (0.3) Mouse wheel zoom in plot area, X axis, or Y axis. This has NOT been tested with mice with "continuous" wheels, only ones that rotate in discrete steps/clicks.
  • (0.2) Panning ability for XYCharts
    • Mouse filtering, for example right click drag or ctrl+left click for panning
  • (0.2) StableTicksAxis provides the same tick locations for a zoom level, regardless of the lower and upper bounds. This provides a much smoother experience when panning and zooming.
    • (0.4) Ability to customize axis label formatting of StableTicksAxis
  • Ability to create a Pane that scales when it resizes instead of reflowing its layout, creating an effect like a presentation slide.
  • An experimental way to replace a Node in the scene graph with a different one (it's not as easy as you think)
  • A way to get X and Y offsets of a Node from an arbitrary ancestor in a way that handles translation/padding/layout, etc., but does not yet handle scale and rotations (this might be possible if transforms can be combined as rumored for JFX 8)

Bug Fixes in 0.4

  • By Daniel Weil: if the data range is very small, StableTicksAxis does not work well. So, if the range is less than 1e-300, range the axis as if min==max (which will show a straight line).

Getting

Maven - Latest Release

<repositories>
  <repository>
    <id>gillius-org</id>
    <name>Gillius.org Maven Repository</name>
    <url>http://www.gillius.org/maven2</url>
  </repository>
</repositories>

<dependency>
  <groupId>org.gillius</groupId>
  <artifactId>jfxutils</artifactId>
  <version>0.3</version>
</dependency>

javadoc and sources variants are also available. The development verison is 0.4-SNAPSHOT, if you want that version, replace the 0.3 with 0.4-SNAPSHOT. If you need an official 0.4 release, just ask and I'll do it.

Documentation

Screenshot

Here is a screenshot showing the example application in the jfxutils-example artifact. The first image shows the example using the new StableTicksAxis, which has better performance than the JavaFX NumberAxis when zooming and panning as the tick marks are fixed relative to the data values:

JFXUtils charting example using StableTicksAxis

Here is the charting application using the NumberAxis after zooming and panning, showing the awkward tick labels that result, as NumberAxis tick labels are fixed with the graph's graphical layout and not fixed relative to the data:

JFXUtils charting example using StableTicksAxis

Future Work

  • (Maybe) Default widget panel with buttons to switch between zooming and panning

Building

Since JavaFX is not included in the default classpath of applications, even if you have installed JavaFX SDK or are using a recent Java 7 with it bundled, compiling is awkward. When you compile if you get reference errors to javafx packages, copy the jfxrt.jar from your JDK's jre/lib directory to jre/lib/ext. This solution was proposed at https://github.com/zonski/javafx-maven-plugin/wiki/Fixing-the-JRE-classpath. You can also run the Maven command on that page to do the copy for you, but you must run as a user with permissions to copy files in the JDK (i.e. run as admin). Once this is done you can use Maven to build the library. Using the library as a dependency does not require this particular solution, as long as your own project is already building fine with JavaFX.

This workaround should not be necessary when JDK 8 is released.

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.