Macca Blog

My life experiences with code and design

JFXGraph… graphing with JavaFX

Posted on by Mark

Firstly, happy new year! This is my first post for 2009, and so far the new year has been going great!

So strait into the good stuff…

As you may have seen in a previous post of mine a bar graph type of application that demonstrated the integration of Java with JavaFX.

I decided to further develop the graphing application to be far more robust.

Introducing JFXGraph the bar graphing application that makes graphing data easy (well that’s the idea).

Its really a very simple application, made up of a few classes and some CSS files.

Firstly, here is a few screen shots of the application running:

There are a few features here:

  • Columns may be added dynamically
  • Automatic height adjustment of the Y-axis when new columns added (if required)
  • Smooth growing animation of bars
  • Y-axis lines extending from the bar to the Y-axis (onmouseover each bar) for ease of view
  • Entire graph is draggable via mouse

The swing button, “Add New Column” in the top left corner is just a helper button that adds a new column (up to 5 in total) to the graph so the user can see how it looks when new data is added.

The code is quite simple, there are only 2 classes that this application uses:
BarGraph, and BarGraphColumn. They are pretty self explanatory, and the code can be made available upon request (just shoot me an email…).

Below is a JNLP launcher that will allow you to see it running in its current state (I change it around a fair bit as I think of new features, bugs, etc…)

This entry was posted in Graphing, Java, JavaFX, JFXGraph. Bookmark the permalink.

4 Responses to JFXGraph… graphing with JavaFX

  1. Balu

    Hi,

    Could you please provide me with the code for the following classes, BarGraph and BarGraphColumn ?

    Request you to mail me the same to balaraju16@gmail.com

  2. Mark

    Hi Balu, I have just send you the code, enjoy…

  3. Raj

    Hi,

    Could you please provide me with the code for the following classes, BarGraph and BarGraphColumn ?

    Please can you mail me the same to rvrpatlolla14@gmail.com

  4. Mark

    Hi Raj, I will also send you an email regarding this, but for the sake of other readers, I would recommend that you upgrade your JavaFX runtime to 1.2 and use the Sun Charting API that they released.

    They beat me to the punch, but I had a lot of fun in the process…

    Im sure their graphs are a bit more robust too!

Leave a Comment

Your email address will not be published. Required fields are marked *


*