From: SourceForge.net <no...@so...> - 2008-04-28 10:31:41
|
Bugs item #1950037, was opened at 2008-04-23 19:24 Message generated for change (Comment added) made by mungady You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1950037&group_id=15494 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) >Assigned to: David Gilbert (mungady) Summary: ChartPanel.zoomRangeAxis broken for CombinedDomainXYPlot Initial Comment: Hi, This appears to be a bug either in ChartPanel or CombinedDomainXYPlot when trying to zoom in/out on the range axis. from ChartPanel [code] public void zoomOutRange(double x, double y) { Plot p = this.chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(this.zoomOutFactor, this.info.getPlotInfo(), translateScreenToJava2D(new Point((int) x, (int) y)), this.zoomAroundAnchor); } } [/code] This calls zoomRangeAxis() in XYPlot and not in CombinedDomainXYPlot. The other 2 zoomRangeAxis() methods are overridden in CombinedDomainXYPlot and correctly identify the sub plot to zoom. Because ChartPanel.zoomOutRange calls the one that is not overridden it tries to use the Range of the MainPlot and not the SubPlot. The Range is null so no zoom occurs. I have managed to get around this by overriding the methods in ChartPanel [code] //Create the actual chart final JFreeChart chart = new JFreeChart(null, null, mainPlot, false); //Create the visible chart panel chartPanel = new ChartPanel(chart) { public void zoomInRange(double x, double y) { Plot p = chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(getZoomInFactor(), getChartRenderingInfo().getPlotInfo(), translateScreenToJava2D(new Point((int) x, (int) y))); } } public void zoomOutRange(double x, double y) { Plot p = chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(getZoomOutFactor(), getChartRenderingInfo().getPlotInfo(), translateScreenToJava2D(new Point((int) x, (int) y))); } } }; [/code] (They call the methods without the this.zoomAroundAnchor so the overridden method gets called) My suggestion for a fix would be in CombinedDomainXYPlot to override the method [code] public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor); [/code] and not [code] public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source); } [/code] as it does currently. I think the same may be true of CombinedRangeXYPlot but I have not tested that. ---------------------------------------------------------------------- >Comment By: David Gilbert (mungady) Date: 2008-04-28 10:31 Message: Logged In: YES user_id=112975 Originator: NO Thanks for the report. This bug does indeed affect CombinedRangeXYPlot as well, and also CombinedDomainCategoryPlot. I'm fixing it now for the 1.0.10 release. Regards, Dave Gilbert JFreeChart Project Leader ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1950037&group_id=15494 |