Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException seen when using LogAxis and clicking anywhere outside data plot area #8

Closed
chaddaniels opened this issue Jun 7, 2018 · 1 comment

Comments

@chaddaniels
Copy link

I ran into a scenario where clicking outside the data plot area (in the legend area, axis labels area, etc) while using a LogAxis can result in an IllegalArgumentException. After this occurs the chart is then essentially non-interactive and does not respond to user input such as drag to zoom.

Stack Trace:

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: A positive range length is required: Range[0.05449587578346141,0.05449587578346141]
	at org.jfree.chart.axis.ValueAxis.setRange(ValueAxis.java:1278)
	at org.jfree.chart.axis.ValueAxis.setRange(ValueAxis.java:1256)
	at org.jfree.chart.axis.LogAxis.zoomRange(LogAxis.java:953)
	at org.jfree.chart.plot.XYPlot.zoomDomainAxes(XYPlot.java:5119)
	at org.jfree.chart.fx.interaction.ZoomHandlerFX.handleMouseReleased(ZoomHandlerFX.java:234)
	at org.jfree.chart.fx.ChartCanvas.handleMouseReleased(ChartCanvas.java:648)
	at org.jfree.chart.fx.ChartCanvas.lambda$new$6(ChartCanvas.java:196)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:417)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
	at com.sun.glass.ui.View.notifyMouse(View.java:937)

Complete self contained example:

/**
 * Click in the axis label area to see IllegalArgumentException followed by erratic behavior
 */
public class IllegalArgumentBug extends Application
{
    public static void main(String[] args)
    {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage)
    {
        XYSeriesCollection primarySeriesCollection = new XYSeriesCollection();

        JFreeChart chart = ChartFactory.createXYLineChart(
            "",
            "",
            "",
            primarySeriesCollection,
            PlotOrientation.VERTICAL,
            true,
            false,
            false);

        XYPlot plot = chart.getXYPlot();
        plot.setDomainAxis(new LogAxis("X"));
        plot.setRangeAxis(new LogAxis("Y"));

        ChartViewer chartViewer = new ChartViewer(chart);
        primaryStage.setScene(new Scene(chartViewer));

        primaryStage.show();
    }
}
@jfree
Copy link
Owner

jfree commented Jun 8, 2018

Thanks for the report. I just committed a fix for this, to be included in the v1.0.2 release.

@jfree jfree closed this as completed Jun 8, 2018
jfree added a commit that referenced this issue Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants