gillius / jfxutils Goto Github PK
View Code? Open in Web Editor NEWJavaFX Utilities - Zoom and Pan Charts and Pane Scaling
License: Apache License 2.0
JavaFX Utilities - Zoom and Pan Charts and Pane Scaling
License: Apache License 2.0
Using a LineChart with a String in either x or y axis will cause the ChartZoomManager to break.
Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: javafx.scene.chart.CategoryAxis cannot be cast to javafx.scene.chart.ValueAxis
at org.gillius.jfxutils.chart.ChartZoomManager.(ChartZoomManager.java:137)
Hi,
My application can zoom when primary mouse key is pressed, dragged right side of the screen and released and it draws a rectangle to show the area it'll zoom.
But whenever I try to do this from right to lleft, nothing happens.
What may be the cause?
Edit: Checked the demo for jfxutils, it has the same issue. How can I fix this?
Hi,
I'm trying to get a column on the left side which changes accordingly to chart's zoom etc. I know there's already a grey background and white background changing with data but is there a way to get the coordinates so I can implement labels which will resize with them?
Currently my program works like lets say:
---- are the grey background part where chart does automatically
A,1
A,2
A,3
B,1-------------------
B,2-------------------
B,3-------------------
C,1
C,2
C,3
C,4
C,5
but I want to show them as:
1
A 2
___ 3
1-------------------
B 2-------------------
___ 3-------------------
1
2
C 3
4
___ 5
How can I see where the chart does this background painting and is there another easy way to do this that comes to your mind?
Hello, I wondering myself, how it was possible to intercept the zoom utilisation (wheel mouse or by using the rectangle) because after the new layout, I need to update my labels' positions. So initially I put a listener on the yAxis upper bound, but it generates some display issues. If you have any idea?
Anyway thank you a lot for this great library.
Thomas
Requested by @gforman44:
Allow disabling panning on a certain axis.
Requested by @gforman44 with some suggested code:
/** Add double-click for auto-ranging. If user double-clicks the x-axis, only that axis will be reset. Likewise for y-axis
*/
public static void addDoubleClickAutoRange(final ScatterChart<?, ?> sc) {
sc.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getClickCount() == 2) {
resetRange(sc, ev);
ev.consume();
}
});
}
/** Reset AutoRanging for one or both axes, depending on where user clicked.
* x-axis only? y-axis only? chart --> both.
*/
public static void resetRange(final ScatterChart<?, ?> sc, MouseEvent ev) {
XYChartInfo i = new XYChartInfo(sc);
if (!i.getXAxisArea().contains(ev.getX(), ev.getY())) sc.getYAxis().setAutoRanging(true);
if (!i.getYAxisArea().contains(ev.getX(), ev.getY())) sc.getXAxis().setAutoRanging(true);
}
I will add similar functionality but use XYChart type and anonymous classes instead of Lambdas since jfxutils supports Java 7. Thanks for the code suggestions @gforman44!
This may be a real newbie question, but...
I want to use Scene Builder to create the .fxml files.
The Charting.fxml sample file contains the line ...
<?import org.gillius.jfxutils.chart.StableTicksAxis?>
and the lines ...
<xAxis>
<StableTicksAxis animated="true" side="BOTTOM" />
</xAxis>
<yAxis>
<StableTicksAxis animated="true" side="LEFT" />
</yAxis>
As a result, Scene Builder will not open the Charting.fxml
file.
What can I do about this?
Hi,
I've around 6 area objects which has around 30 points each and they're all connected. I'm using linechart and if someone chooses 3 areas starting from A1 to A3, chart should be responsible for 90 records.
Now the problem is, I've order for every object and they come to chart accordingly but for some reason 5 records of record A3 are shown at the bottom. So Y axis is like,
A1
A2
A3
A5
A6
A3
And when I try to restrict it to get a better view, lets say from A2 to A4, it gives the exception that delta must be positive
I believe problem maybe because of the number of records. If I try the same thing with lets say 10 records per area, it works pretty good. But when they're 30, I've this problem
So far ChartPanManager and JFXChartUtil accept only MouseEvents. Any plans to support GestureEvents as well? I'd like to pan with two-finger drag and zoom with pinches.
I am using the example code taken from below url,
@FXML
void addSample() {
series.getData().add( new XYChart.Data<Number, Number>( System.currentTimeMillis() - startTime,
valueSlider.getValue() ) );
}
It works like a charm and no issues . but if i change from the above snippet
System.currentTimeMillis() **-** startTime
to System.currentTimeMillis() **+** startTime
. The x-axis dates get all messed up and chart didnt plot correctly.
In addSample
method i added a sysout,
//format is HH:mm:ss
System.out.println("X is : " + format.format(System.currentTimeMillis() + startTime) + " : " + "Y is : " + valueSlider.getValue());
and the displayed value is : X is : 23:11:39 : Y is : 65.96194503171247
and so on.. The Y value is displayed properly.
Hello Gillius,
I would like to create the charte into a VBox without using an fxml file. Is it possible ?
Thank you for your help
Is that possible to dynamically select points in a chart in order to edit or remove it ?
If not, do you know any other Java plot library that can handle this ? (using JavaFX preferably)
Thanks
hi in my project, i need to only zoom x axis, but not y axis.
its possible?
Hey, according to the content of the file, maybe the file should be renamed AxisTickLabelFormatter.java ?
What do you think ?
Unable to utilize maven repository because http://www.gillius.org/maven2 is forbidden.
Requested by @gforman44:
When pan dragging in the axis area, hold the other axis fixed. Right now, there's no way to drag one axis only.
I extended the fxutils in my own application so that a double click would restore the original zooming (turn it all off).
To do this I needed a MOUSE_CLICKED handler for the ChartZoomManager for the rectangle.
Unfortunately the eventHandler is private so I could not merely subclass and add it in.
ChartZoomManager needs:
handlerManager.addEventHandler( false, MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
@Override
public void handle( MouseEvent mouseEvent ) {
//Don't check filter here, we're either already started, or not
onMouseClick(mouseEvent);
}
} );
or the eventHandler needs to be made protected (or other options).
Contributed by @gforman44, code for draggable tabs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.