Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

AreaChart, change the axis range

990250Feb 10 2013 — edited Feb 10 2013
Hello, I'm new to Java FX, and I'm having some issues with Charts.

I will detail what I have done to see if it makes sense to work this way or not.

1) I create a javaFX aplication
2) I create a GUI with JavaFx Scene Builder.
3) this GUI contains an AreaChartNxN
4) I have a routine computing a data vector of 8760 values, (I want to plot the data in ranges of 24, i.e. data[0..24] or data[24..48] etc...)


Problem:
When I load a Serie<X,Y> where X goes from i.e. 1024 to 1048, the X axis of the AreaChart still has its origin in Zero, making the plot unusable (the Data sees too small)

So I google for the answer, an I find that, once created, a Chart cannot modify its Axis bounds (WTF??!! seriously?)

All the documentation explains is to create a new AreaChart in a new scene, by doing this, the boundaries are ok but the data serie does not appear.

What I Want:
I Want my plot in my UI with the boundaries in range.
I think, what I should do is to create a new AreaChart object every time, and somehow load it into my javaFX GUI, but I don't know how to do this. in Swing I used to load Plots in JPanels but in javaFX I don't know how to do it.

This is what I have for now:


+public void addSerie(AreaChart ac, XYChart.Series serie, String title, String xlabel, String ylabel, int xmin, int xmax) {+

ac.getXAxis().setAutoRanging(true);
ac.setTitle(title);
ac.getData().add(serie);
ac.getXAxis().setLabel(xlabel);
ac.getYAxis().setLabel(ylabel);

+}+

Any advice would be appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2013
Added on Feb 10 2013
5 comments
1,299 views